1.1 Explain Linux boot process concepts Flashcards
Describe the Linux Boot Process
The BIOS or UEFI starts a bootloader program from the Master Boot Record, which is usually the Linux GRUB Legacy or GRUB2 program. The bootloader program loads the Linux kernel into memory, which in turn looks for the init program to run. The init program starts individual application programs and starts either the command-line terminals or the graphical desktop manager
Where are kernel boot messages stored?
Boot kernel messages are stored into a special ring buffer in memory, called the kernel ring buffer.
What command is used to display the most recent boot messages that are currently stored in the kernel ring buffer?
dmesg
What file are boot messages stored?
Most Linux distributions also store the boot messages in a log file, usually in the /var/log folder
BIOS
Basic Input/Output System (BIOS)
The MBR is the first sector on the first hard drive partition on the system. There is only one MBR for the computer system. The BIOS looks for the MBR and reads the program stored there into memory. Since the bootloader program must fit in one sector, it must be very small, so it can’t do too much. The bootloader program mainly points to the location of the actual operating system kernel file, stored in a boot sector of a separate partition installed on the system. There are no size limitations on the kernel boot file
EFI
Extensible Firmware Interface (EFI)
UEFI
Universal Extensible Firmware Interface
Instead of relying on a single boot sector on a hard drive to hold the bootloader program, UEFI specifies a special disk partition, called the EFI System Partition (ESP), to store bootloader programs. This allows for any size of bootloader program, plus the ability to store multiple bootloader programs for multiple operating systems
Where are ESP typically mounted?
On Linux systems, the ESP is typically mounted in the /boot/efi folder, and the bootloader files are typically stored using the .efi filename extension, such as linux.efi
GRUB
The GRUB Legacy bootloader stores files in the /boot/grub folder and uses the menu.lst or grub.conf configuration file to define commands used at boot time. The commands can create a boot menu, allowing you to select between multiple boot locations, options, or features. You must use the grub-install program to install the GRUB Legacy bootloader program into the Master Boot Record
GRUB2
The GRUB2 bootloader also stores files in the /boot/grub folder, but it uses the grub.cfg configuration file to define the menu commands. You don’t edit the grub.cfg file directly but instead store files in the /etc/default/grub file or individual configuration files in the /etc/grub.d folder. Run the grub-mkconfig program to generate the GRUB2 configuration from the configuration files and then redirect the output to the /etc/grub.cfg file.
PXE
A bootloader for booting from a network server
while PXE was designed to use TFTP to load the boot image, it has been modified to also load the bootloader image stored on a network server using NFS, HTTP, or even FTP.
Boot from ISO
A bootloader for booting from a LiveCD or LiveDVD
Kernel Panics
Kernel failures are when the Linux kernel stops running in memory, causing the Linux system to crash. This is commonly referred to as a kernel panic. Kernel panics often are a result of a software change, such as installing a new kernel without the appropriate module or library changes or starting (or stopping) a program at a new runlevel. Often these types of boot errors can be fixed by starting the system using an alternative method and editing the necessary files to change the system
Single-User Mode
At times you may need to perform some type of system maintenance, such as add a new hardware module or library file to get the system to boot properly. In these situations, you want the system to boot up without allowing multiple users to connect, especially in a server environment. This is called single-user mode.
The GRUB menu allows you to start the system in single-user mode by adding the single command to the linux line in the boot menu commands. To get there, press the E key on the boot option in the GRUB boot menu.
When you add the single command, the system will boot into runlevel 1, which creates a single login for the root user account. Once you log in as the root user account, you can modify the appropriate modules, init scripts, or GRUB boot menu options necessary to get your system started correctly
What is the initrd command used for?
If you install new hardware on your system that’s required to be visible at boot time, you’ll need to modify the initrd file. You can create a new initrd RAM disk image containing modules for the new hardware using the mkinitrd command in Red Hat–based systems. For Debian-based systems, the file is called initramfs, and you create it using the mkinitramfs command. Alternatively, you can use the dracut utility, which creates the initramfs image from a framework and copies files from the installed modules