LPIC 101.2 Boot the system

Weight: 3

Description: Candidates should be able to guide the system through the booting process.

Key Knowledge Areas:

  • Provide common commands to the boot loader and options to the kernel at boot time
  • Demonstrate knowledge of the boot sequence from BIOS to boot completion
  • Understanding of SysVinit and systemd
  • Awareness of Upstart
  • Check boot events in the log files

Terms and Utilities:

  • dmesg
  • BIOS
  • bootloader
  • kernel
  • initramfs
  • init1
  • SysVinit
  • systemd

The Linux Boot Process

SysVinit Based

  1. Power on
  2. Processor loads firmware(BIOS/EFI) that is stored in a EEPROM chip in the motherboard
  3. BIOS/EFI initializes the POST (Power-On Self Test) to check hardware resource
  4. BIOS/EFI searches and loads the 1st stage boot loader, located in the MBR or in the EFI partition of the first available disk, and gives control to it
  5. MBR initiates the Boot loader(GRUB or LILO)
    BIOSBoot

    Instead of relying on code stored in boot sectors on the hard disk, EFI relies on boot loaders stored as files in a disk partition, known as the EFI System Partition (ESP), which uses the File Allocation Table (FAT) filesystem.

    Boot loaders reside in files with .efi filename extensions stored in sub-directories named after the OS or boot loader name under the EFI sub-directory of the ESP. Thus, you might have a boot loader called /boot/efi/EFI/ubuntu/grub.efi or /boot/efi/EFI/suse/elilo.efi. This configuration enables you to store a separate boot loader for each OS you install on the computer. EFIBoot

  6. GRUB or LILO loads the kernel module
  7. Kernel module find /sbin/init and executes it
  8. Init read /etc/inittab then decides the run level
  9. Init finds partition table information from /etc/fstab file and mounts partitions accordingly
  10. Init then launches all the services/scripts specified in the /etc/init.d directory of the default run level.

Systemd Based (find in systemd part)

Boot Loaders

Usually the boot loader installed to one of two places: MBR(the first sector on hard drive) or boot sector(the first sector of one of the Linux partitions).

Common Commands at Boot Time

Parameters typed on the boot options prompt are passed directly to the Kernel upon initialization.

Some common Linux boot options:

  • Set the framebuffer’s resolution. Such as vga=7922 (this does not affect the definition in Xorg).

  • Turn off APM (Advanced Power Management) for compatibility reason by setting apm=off or noapm.

  • Set system reboot time after a panic occur by using panic=#seconds.

  • Enter troubleshooting(single user) mode by adding single or 1.

  • ro will mount root filesystem in read-only mode so that the fsck can be used to check root filesystem errors.

systemd

systemd is a system and service manager for Linux, compatible with SysV and LSB init scripts. systemd uses socket and D-Bus activation for starting services, offers on-demand starting of daemons, keeps track of processes using Linux control groups, supports snapshotting and restoring of the system state, maintains mount and automount points and implements an elaborate transactional dependency-based service control logic.

systemd structure systemd structure

systemd based boot process SystemdBoot

Logging Boot Events

Sysv system
dmesg

systemd system

  • dmesg command still available
  • use journalctl utility
    jalo@myhost:~$ journalctl --list-boots 0 28c00d01142c4ccaa8c14bd1b5488c12 Thu 2016-10-27 15:11:31 CST—Thu 2016-10-27 15:12:03 CST

    0 is the reference ID for latest boot of the system 28c00d01142c4ccaa8c14bd1b5488c12 is the actual boot id

  • To view the previous system boot log, you would use the command:
    journalctl --boot=28c00d01142c4ccaa8c14bd1b5488c12