A Complete Walkthrough of Linux Boot: From Power‑On to Login Screen
From pressing the power button to reaching the login screen, this article dissects each Linux boot stage—BIOS/UEFI, GRUB bootloader, kernel initialization, initramfs, and systemd—explaining their roles, key actions, and useful commands for inspecting the process.
Stage 1: BIOS/UEFI – Hardware Self‑Introduction
When the power button is pressed, the CPU starts executing from a fixed address stored in the motherboard’s BIOS (or modern UEFI) firmware.
BIOS main tasks:
POST self‑test : verifies CPU, memory, graphics, etc.
Device enumeration : scans disks, USB, NICs.
Boot order determination : selects the device to boot from according to firmware settings.
Bootloader loading : reads the first 512 bytes (MBR or ESP) of the chosen device into memory.
Cold fact: Traditional BIOS can only boot from MBR and supports up to 2 TB disks; UEFI supports GPT, removing that limit.
Stage 2: Bootloader – Choosing the Kernel
Control passes from BIOS/UEFI to the bootloader on the disk, most commonly GRUB (GRand Unified Bootloader) on Linux systems.
GRUB responsibilities:
Display a menu (useful for multi‑boot setups).
Read the /boot/grub/grub.cfg configuration file.
Load the Linux kernel image ( vmlinuz) and the initial ramdisk ( initrd.img) into memory.
Set kernel command‑line parameters (e.g., root=/dev/sda1 quiet).
The classic black‑on‑white GRUB screen with a countdown lets users pick a different kernel version, often used to recover a broken system.
Stage 3: Kernel – The Heart of the System
After GRUB loads vmlinuz, the compressed kernel image begins its own “awakening”.
Key kernel‑startup steps:
Decompression : the kernel unpacks itself.
Page‑table creation : initializes virtual memory management.
Early console activation : earliest log output (the dmesg lines starting at [0.000000]).
Hardware detection : probes CPU features, memory size, PCI devices, ACPI tables.
Driver loading : loads drivers needed for storage controllers, filesystems, etc.
Initramfs mounting : mounts a temporary root filesystem that contains the tools required for the next stage.
To view the kernel boot log, run dmesg, which prints every record beginning with [0.000000].
Stage 4: initramfs – A Temporary “Home”
initramfsis a compressed cpio archive that the kernel mounts as a temporary root filesystem. Its purpose is to provide enough utilities so the kernel can mount the real root filesystem.
Why initramfs is needed:
Modern Linux roots may reside on LVM, RAID, encrypted partitions, or network filesystems.
The kernel itself cannot contain all filesystem and encryption modules (size constraints).
initramfs supplies modules and tools such as cryptsetup and lvm to “unlock” the true root partition.
After its job is done, initramfs is unmounted and control is handed to /sbin/init on the real root filesystem.
Stage 5: systemd – The First Userspace Process
Most modern Linux distributions use systemd as PID 1. It is the ancestor of all other userspace processes and manages service startup.
systemd boot flow:
Read default.target to decide the boot target (commonly multi-user.target or graphical.target).
Resolve dependencies among .service and .target units and build a dependency tree.
Start independent services in parallel, dramatically shortening boot time.
Key services include systemd-udevd (device management), NetworkManager (network), sshd (remote login), journald (logging), etc.
If the target is graphical.target, systemd also launches a display manager such as GDM or LightDM, eventually presenting the login screen.
To see overall timing, run systemd-analyze, which might output something like:
Startup finished in 2.345s (kernel) + 5.678s (userspace) = 8.023sFor a detailed breakdown, systemd-analyze blame lists services ordered by the time they consumed, helping locate the “slow” components.
Summary of the Boot Journey
Power‑on → BIOS/UEFI POST → GRUB loads kernel → Kernel decompresses and initializes → initramfs mounts the real root → systemd starts services → login screen appears. The whole sequence typically finishes in under ten seconds, embodying decades of operating‑system design.
Practical Command Cheat Sheet
dmesg– view kernel boot log. systemd-analyze – view total boot time. systemd-analyze blame – list services by duration. systemctl list-units – list active services. cat /boot/grub/grub.cfg – view GRUB configuration.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
AI Agent Super App
AI agent applications, installation, large-model testing, computer fundamentals, IT operations and maintenance exchange, network technology exchange, Linux learning
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
