Pages

RHEL Linux Boot Process

The boot process in Red Hat Enterprise Linux (RHEL) is the sequence of steps the system follows to initialize hardware, load the Linux kernel, start essential services, and finally present a login prompt to the user. Understanding this process is critical for system administrators—especially when troubleshooting boot failures or performing recovery tasks such as resetting the root password.

This article walks through the RHEL boot process, explains legacy runlevels vs. systemd, and demonstrates how to boot RHEL 7, 8, 9, and 10 into single-user (rescue) or emergency mode using GRUB.

RHEL Linux Boot Process Overview
Below is the high-level structural flow of a RHEL system boot:

Power On → BIOS/UEFI → GRUB2 → Kernel → init/systemd → Services → Login Prompt

Let’s break this down step by step.

1. BIOS / UEFI Stage
When the system powers on:
  • BIOS or UEFI performs POST (Power-On Self-Test)
  • Hardware components such as CPU, RAM, and storage are initialized
  • The firmware locates a bootable device
  • Control is passed to the bootloader (GRUB2)
2. Bootloader Stage (GRUB2)
GRUB2 is responsible for loading the Linux kernel and initial RAM disk.
Loaded from:
  • MBR (legacy BIOS systems), or
  • EFI System Partition (UEFI systems)
Displays the GRUB boot menu

Loads:
  • Kernel image: /boot/vmlinuz-*
  • Initial RAM disk: initramfs-*
Example GRUB2 Entry (RHEL 10)
/boot/loader/entries/
title Red Hat Enterprise Linux (6.12.0-55.9.1.el10_0.x86_64) 10.0 (Coughlan)
version 6.12.0-55.9.1.el10_0.x86_64
linux /vmlinuz-6.12.0-55.9.1.el10_0.x86_64
initrd /initramfs-6.12.0-55.9.1.el10_0.x86_64.img $tuned_initrd
options root=/dev/mapper/rootvg-root ro crashkernel=2G-64G:256M,64G-:512M \
resume=UUID=5daa754d-533e-48e1-9d29-36ae88246a53 \
rd.lvm.lv=rootvg/root rd.lvm.lv=rootvg/swap rhgb quiet

3. Kernel Initialization
Once loaded, the kernel:
  • Decompresses itself into memory
  • Initializes CPU scheduling, memory management, and hardware drivers
  • Mounts the initramfs
  • Detects root filesystem
  • Starts the first user-space process:
   /sbin/init   (PID 1)

In modern RHEL versions, this is systemd.

4. Init System: SysV vs systemd
Legacy SysV Init (RHEL 5 & 6)
  • /sbin/init reads /etc/inittab
  • Determines default runlevel
Example:
id:3:initdefault:

Runlevel Meaning
0        Shutdown
1        Single-user
3        Multi-user (text)
5        Graphical
6        Reboot

Startup scripts:
/etc/rc.d/rc3.d/
S10network
S20sshd
S80myapp

Shutdown scripts:
/etc/rc.d/rc0.d/
K10myapp
K20sshd
K90network

5. systemd and SysV Compatibility (RHEL 7–10)
Modern RHEL versions use systemd as the default init system.
Key concepts:
  • Targets replace runlevels
  • Services are managed via .service units
  • Backward compatibility provided by:
    systemd-sysv-generator

If a SysV script exists in /etc/init.d/, systemd automatically generates a corresponding service unit and preserves S## / K## ordering.

Runlevel systemd Target
1        rescue.target
3        multi-user.target
5        graphical.target
emergency emergency.target

6. Login Prompt
Once system initialization completes:
Runlevel 3 / multi-user.target
Text-based login (TTY)
Runlevel 5 / graphical.target
GUI login manager (GDM)
At this point, the system is fully operational.

Booting RHEL 7, 8, 9, and 10 into Single-User (Rescue) Mode Using GRUB

Single-user or rescue mode is commonly used for:
  • Root password recovery
  • Filesystem repairs
  • Boot troubleshooting
Step 1: Access the GRUB Menu
Reboot the system:
# reboot
When the GRUB menu appears:
Press e to edit the boot entry
If GRUB is hidden:
BIOS systems: Hold Shift
UEFI systems: Press Esc repeatedly

Step 2: Locate the Kernel Line
Example (RHEL 8/9/10):
linuxefi /vmlinuz-<kernel-version> root=/dev/mapper/rhel-root ro crashkernel=auto rhgb quiet

Step 3: Modify Kernel Parameters
RHEL 7
linux16 /vmlinuz-<version> root=/dev/mapper/rhel-root ro single
RHEL 8, 9, and 10
Append one of the following to the end of the linuxefi line:
Single-user (rescue) mode
systemd.unit=rescue.target
Emergency mode (minimal shell)
systemd.unit=emergency.target

Example:
linuxefi /vmlinuz-<version> root=/dev/mapper/rhel-root ro crashkernel=auto rhgb quiet systemd.unit=rescue.target

Step 4: Boot with Modified Parameters
Press:
Ctrl + X, or
F10
The system boots into rescue or emergency mode.

Step 5: Reset the Root Password
If the root filesystem is mounted read-only:
# mount -o remount,rw /
Reset the password:
# passwd root
If SELinux is enforcing:
# touch /.autorelabel
Reboot:
# reboot

Conclusion
Understanding the RHEL boot process—from firmware initialization to systemd targets—empowers administrators to diagnose issues quickly and recover systems safely. Mastering GRUB-based rescue techniques is an essential skill for any Linux professional working with RHEL 7 through RHEL 10.

No comments:

Post a Comment