Boot process: BIOS/UEFI, GRUB, kernel, initramfs, systemd targets

Linux Essentials Preparation · lesson 18 of 23 · 25 min

The Linux Boot Process

Understanding the boot process helps diagnose startup failures and configure system behavior. The sequence from power-on to login prompt:

1. BIOS/UEFI — firmware initialises hardware (POST — Power-On Self Test). Finds the boot device. UEFI is the modern replacement for BIOS — supports GPT disks, Secure Boot, faster boot.

2. Bootloader (GRUB2) — GRUB (Grand Unified Bootloader) is the standard Linux bootloader. Presents a menu (if multiple OS/kernels). Loads the kernel and initramfs into memory. Config: /etc/grub.d/ and /etc/default/grub. Generated config: /boot/grub/grub.cfg.

3. Kernel — the Linux kernel is loaded and decompresses itself. Initialises hardware drivers. Mounts the initramfs (initial RAM filesystem) as a temporary root filesystem.

4. initramfs (initrd) — temporary minimal filesystem in RAM. Contains drivers and tools needed to mount the real root filesystem. Hands off to the real root filesystem once it is mounted.

5. systemd (PID 1) — the first process started by the kernel (PID 1). Manages all other services and processes. Reads unit files to determine what to start. Replaces the legacy SysV init system.

6. Targets — systemd targets replace SysV runlevels. Common targets: multi-user.target (runlevel 3 — multi-user, no GUI), graphical.target (runlevel 5 — with GUI), rescue.target (single-user mode), emergency.target.

systemd Targets and Commands

systemctl get-default — shows the default target (e.g., graphical.target).

systemctl set-default multi-user.target — changes the default target.

systemctl isolate rescue.target — switches to rescue mode immediately.

systemctl list-units –type=target — lists all active targets.

journalctl -b — shows boot log (all messages from current boot). journalctl -b -1 shows previous boot.

dmesg — shows kernel ring buffer messages — hardware detection, driver loading during boot.

Exam Tip

Boot order: BIOS/UEFI → GRUB → Kernel → initramfs → systemd. systemd is PID 1. multi-user.target = no GUI (runlevel 3). graphical.target = GUI (runlevel 5). journalctl -b shows boot messages.

Key Terms

Key Terms

Knowledge Check — 8 Questions

Linux Essentials — Boot Process

What is the correct order of the Linux boot process?

  • Kernel → GRUB → BIOS → systemd
  • BIOS/UEFI → GRUB → Kernel → initramfs → systemd
  • systemd → Kernel → GRUB → BIOS
  • initramfs → GRUB → Kernel → systemd

Answer: BIOS/UEFI → GRUB → Kernel → initramfs → systemd
BIOS/UEFI initialises hardware → GRUB loads the kernel → Kernel mounts initramfs → initramfs mounts real root → systemd starts services.

systemd is always assigned PID:

  • 0
  • 1
  • 100
  • Variable
  • Answer: 1

systemd is the first process started by the kernel — always PID 1. It is the parent of all other processes. graphical.target is equivalent to SysV runlevel:

  • 1
  • 3
  • 5
  • 6
  • Answer: 5

graphical.target = runlevel 5 (multi-user with GUI). multi-user.target = runlevel 3 (multi-user, no GUI). rescue.target = runlevel 1. The initramfs is used to:

  • Store user data
  • Provide a temporary root filesystem to mount the real root
  • Run GRUB
  • Configure network interfaces
  • Answer: Provide a temporary root filesystem to mount the real root

initramfs contains drivers and tools needed to mount the real root filesystem — especially important for encrypted or LVM volumes. journalctl -b shows:

  • All logs ever
  • Boot messages from the current boot
  • Only error messages
  • Network logs only
  • Answer: Boot messages from the current boot

journalctl -b shows all journal entries from the current boot. -b -1 shows the previous boot. -u service shows a specific service. UEFI improves on BIOS by:

  • Being slower but more compatible
  • Supporting GPT disks, Secure Boot, and faster boot times
  • Only supporting 32-bit systems
  • Removing the bootloader requirement
  • Answer: Supporting GPT disks, Secure Boot, and faster boot times

UEFI is the modern firmware standard — supports GPT (larger disks), Secure Boot (prevents unauthorized bootloaders), and faster startup. dmesg shows:

  • systemd service status
  • Kernel ring buffer messages — hardware detection during boot
  • User login history
  • Network configuration
  • Answer: Kernel ring buffer messages — hardware detection during boot

dmesg shows kernel messages — hardware detection, driver loading, and errors during boot. Useful for diagnosing hardware issues.

The GRUB configuration is generated from /etc/default/grub and stored in /boot/grub/_____.

Answer: grub.cfg
grub.cfg is the generated GRUB configuration file. Never edit it directly — edit /etc/default/grub then run update-grub or grub2-mkconfig.


Previous lesson: Networking on Linux: ip addr, ip route, ss, ping, traceroute, /etc/hosts, /etc/resolv.conf
Back to Linux Essentials Preparation
Next lesson: Users and groups: useradd, usermod, userdel, passwd, id, /etc/passwd, /etc/shadow, sudo, wheel