Linux Boot Process
Linux Boot Process
An overview of the Linux boot process, explaining what happens from the moment you press the power button to when you reach the login screen.
Interactive version: https://www.hackers-game.com/2020/08/23/linux-boot-process/
This video covers the various stages of Linux system initialization, providing fundamental knowledge for Linux system administrators and anyone wanting to troubleshoot boot-related issues.
Stage 1: BIOS/UEFI
When you press the power button:
1. Power-On Self Test (POST): Hardware initialization and verification
2. Device enumeration: Identifying connected hardware
3. Boot device selection: Finding the bootloader
BIOS vs UEFI
- BIOS: Legacy firmware, MBR partition tables, limited to 2TB drives
- UEFI: Modern firmware, GPT partition tables, secure boot support
- Located at
/boot/grub/grub.cfg - Generated by
grub-mkconfigorupdate-grub - Allows kernel parameter modifications
Stage 2: Bootloader (GRUB)
GRUB (Grand Unified Bootloader) is the most common Linux bootloader:
1. Stage 1: Loaded from MBR or EFI partition
2. Stage 1.5: Filesystem drivers (for BIOS systems)
3. Stage 2: Full GRUB environment with menu
GRUB Configuration
Stage 3: Kernel Loading
The Linux kernel initialization:
1. Kernel decompression: The compressed kernel extracts itself
2. Hardware initialization: Setting up CPU, memory, devices
3. Mounting initramfs: Temporary root filesystem
4. Loading drivers: Required for accessing the real root filesystem
Stage 4: Init System (systemd)
Modern Linux distributions use systemd:
1. PID 1: systemd becomes the first user process
2. Target units: Defining system states (multi-user, graphical)
3. Service startup: Parallel service initialization
4. Dependency management: Ensuring correct startup order
Key systemd Commands
Check boot time
systemd-analyzeView boot blame
systemd-analyze blameCheck service status
systemctl statusView boot log
journalctl -b
Stage 5: Login
Finally, the login prompt appears:
Troubleshooting Boot Issues
Understanding the boot process helps diagnose problems: