Operations 8 min read

Unveiling the Secrets Behind Linux Boot: From Power-On to Init

Discover how a Linux system powers up, covering the POST hardware check, BIOS boot selection, GRUB loading, kernel initialization, the init process with inittab configuration, and essential commands like chkconfig and init for managing runlevels and services.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Unveiling the Secrets Behind Linux Boot: From Power-On to Init

Linux Boot Process Overview

When the power button is pressed, the system goes through several stages before the user space is available.

1. Power-On Self Test (POST)

After power is applied, the motherboard runs the POST program to check all devices. Fatal errors halt the machine, while non‑fatal errors generate audible or visual alerts for the user.

2. BIOS Boot Stage

Once POST succeeds, the BIOS searches for a bootable device in the configured order (adjustable via the BIOS setup, typically accessed with F2 or Del). It reads the MBR of the first device containing a bootloader.

3. GRUB Boot Stage

The GRUB bootloader then loads the selected kernel. Users can also start the system manually from the GRUB command line:

grub> root (hd#,#)
grub> kernel /vmlinuz-VERSION-RELEASE ro root=/dev/DEVICE
grub> initrd /initramfs-VERSION-RELEASE.img
grub> boot

GRUB command‑line options include:

e – edit mode for menu entries

c – command mode (interactive)

help – list of commands

help KEYWORD – detailed help

find (hd#,#)/PATH/TO/FILE – locate a file

root (hd#,#) – set GRUB root device

kernel /PATH/TO/KERNEL_FILE – specify kernel and optional parameters (e.g., init=/path/to/init, selinux=0)

initrd /PATH/TO/INITRAMFS_FILE – specify initramfs

boot – boot the selected kernel

The GRUB configuration file /boot/grub/grub.conf contains entries such as:

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 – menu entry title

root (hd#,#) – device containing stage2 and kernel

kernel /PATH/TO/VMLINUZ_FILE [PARAMETERS] – kernel to load

initrd /PATH/TO/INITRAMFS_FILE – associated initramfs

4. Kernel Loading Stage

The kernel initializes itself, detects hardware, loads drivers (often via an initramfs), mounts the root filesystem read‑only, and starts the first user‑space process /sbin/init.

5. init Initialization Stage

After the kernel finishes, /sbin/init becomes the parent of all processes. It reads /etc/inittab to determine the default runlevel and executes the system initialization script /etc/rc.d/rc.sysinit, which mounts filesystems and prepares the environment.

Subsequent steps include:

Determining the target runlevel.

Running scripts in /etc/rc.d/rc, which start services in order (K scripts first, then S scripts) based on the runlevel directories /etc/rc.d/rc[0-6].d.

Executing additional tasks such as UPS scripts, virtual terminal startup, and launching X at runlevel 5.

The /etc/inittab file defines actions with the format id:runlevels:action:process. Common actions are:

wait – run once when entering the runlevel

respawn – restart the process if it exits

initdefault – set the default runlevel

sysinit – run the system initialization script

Service control is managed with the chkconfig command, which can list, add, delete, or modify the enable state of scripts in /etc/init.d for specific runlevels.

Runlevel changes can be performed with the init command (e.g., init 3) and inspected with who -r.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxBoot ProcessSystem AdministrationinitGRUB
MaGe Linux Operations
Written by

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.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.