Unveiling the Linux Boot Process: From Power‑On to Init
This article walks through every stage of a Linux system’s startup—from the hardware POST check and BIOS boot selection, through GRUB loading and kernel initialization, to the init process and run‑level scripts—providing clear explanations and essential commands for system administrators.
1. Power‑On Self Test (POST)
After power is applied, the motherboard runs the POST program to check all internal devices. If a fatal error is detected, the system halts; for non‑fatal errors, it emits a beep or visual alert for the user to address.
2. BIOS Boot Stage
Once POST passes, the BIOS searches for bootable devices in order. The first device containing a boot program is selected. Users can enter the BIOS (typically via F2 or Del) to adjust the boot order. The BIOS then reads the MBR of the selected device and loads its bootloader.
3. GRUB Boot Stage
GRUB loads the selected Linux distribution (e.g., CentOS) automatically, though manual boot is also possible.
3.1 Manual boot from the GRUB command line
grub> root (hd#,#) grub> kernel /vmlinuz-VERSION-RELEASE ro root=/dev/DEVICE grub> initrd /initramfs-VERSION-RELEASE.img grub> boot3.2 GRUB command line interface
e – edit mode for menu entries
c – command mode (interactive)
help – list of commands
help KEYWORD – detailed help
find (hd#,#)/PATH/TO/SOMEFILE – locate a file
root (hd#,#) – set GRUB root device
kernel /PATH/TO/KERNEL_FILE – specify kernel file and optional cmdline parameters (e.g., init=/path/to/init, selinux=0)
initrd /PATH/TO/INITRAMFS_FILE – provide an initramfs image
boot – start the selected kernel
3.3 GRUB configuration file (/boot/grub/grub.conf)
Key entries include:
default=# – default menu entry (starting from 0)
timeout=# – wait time for user selection
splashimage=(hd#,#)/PATH/TO/XPM_PIC_FILE – background image
hiddenmenu – hide the menu
password [--md5] STRING – menu authentication
title TITLE – define a menu entry title
root (hd#,#) – device containing stage2 and kernel
kernel /PATH/TO/VMLINUZ_FILE [PARAMETERS] – kernel to boot
initrd /PATH/TO/INITRAMFS_FILE – associated initramfs
4. Kernel Loading Stage
The kernel initializes itself, detects all hardware, loads drivers (potentially via ramdisk), mounts the root filesystem read‑only, and then starts the first user‑space program: /sbin/init.
5. Init Initialization Stage
After the kernel finishes loading, it runs the init program, which becomes the parent of all processes. init reads /etc/inittab and performs several tasks:
Executes system initialization scripts ( /etc/rc.d/rc.sysinit) to configure the system and mount filesystems read‑write.
Determines the target run level.
Runs /etc/rc.d/rc, which starts services in order (K scripts first, then S scripts). Service status for each run level is stored in /etc/rc.d/rcn.d (n=0~6) and linked to /etc/init.d scripts.
Handles key sequence settings, UPS scripts, virtual terminal startup ( /sbin/mingetty), and X server launch at run level 5.
Configuration file: /etc/inittab
Each line defines an action and its associated process in the format id:runlevels:action:process:
id – task identifier
runlevels – levels on which the task runs (empty means all)
action – condition for execution (e.g., wait, respawn, initdefault, sysinit)
process – the script or program to run
Common actions
wait– run once when entering the specified level respawn – restart the task if it terminates initdefault – set the default run level (process omitted) sysinit – system initialization, usually
/etc/rc.d/rc.sysinitService start/stop prefixes
K*– stop services (lower numbers stop earlier) S* – start services (lower numbers start earlier)
chkconfig command
Manages the enable/disable state of /etc/init.d scripts across run levels: chkconfig --list [name] – view status chkconfig --add name – add script chkconfig --del name – remove script chkconfig [--level LEVELS] name on|off|reset – set run‑level control (default 2,3,4,5)
init command
init #– change run level who -r – display current run level
Note
At the normal run level, the last service S99local is linked to /etc/rc.d/rc.local rather than an /etc/init.d script, allowing custom programs to run at boot without creating a service script.
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.
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.
