Linux Boot Process

What Is the Linux Boot Process?

The boot process is the sequence of operations that a Linux system performs from the moment you power on the computer until the login prompt or GUI appears.

 

7 Stages of the Linux Boot Process

StageNameDescription
1BIOS / UEFIHardware initialization and POST check
2MBR / GPTBootloader location information on disk
3Bootloader (GRUB / LILO / systemd-boot)Loads the Linux kernel
4Kernel InitializationKernel loads drivers and mounts root filesystem
5initramfs / initrdTemporary filesystem for early boot tasks
6Init / systemdStarts system services and background daemons
7Login / GUIUser login shell or graphical interface

Stage 1: BIOS / UEFI (Firmware Stage)

  • BIOS (Basic Input/Output System) or UEFI runs first when the computer starts.

  • Performs POST (Power-On Self Test) — checks CPU, RAM, keyboard, etc.

  • Looks for a bootable disk (based on boot order).

  • Hands control to the bootloader stored in the MBR (Master Boot Record) or EFI partition.

File involved: Firmware chip on motherboard
Output: Bootloader code in memory


 

 Stage 2: MBR / GPT

  • MBR (Master Boot Record) or GPT (GUID Partition Table) contains partition info and the bootloader’s location.

  • The MBR is located in the first 512 bytes of the disk.

  • Points to the bootloader program (like GRUB).

Files: /dev/sda, partition tables
Output: Bootloader execution


 

Stage 3: Bootloader (GRUB, LILO, systemd-boot)

  • The bootloader is responsible for loading the Linux kernel into memory.

  • Common Linux bootloader: GRUB (GRand Unified Bootloader).

  • Displays a boot menu if multiple OSes are installed.

Main Tasks:

  1. Locate and load the kernel image (/boot/vmlinuz).

  2. Load the initial RAM disk (/boot/initrd or /boot/initramfs).

  3. Pass control to the kernel.

Files:

  • /boot/grub/grub.cfg (GRUB configuration)

  • /boot/vmlinuz-* (kernel)

  • /boot/initrd.img-* (initial RAM disk)

Output: Linux kernel loaded in memory


 

Stage 4: Kernel Initialization

  • Kernel is now running — it’s the core of Linux.

  • Initializes CPU, memory, device drivers, and mounts the root file system.

  • Switches from real mode to protected mode (full CPU control).

  • Loads necessary modules (network, file system, etc.).

  • Mounts the root filesystem / (read-only initially).

Files: /boot/vmlinuz-*, /lib/modules/
Output: Root filesystem mounted


 

Stage 5: initramfs / initrd (Initial RAM Disk)

  • A temporary root file system loaded into RAM before the real root filesystem mounts.

  • Used to load drivers needed to access the actual root partition (like RAID, LVM, or encrypted disks).

  • Once real root mounts, initramfs is removed from memory.

Files: /boot/initramfs-* or /boot/initrd-*
Output: Real root file system mounted


 

Stage 6: Init Process / systemd

  • After mounting the root filesystem, kernel executes the init process — traditionally /sbin/init, but now systemd in most Linux distros.

Systemd Responsibilities:

  1. Mount remaining file systems

  2. Start essential background services (network, logging, SSH, etc.)

  3. Manage targets (runlevels)

 

Old Runlevels (SysVinit) → systemd Targets

Runlevelsystemd TargetDescription
0poweroff.targetHalt
1rescue.targetSingle-user mode
3multi-user.targetText-based multi-user mode
5graphical.targetGUI mode
6reboot.targetReboot

📍 Files: /etc/systemd/, /lib/systemd/system/
📍 Output: All services started


 Stage 7: Login / GUI

  • After all system services start, the system presents:

    • CLI Login Prompt (tty)

    • or Graphical Login Screen (GDM, LightDM, etc.)

📍 Files: /etc/passwd, /etc/profile, ~/.bashrc
📍 Output: User shell or desktop environment