Chapter Objective: Describe the stages of the RHEL boot process, control the default systemd target, use rescue and emergency mode, and recover a system that fails to boot normally.

Key commands: systemctl get-default, systemctl set-default, grub2-mkconfig, rd.break

Stages of the Boot Process

StageWhat Happens
Firmware (UEFI/BIOS)Hardware initializes and locates a bootable device
GRUB2The bootloader presents a menu and loads the selected kernel and initramfs
Kernel + initramfsThe kernel starts; a temporary initial RAM filesystem loads drivers needed to mount the real root filesystem
systemd (PID 1)Takes over as the init system, bringing units up to reach the configured target
🔵 Why It Matters When a system won't boot, knowing which stage failed narrows the fix enormously — a GRUB problem, a kernel/initramfs problem, and a systemd unit failure are diagnosed and repaired in completely different ways.

GRUB2 Basics

# Main GRUB2 configuration is generated, not edited directly
sudo grub2-mkconfig -o /boot/grub2/grub.cfg

# On UEFI systems, the output path differs
sudo grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg

# Settings that control the generated config live here — edit THIS file
sudo vi /etc/default/grub
⚠️ Warning — Don't Hand-Edit grub.cfg grub.cfg is generated automatically from /etc/default/grub and the scripts in /etc/grub.d/. Edit the source files and regenerate with grub2-mkconfig instead — direct edits to grub.cfg get overwritten the next time it's regenerated.

Interrupting GRUB at Boot

Pressing a key (typically any key, or Esc/Shift depending on the system) during the brief GRUB menu window lets you edit boot parameters for a single boot without changing the permanent configuration — the basis for several recovery techniques in this chapter.

systemd Targets

Instead of traditional runlevels, RHEL boots to a systemd target — a group of units representing a system state.

TargetRoughly Equivalent To
multi-user.targetOld runlevel 3 — full multi-user, text mode, networking
graphical.targetOld runlevel 5 — multi-user plus a graphical desktop
rescue.targetOld single-user mode — minimal services, root shell
emergency.targetBare minimum — even less than rescue, no filesystems mounted beyond root
# Show the default boot target
systemctl get-default

# Change the default target permanently
sudo systemctl set-default multi-user.target

# Switch target immediately, without rebooting
sudo systemctl isolate multi-user.target

Rescue and Emergency Mode

Both modes are reached by editing the boot entry at the GRUB menu (press e to edit, add a parameter to the line starting with linux, then Ctrl+X to boot).

# Append to the kernel line to boot into rescue mode
systemd.unit=rescue.target

# Append to boot into emergency mode instead
systemd.unit=emergency.target
✅ Tip — Rescue vs. Emergency, in Practice Reach for rescue mode first — it mounts local filesystems and starts more of the system, useful for most repairs. Drop to emergency mode only when even rescue mode fails to come up, since it mounts almost nothing.

Resetting a Forgotten Root Password

# At the GRUB menu, press 'e' to edit, then append to the linux line:
rd.break

# Boot with Ctrl+X. The system drops to a shell BEFORE switching root.
# Remount the real root filesystem as read-write:
mount -o remount,rw /sysroot

# Enter a chroot into the real system
chroot /sysroot

# Change the root password as normal
passwd root

# On an SELinux system, flag a full relabel on next boot (important!)
touch /.autorelabel

# Exit the chroot and reboot
exit
reboot
⚠️ Warning — Don't Skip the Relabel Changing files while SELinux isn't fully active can leave them with an incorrect or missing security context, causing confusing denials afterward. touch /.autorelabel ensures SELinux relabels the filesystem cleanly on the next full boot.

Troubleshooting Common Boot Failures

SymptomLikely Area to Check
Drops to emergency mode automaticallyA bad /etc/fstab entry, or a filesystem that failed to mount
GRUB menu doesn't appear / boot loops before the OSBootloader configuration or disk/boot partition issue
Boots but a specific service is failingsystemctl --failed, then journalctl -u <service>
# Review what happened during the most recent boot
journalctl -b

# Check for any failed units after boot completes
systemctl --failed
🔵 Note — fstab Failures Are a Very Common Cause A typo'd device, a missing mount point, or a device that's no longer present are among the most frequent reasons a system unexpectedly drops to emergency mode. Check /etc/fstab early when this happens.

Key Terms for Chapter 12

GRUB2
The bootloader that presents a boot menu and loads the kernel and initramfs
initramfs
A temporary initial filesystem loaded by the kernel, containing drivers needed to mount the real root filesystem
target
A systemd unit grouping representing a system state, such as multi-user or graphical
rescue.target
A minimal boot target with local filesystems mounted, used for repairs
emergency.target
The most minimal boot target, with almost nothing mounted beyond root
rd.break
A boot parameter that drops to a shell in the initramfs, before switching to the real root filesystem
autorelabel
A flag (via /.autorelabel) that triggers a full SELinux context relabel on the next boot

Review Questions

  1. List the four major stages of the RHEL boot process, in order.
  2. Why should you edit /etc/default/grub instead of /boot/grub2/grub.cfg directly?
  3. What is the difference between rescue.target and emergency.target?
  4. What command permanently changes the default boot target to multi-user.target?
  5. In the root password reset procedure, why is touch /.autorelabel an important step on an SELinux-enabled system?
  6. A system unexpectedly drops into emergency mode at every boot. What file is a very common culprit to check first?
  7. What command shows journal entries specifically from the most recent boot?