LAB 1 - Boot Sequence
Learn how to manage boot options and understand the boot sequence.
Lab Purpose:
In this lab, you will practice issuing commands to the boot loader, and gain a deeper understanding of the Linux boot process, from BIOS/UEFI to completion.
Lab Tool:
Ubuntu 18.04 (or another distro of your choice)
Lab Topology:
A single Linux machine, or virtual machine
Lab Walkthrough:
Task 1:
Open the Terminal and run:
What you’re doing here is modifying the GRUB bootloader so that you can see the boot menu and various logs.
Run dmesg | grep ATA
—you are looking for a line indicating your hard disk, beginning with something like ata2.00 or ata3.00. Make a note of this number for later.
Finally, reboot your computer or VM.
Task 2:
Upon boot, you should be greeted with a GRUB menu. Hit ‘c’ to enter the GRUB prompt. Here, you can run various bootloader commands. Use ls
to explore your partitions; the format looks a bit different, for example, (hd0,msdos1). There are also commands like lsmod, lspci,
and parttool
. Do these look familiar? Run help for a full list.
Then, hit ESC to return to the boot menu.
Task 3:
Back at the boot menu, hit ‘e’ to enter a screen where you can modify the boot commands. Depending on your implementation, there may be a lot here, but you are looking for a line beginning with “linux”. This is the line that loads the Linux kernel, and is the most commonly modified line for editing boot options.
At the end of that line, append libata.force=[number]:disable
, where [number]
is the number you noted above, such as 3.00.
Now, hit Ctrl+X to boot your computer.
Task 4:
After a couple of minutes, you may notice that something has gone wrong! You have disabled your primary hard disk, causing Linux to be unable to boot. It may have looked like it was booting initially, though. That’s because the next step of the boot process is to load the initial RAM disk (initrd), prior to loading the kernel. The initrd was successful whereas the kernel step failed, which is why you should have ended up at a (initramfs)
prompt.
In short, the Linux boot process goes like this:
BIOS/UEFI enumerates hardware and loads code from the configured boot device (not Linux-specific).
GRUB bootloader loads, parses boot commands and options.
Initrd is loaded, bootstraps various filesystems and modules, and then loads the kernel.
The init process is launched, which in turn executes all startup processes as configured within Linux.
Type reboot
to reboot your computer/VM and return it to normalcy.
If you’d like to undo the GRUB changes made in step 1, just run:
Notes:
The reason an initial RAM disk is used is because Linux is a generic operating system meant to run on a wide variety of hardware and disk configurations. Having to enable checks for all of these configurations in the kernel directly would make the kernel much larger than necessary. Thus, a temporary filesystem is used to do all of the special case handling, and then load the correct modules along with the kernel.
Last updated