Understanding Linux Boot Process: From BIOS to systemd
This guide walks through Linux's startup sequence, covering the BIOS/UEFI hardware check, GRUB2 bootloader configuration, kernel loading, initramfs handling, systemd target units, service initialization, and a concrete CentOS 8 example with command snippets and configuration files.
System Directory Structure
The /boot directory stores bootloader files, the kernel image ( vmlinuz-*.x86_64) and the initramfs image ( initramfs-*.img) that provides early drivers.
[root@web01 boot]# ls
config-4.18.0-305.3.1.el8.x86_64 initramfs-4.18.0-305.3.1.el8.x86_64kdump.img
efi loader
grub2 System.map-4.18.0-305.3.1.el8.x86_64
initramfs-0-rescue-4396f3518626409aa9770c4df8d21cb2.img vmlinuz-0-rescue-4396f3518626409aa9770c4df8d21cb2
initramfs-4.18.0-305.3.1.el8.x86_64.img vmlinuz-4.18.0-305.3.1.el8.x86_64 initramfs-4.18.0-305.3.1.el8.x86_64.img: early‑stage driver image. vmlinuz-4.18.0-305.3.1.el8.x86_64: the Linux kernel binary.
Kernel Version and CPU Information
Use uname -r to display the running kernel version and cat /proc/cpuinfo to list CPU flags and capabilities.
# uname -r
4.18.0-305.3.1.el8.x86_64
# cat /proc/cpuinfo
flags : fpu vme de pse tsc msr pae mce cx8 apic ... (many flags omitted for brevity)Network Configuration and Kernel Parameters
Check and modify networking sysctl settings such as IP forwarding and ICMP echo ignore.
# cat /proc/sys/net/ipv4/ip_forward
1 # 1 = enabled, 0 = disabled
# cat /proc/sys/net/ipv4/icmp_echo_ignore_all
1 # 1 = ignore ping requests
# cat /etc/sysctl.conf
vm.dirty_expire_centisecs = 4500
net.ipv4.ip_forward = 0
net.ipv4.icmp_echo_ignore_all = 1
# sysctl -p # apply changes immediatelyLinux Boot Sequence
1. BIOS / UEFI Stage
Hardware detection : Power‑on self‑test (POST) validates hardware.
Select boot device : Firmware chooses the device (disk, USB, network) to load the next stage.
2. GRUB2 Bootloader
Load /boot partition and read configuration.
Example commands used by GRUB:
set root='hd0,msdos1' search --no-floppy --fs-uuid --set=root ...Load kernel : GRUB loads the kernel image and passes control to it.
3. Kernel Loading and Initialization
Kernel start : Initializes hardware, memory, and core drivers.
Mounts the initial RAM filesystem ( initramfs) which provides early drivers and tools.
Mounts the real root filesystem according to /etc/fstab.
4. systemd Startup
systemdbecomes the first userspace process (PID 1) after the kernel hands over control.
It mounts all declared filesystems, determines the default target unit (e.g., graphical.target or multi-user.target), and starts dependent services.
5. Target Units
multi-user.target: Non‑graphical multi‑user mode (runlevel 3). graphical.target: Graphical mode, depends on multi-user.target. basic.target: Minimal environment, started before most other targets. reboot.target and halt.target: Used for rebooting or shutting down.
6. Service Startup
systemd launches services according to unit dependencies. Common services include: dbus.service – D‑Bus message bus. sshd.service – SSH daemon for remote login. firewalld.service – Firewall management. NetworkManager.service – Network configuration. gnome-shell.service or lightdm.service – Graphical login managers.
7. User Login
Login manager : If a graphical target is active, GDM, LightDM, etc., present a login screen.
User session : After authentication, the user's desktop session starts and applications launch.
8. System Ready
When all target units and services have started without errors, the system reaches a stable operational state and is ready for user interaction.
CentOS 8 Boot Process Example
GRUB Configuration File
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto resume=/dev/mapper/cl-swap rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=trueRegenerate the GRUB configuration with grub2-mkconfig -o /boot/grub2/grub.cfg and install the bootloader to the disk using grub2-install /dev/sda.
Loading Kernel and Modules
# lsmod # list currently loaded kernel modules
# modinfo kvm # display detailed information about the kvm moduleSigned-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.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
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.
