Boot Process

Linux boot sequence from firmware through initramfs to systemd targets, including rescue and emergency modes.

Boot Sequence

The Linux boot process — know this sequence for RHCSA
1. Firmware     BIOS or UEFI initializes hardware, runs POST
2. Bootloader   GRUB2 loads from MBR (BIOS) or ESP (UEFI)
3. Kernel       vmlinuz loaded into memory, decompressed, hardware init
4. initramfs    Temporary root filesystem — loads storage drivers, finds real root
5. systemd      PID 1 — mounts filesystems, starts services per target
6. Target       multi-user.target (CLI) or graphical.target (GUI)

Systemd Targets

Targets replaced SysV runlevels. A target is a group of units that define a system state.

View current default target
systemctl get-default
Set default target to multi-user (CLI, no GUI)
sudo systemctl set-default multi-user.target
Set default target to graphical (GUI)
sudo systemctl set-default graphical.target
Switch to a target immediately — without rebooting
sudo systemctl isolate multi-user.target
Target equivalents to SysV runlevels
poweroff.target     runlevel 0    Halt/shutdown
rescue.target       runlevel 1    Single-user, root shell, minimal services
multi-user.target   runlevel 3    Full multi-user, network, CLI only
graphical.target    runlevel 5    Multi-user + display manager
reboot.target       runlevel 6    Reboot
emergency.target    (none)        Minimal — root on / read-only, no services
List all available targets
systemctl list-units --type=target

Rescue Mode

Rescue mode starts a minimal system with root shell. Filesystem is mounted read-write. Network and most services are off.

Boot into rescue mode from a running system
sudo systemctl isolate rescue.target
Boot into rescue mode from GRUB — at the kernel line, append
systemd.unit=rescue.target

Or the legacy equivalent: append 1 or single to the kernel command line.

Emergency Mode

Emergency mode is more minimal than rescue. Root filesystem is mounted read-only. No services, no network. Use when rescue mode won’t boot.

Boot into emergency mode from GRUB — append to kernel line
systemd.unit=emergency.target
Remount root read-write in emergency mode — required before making changes
mount -o remount,rw /
After fixing the issue, reboot
systemctl reboot

Reset Root Password — RHCSA Critical Skill

This is tested on the RHCSA exam. Memorize this procedure.

Step 2: Find the linux line and append rd.break at the end
linux ($root)/vmlinuz-... root=/dev/mapper/rhel-root ... rd.break
Step 4: Remount sysroot read-write and chroot
mount -o remount,rw /sysroot
chroot /sysroot
Step 5: Change the password
passwd root
Step 6: Relabel SELinux on next boot — mandatory on RHEL or login fails
touch /.autorelabel
Step 7: Exit and reboot
exit
exit

The /.autorelabel file tells SELinux to relabel the entire filesystem on next boot. Without it, the new password file has the wrong SELinux context and authentication fails.

Kernel Parameters

View current kernel command line
cat /proc/cmdline
Common kernel parameters
quiet               Suppress most boot messages
rhgb                Red Hat graphical boot
rd.break            Break into initramfs shell (password reset)
init=/bin/bash      Skip systemd entirely, drop to bash (emergency)
selinux=0           Disable SELinux (diagnostic only, never in production)
systemd.unit=X      Boot into target X
single / 1          Rescue/single-user mode
crashkernel=auto    Reserve memory for kdump

initramfs

The initial RAM filesystem contains drivers and scripts needed to mount the real root. If you add a new storage driver (e.g., for iSCSI or new RAID), you need to rebuild it.

Rebuild initramfs on RHEL/CentOS/Fedora — dracut
sudo dracut --force
Rebuild for a specific kernel version
sudo dracut --force /boot/initramfs-$(uname -r).img $(uname -r)
Rebuild initramfs on Arch — mkinitcpio
sudo mkinitcpio -P
List contents of initramfs — see what’s inside
lsinitrd /boot/initramfs-$(uname -r).img | head -40

Boot Diagnostics

Boot time breakdown — firmware, loader, kernel, userspace
systemd-analyze
Output
Startup finished in 3.456s (firmware) + 1.234s (loader) + 2.345s (kernel) + 5.678s (userspace) = 12.713s
graphical.target reached after 5.432s in userspace
Slowest units during boot
systemd-analyze blame | head -15
Critical chain — the sequence that determined total boot time
systemd-analyze critical-chain
Check for failed units after boot
systemctl --failed
Kernel ring buffer — early boot hardware messages
dmesg | head -50
Kernel messages via journal (persists across reboots if journal is persistent)
journalctl -k -b

See Also

  • GRUB — bootloader that initiates the boot chain

  • systemd — target units that define boot goals