How Linux Boots: BIOS/UEFI to Login
When you press the power button on a Linux machine, five distinct things happen before you see a login prompt. Most people never think about this until something breaks. Understanding the chain is the difference between “I’ll just reinstall” and “I’ll boot into recovery and fix it.”
Stage 1: firmware (BIOS or UEFI)
The motherboard’s firmware (BIOS on old systems, UEFI on modern ones) runs first. It powers up hardware, runs the POST (Power-On Self-Test), and then looks for something to boot from — your hard drive, USB stick, or network.
- BIOS reads the first 512 bytes of the boot disk (the MBR) and runs that.
- UEFI reads an EFI System Partition (ESP) on the disk and runs an .efi file from it.
Stage 2: bootloader (GRUB)
The firmware hands off to a bootloader — almost always GRUB 2 on Linux. GRUB shows you a menu of operating systems and kernels. Pick one, and GRUB loads:
- The Linux kernel (a file like
/boot/vmlinuz-6.6.10) - The initramfs (a small temporary root filesystem like
/boot/initrd.img-6.6.10)
Then it transfers control to the kernel.
Stage 3: the kernel boots
The kernel decompresses itself into RAM, initializes hardware drivers, mounts the initramfs as a temporary root filesystem, and looks for the real root filesystem (your /) on disk. Once it finds and mounts the real root, it executes the first userspace program: init.
Watch this happen on your next boot:
# Show kernel boot messages
dmesg | less
# Or with timestamps
dmesg -T
Stage 4: init (systemd)
The first process is PID 1. On almost every modern Linux system, that’s systemd. systemd reads its unit files (in /etc/systemd/system/ and /usr/lib/systemd/system/), figures out the target you want to boot into (usually multi-user.target or graphical.target), and starts services in dependency order.
This is when networking starts, when SSH starts, when your display manager starts.
# See what systemd is doing during boot
systemd-analyze
systemd-analyze blame # which services took longest
systemd-analyze critical-chain
Stage 5: login
Either a text login prompt (getty) on a TTY or a graphical login screen (gdm, sddm, lightdm). After you log in, your shell starts (bash, zsh) or your desktop environment starts.
The whole chain in one picture
Power on
↓
Firmware (BIOS / UEFI)
↓
Bootloader (GRUB 2)
↓
Linux kernel + initramfs
↓
init (systemd, PID 1)
↓
Services (network, SSH, display manager)
↓
Login prompt
Where boot problems come from
- Black screen at power-on: hardware or firmware. Not Linux’s fault yet.
- “No boot device”: firmware can’t find the bootloader. Fix in BIOS settings or repair GRUB.
- GRUB rescue prompt: bootloader is broken. Boot a live USB and run
grub-install. - Kernel panic: kernel started but failed to mount root. Often missing kernel modules in initramfs.
- Hangs at “started X” service: a systemd unit is stuck. Boot with
systemd.unit=rescue.targetkernel parameter.
What to learn next
The filesystem layout — knowing where everything lives — is the natural next step. systemd itself gets its own deeper dive in the service management section of this roadmap.