The boot process happens In this order.
Basic Input/Output System (BIOS)
Special firmware (independent from OS).
Power-On Self Test (POST)
- Perform basic test of hardware components, like CPU, memory and storage devices
- When POST succeeds, find and execute the boot loader. Boot device search order can be changed (hard drives, USB drives, DVD, etc.)
Boot Loaders
Start the operating system (OS), with different boot options. Allows to choose which OS to boot.
- Linux Loader (LILO)
- Grand Unified Bootloader (GRUB), replaced LILO
/boot directory
Contains the files required to boot Linux.
Initial RAM Disk (initrd)
- File initrd.img-<version>
- Temporary file system loaded from disk into memory.
- Contains helpers that perform hardware detection, and load modules (drivers) required to load the permanent OS file system.
cd /boot
ls -la initrd*
Boot loader configuration
Grand Unified Bootloader (GRUB)
cd /boot/grub
ls -la
# GRUB configuration
cat grub.cfg
Linux Kernel
- Kernel is usually named vmlinux-<version> or vmlinuz-<version> (if compressed)
cd /boot
ls -la vmlinu*
Kernel Ring Buffer
Kernel Ring Buffer contains messages from the Linux kernel, even from the boot process. Messages are stored in /var/log/dmesg
# Display content of the kernel ring buffer
# The kernel ring buffer will fill up and the first messages will be discarded
dmesg -T
# To see all messages since boot
cat /var/log/dmesg
Runlevels
Linux uses Runlevels to determine what processes and services to start.
- Was controlled by the init program /etc/inittab, but is being replaced by systemd
- Systemd uses targets instead of runlevels
Systemd
Show list of targets
cd /lib/systemd/system
ls -l runlevel5.target
# runlevel5.target -> graphical.target
systemctl get-default
# Set default to boot in graphical mode (graphical user interface)
systemctl set-default graphical.target
# Start the graphical target (boot using the graphical user interface)
systemctl isolate graphical.target