We all know that starting any machine typically begins with pressing a power button. However, that’s just the beginning—especially for machines running an operating system. After powering on, these systems go through several stages before becoming fully operational and ready to perform tasks.
The Linux boot process is a structured, multi-stage procedure that initializes hardware components and loads the operating system. Below is an overview of the six essential stages involved:
- BIOS/UEFI
- Bootloader (GRUB/LILO)
- Kernel
- Initrd/Initramfs
- Init/Systemd
- Runlevel/Target
BIOS / UEFI Initialization
What happens:
- The BIOS (Basic Input/Output System) or UEFI firmware is the first code that runs when the computer is powered on.
- It performs POST (Power-On Self Test) to verify hardware integrity.
- It checks for connected storage devices and looks for a bootable disk.
- It then loads the bootloader from the Master Boot Record (MBR) or EFI system partition.
Key Files:
- BIOS stored in ROM
- UEFI settings in NVRAM
Bootloader (GRUB / LILO / SYSLINUX)
What happens:
- The bootloader is responsible for loading the Linux kernel into memory.
- GRUB (GRand Unified Bootloader) is the most commonly used.
- GRUB presents a boot menu, allowing the user to choose the OS or kernel version.
- Reads its config file (e.g., /boot/grub/grub.cfg).
Features:
- Supports multi-boot environments.
- Loads the kernel and optionally initramfs.
Loading the Linux Kernel
What happens:
- Once the user (or bootloader) selects an OS, the Linux kernel is loaded into memory.
- The kernel initializes the hardware drivers, memory, CPU scheduling, device management, and more.
- It mounts the initial root filesystem (initramfs) temporarily.
Key File:
- /boot/vmlinuz-* → Compressed Linux kernel image
Initrd / Initramfs
What happens:
- The initrd (initial RAM disk) or initramfs (initial RAM filesystem) contains temporary files, kernel modules, and scripts needed to mount the real root filesystem.
- Helps with loading drivers for filesystems, RAID, LVM, etc.
- Once the real root partition is available, the initrd is discarded.
Key File:
- /boot/initrd.img-* or /boot/initramfs-*
INIT System (Systemd / SysVinit / Upstart)
What happens:
- Once the kernel has initialized the system, it starts the init process, which has PID 1.
- Most modern distros use systemd as the init system.
- Systemd initializes services, mounts, targets, and userspace applications.
Alternatives:
- systemd: Used in Ubuntu, Fedora, Arch, etc.
- SysVinit: Older systems
- Upstart: Legacy (Ubuntu <=14.04)
Reaching Runlevel / Target
What happens:
- The init system starts the default runlevel (SysVinit) or target (systemd).
- This decides whether the system boots into:
- Graphical UI
- Command Line
- Multi-user networked mode
- Finally, the system is ready for user login.
Summary Flowchart
Power ON
↓
BIOS/UEFI → POST
↓
Bootloader (GRUB)
↓
Linux Kernel
↓
Initramfs/Initrd
↓
Init System (systemd)
↓
Default Target / Runlevel
↓
Login Prompt or GUI Login
Useful Commands to Explore Boot Process
Command | Description |
---|---|
dmesg | Shows kernel boot messages |
journalctl -b | Systemd log from the current boot |
systemctl list-units –type=service | Active services post-boot |
ls /boot/ | Lists kernel and initrd files |
cat /proc/cmdline | Kernel boot parameters |