Understanding the Linux Boot Process: From BIOS to Login
This article walks through the complete Linux startup sequence, explaining the roles of BIOS, MBR, boot loaders like GRUB, the initramfs, kernel loading, runlevels, and final login, while illustrating each step with diagrams and detailed descriptions.
Boot Process Overview
The Basic Input Output System (BIOS) is firmware stored on a ROM chip on the motherboard that performs hardware initialization, self‑test, and loads the first boot program according to its configuration.
MBR (Master Boot Record) is the first sector of a disk (512 bytes) containing pre‑boot information and the partition table.
Boot Loader is a small program that runs before the operating system kernel, initializing hardware and preparing the environment for the kernel.
Detailed Boot Steps
Step 1 – Load BIOS : Power on the computer; the hardware automatically loads BIOS, reads hardware information, performs POST, and locates the first device with a boot program.
Step 2 – Read MBR : The first sector (MBR) of the selected hard disk is copied into memory; it contains the boot loader (e.g., LILO or GRUB).
Step 3 – Start Boot Loader : The boot loader (commonly GRUB) presents a menu for selecting an OS or kernel version, loads the chosen kernel into RAM, and decompresses it.
Step 4 – Load Kernel : GRUB transfers control to the kernel, which probes hardware and attempts to mount the root filesystem. An initial RAM disk (initramfs) is loaded to provide necessary drivers (e.g., USB, RAID, LVM) before the real root can be accessed.
Step 5 – Run /sbin/init and Set Runlevel : After the kernel finishes loading, the first user‑space program /sbin/init reads /etc/inittab to determine the system runlevel.
Step 6 – init Executes rc.sysinit : Based on the runlevel, /etc/rc.d/rc.sysinit runs to set hostname, welcome message, activate swap, mount filesystems from /etc/fstab, set the clock, apply kernel parameters, activate LVM/RAID, load additional drivers, and perform cleanup.
Step 7 – Load Kernel Modules : Modules listed in /etc/sysconfig/modules are loaded.
Step 8 – Execute Run‑level Service Scripts : Scripts in /etc/rc.d/rc[0‑6].d are executed according to the current runlevel to start services.
Step 9 – Run /etc/rc.d/rc.local : This script allows users to add custom commands after all standard initialization is complete.
Step 10 – Execute /bin/login : The system starts a terminal or X Window session and waits for the user to log in.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
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.
