How the Linux Boot Process Works
From pressing the power button to seeing a login prompt takes only a few seconds, but an impressive amount of work happens in that time. Understanding each step makes you a much better debugger when things go wrong — and helps you understand systemd, kernel panics, and rescue mode.
The Complete Boot Sequence
1. Power On
└─→ CPU starts at reset vector (0xFFFFFFF0)
2. BIOS / UEFI (Firmware)
└─→ POST (Power-On Self Test) — RAM, CPU, devices
└─→ Finds bootable disk (via boot order)
└─→ Loads bootloader from disk
3. GRUB (Bootloader)
└─→ Reads /boot/grub/grub.cfg
└─→ Shows boot menu (if configured)
└─→ Loads kernel (vmlinuz) + initramfs into RAM
└─→ Passes kernel command-line parameters
└─→ Jumps to kernel entry point
4. Kernel Initialization
└─→ Decompresses itself (vmlinuz is compressed)
└─→ Detects CPU, sets up memory (page tables)
└─→ Sets up interrupt table (IDT)
└─→ Initializes scheduler, memory manager
└─→ Mounts initramfs as temporary root (/)
5. initramfs
└─→ Runs /init (usually systemd or busybox script)
└─→ Loads storage drivers (NVMe, SATA, RAID, LVM)
└─→ Finds and mounts the real root filesystem
└─→ pivot_root → switches to real root
6. PID 1 (systemd / init)
└─→ Starts services in dependency order
└─→ Brings up networking, logging, time sync
└─→ Reaches default.target (usually graphical.target)
7. Login Prompt
└─→ getty / display manager starts
BIOS vs UEFI
What's the difference between BIOS and UEFI?
BIOS (Basic Input/Output System) is the old firmware standard. It reads the first 512 bytes of the disk (MBR — Master Boot Record) and jumps to whatever code is there. UEFI (Unified Extensible Firmware Interface) is the modern replacement — it can read filesystems directly, supports larger disks, and provides Secure Boot.
| BIOS | UEFI | |
|---|---|---|
| Boot mechanism | MBR (512 bytes) | EFI partition (.efi files) |
| Disk size limit | 2 TB (MBR) | 9.4 ZB (GPT) |
| Secure Boot | No | Yes |
| Interface | Text-based | Often graphical |
What Can Go Wrong — and Where
| Stage | Failure Symptom | Common Cause |
|---|---|---|
| BIOS/UEFI | No bootloader found / black screen | Boot order wrong, disk failed |
| GRUB | "GRUB rescue>" prompt | grub.cfg missing, wrong disk |
| Kernel | Kernel panic | Bad kernel params, corrupted kernel |
| initramfs | "Unable to mount root fs" | Missing storage drivers, wrong UUID |
| systemd | Emergency mode or hung services | Failed service, filesystem errors |
How do I enter rescue mode if boot fails?
At the GRUB menu, press
e to edit the boot entry. Append systemd.unit=rescue.target (or single for SysV) to the kernel line. Press Ctrl+X to boot. You'll get a root shell with minimal services.
Measuring Boot Time
# See how long each service took to start
systemd-analyze blame
# Visual boot timing chart
systemd-analyze plot > boot.svg
# Total boot time breakdown
systemd-analyze
# Startup finished in 1.2s (firmware) + 0.8s (loader) + 2.1s (kernel) + 5.3s (userspace)
Frequently Asked Questions
What will I learn here?
This page covers the core concepts and techniques you need to understand the topic and progress confidently to the next lesson.
How should I use this page?
Start with the overview, then follow the section links to deepen your understanding. Use the table of contents on the right to jump to specific sections.
What should I read next?
Use the navigation below to continue to the next lesson or explore related topics.