Lesson 7: Managing the Linux Boot Process Flashcards
Explain the system boot up process?
BIOS/UEFI -> initializes hardware, POST occurs, then starting with CPU then copies BIOS/UEFI into RAM (then PCI bus and everything else)-> looks for checks for bootable media based off boot order
- > BIOS/UEFI loads the primary boot loader from the MBR/GPT partition into memory. It also loads the partition table along with it.
- > GRUB 2 (Grand Unified Boot Loader) loads OS. Each menu item inside boot loader is pointing to a destination or partition that contains boot files for an OS
- > boot loader determines the kernel and initialized (typical in it’s own partition or sub folder and found in /boot/vmlinuz) then looks for ramdisk -> initramfs (small root file sys) or initrd -> kernel launches ->
- > Init System Process ( either sysvinit or systemd (common)), these will be process number 1 which then powers everything else
The systemd program searches for the default.target file, whichcontains details about the services to be started. It mounts the file system basedon the /etc/fstab file and begins the process of starting services. On mostsystems, the target will either be multi-user.target orgraphical.target.
- If graphical mode is selected, then a display manager like XDM or KDM is startedand the login window is displayed on the screen.
- The user enters a user name and password to log in to the system.
What is it called when the system detects there has been a fatal error and responds to it?
Kernel Panic which can happen for a number of reasons and at any point during operation, but usually experienced during the boot process.
Common causes include the following:
- The kernel itself is corrupted or otherwise improperly configured
- The systemd program is not executed during boot, leaving the system unusable
- The kernel cannot find or otherwise cannot mount the main root file system.
- Malfunctioning or incompatible hardware is loaded into the kernel on boot
Where are the GRUB config files located?
/boot/grub2/grub.cfg
How would you make changes to the grub.cfg file?
You don’t make changes directly to the grub.cfg file but to the
/etc/grub.d/{custom_cfg} which grub-mkconfig looks at and passes to grub.cfg which will check for errors in custom file and decided to load or not
grub-mkconfig -o {specify_path}
What is the boot loader and it’s components?
Small program stored in the ROM that loads kernel from a storage device. Note that the boot loader is able to protect the boot process with a password to prevent unauthorized booting of the system.
Boot loader uses three main components:
- Boot sector program loaded by boot environment on startup and has a fixed size of 512 bytes. Main function is to load second stage boot loader
- Second stage boot loader Loads the OS and contains a kernel loader.
- Boot loader installer controls the installation of drive sectors and can be run only when booting from a drive. It coordinates the activities of the boot sector and the boot loader.
What are some additional boot options?
“Boot from ISO” - An ISO image is a system image, originally that of an optical disc. Today, it is commonly used to to construct VMs and as a file format for packaging and distributing images of OS that users can boot from, as well as use to install the OS.
“PXE” - Pre-boot Execution Environment (PXE) is a part of the UEFI standard that enables a client to retrieve the necessary boot loader and system files from a server over the network.
“Boot from HTTP/FTP” - Clients acquire boot data over a network from content delivery protocols like Hypertext Transfer Protocol(HTTP) and File Transfer Protocol (FTP). Typically faster, more reliable, and secure than the standard TFTP protocol used in PXE.
“Boot from NFS” - Network boot option. A client will mount an NFS share as its root file system that the client can retrieve the files from. DHCP, TFTP, and other network protocols can be used.
What is a Sector?
- Smallest unit of storage read from or written to a drive.
- Stores 512 bytes of data by default.
- A collection of sectors is called a track.
What are the three Major disadvantages?
1 Maximum storage space is two terabytes
2 Can only have a maximum of four primary partitions
3 Boot data is stored in one sector, which increases risk of corruption
What is a Raw Partition and how is it useful?
- Raw partition enables users and applications to read from and write to a block storage device directly, without using the system cache.
- useful in situations where software like a database management system (DBMS) has its own caching mechanism.
What command allow you to create a image for preloading the kernel modules?
mkinitrd - The syntax of the mkinitrd command is mkinitrd [options] {initrd image name} {kernel version}
Options:
–preload={module name} Load a module in the initrd image before theloading of other modules.
–with={module name} Load a module in the initrd image after the loading of other modules
-f Overwrite an existing initrd image file
–nocompress Disable the compression of the initrd image
What is the dracut command used for?
used to generate an initramfs image
example: dracut /boot/initramfs-$(uname -r).img $(uname -r)
What are some improvements of GRUB 2?
- Support for non-x86 architecture platforms
- Support for live booting
- Support for partition UUIDs
- Support for dynamically loading modules that extend GRUB’s functionality
- Ability to configure the boot loader through scripts
- Rescue mode, which attempts to fix boot issue
- Support for custom graphical boot menus and themes
How would you install GRUB 2?
grub2-install is used to install the GRUB 2 boot loader but this applies to BIOS systems, not UEFI. The syntax of the grub2-install command is grub2-install [options] [device name],
To install GRUB 2 on a UEFI system, use a package managerto install the grub2-efi package