Interrupt the boot process to gain access to a system

4. Operate Running Systems

πŸ“˜Red Hat Certified System Administrator (RHCSA – EX200)


This topic is about recovering access to a Linux system when you cannot log in normally, often because:

  • You forgot the root password.
  • There is a system problem that prevents normal login.

In Red Hat-based systems (RHEL, CentOS, Rocky Linux, AlmaLinux), this is done by interrupting the boot process and using single-user mode or emergency mode.


1. Understanding the Boot Process

Linux systems start with several stages:

  1. BIOS/UEFI – the firmware that starts the system hardware.
  2. Bootloader (GRUB2) – the program that lets you choose which kernel to boot.
  3. Kernel initialization – loads the Linux kernel and drivers.
  4. Systemd/init – starts services, users, and graphical interface.

To interrupt the boot process, we act at the GRUB2 stage, before the kernel fully starts.


2. Using GRUB2 to Interrupt Boot

Step 1: Access the GRUB2 menu

  • When the system starts, press any key during the boot countdown to open GRUB2.
  • If GRUB doesn’t appear automatically, press Esc or Shift (depends on BIOS/UEFI).

Step 2: Edit the boot entry

  1. Use the arrow keys to highlight the kernel you want to boot.
  2. Press e to edit the boot commands.
  3. Find the line starting with linux or linux16. It specifies the kernel and boot options.

Step 3: Modify the boot parameters

  • Go to the end of the line.
  • Replace rhgb quiet (if present) with rd.break.
    • rd.break stops booting just before the root filesystem is mounted.

This gives you a root shell in initramfs, a minimal environment.

Step 4: Boot into modified entry

  • Press Ctrl + x to boot.
  • You will now have root access to repair the system.

3. Gaining Root Access

Once in initramfs shell:

  1. Remount the root filesystem as read-write:
mount -o remount,rw /sysroot
  1. Switch to the real root environment:
chroot /sysroot
  1. Now you are effectively root on the system and can perform administrative tasks, such as:
  • Resetting passwords: passwd root
  • Fixing configuration files
  • Repairing broken boot settings
  1. Exit and reboot:
exit   # leave chroot
exit # leave initramfs shell

The system will continue booting normally.


4. Emergency Mode (Alternative Approach)

Sometimes you can use emergency mode:

  • At GRUB, add systemd.unit=emergency.target to the kernel line.
  • This boots into a minimal environment with root access, but network and normal services are off.
  • Useful for fixing files or recovering the system without full boot.

5. Important Notes for the Exam

  • You must know how to edit GRUB2 entries using the keyboard.
  • You must know rd.break and systemd.unit=emergency.target usage.
  • Understand remounting root and chroot to gain access.
  • You do not need to know the underlying BIOS/UEFI details, just GRUB and kernel boot parameters.
  • These skills are tested under time pressure, so practice in a VM.

6. Practical IT Examples

  • Forgot root password: Use rd.break to reset it.
  • Corrupted configuration: Boot into emergency mode to edit /etc/fstab or /etc/passwd.
  • Rescue a VM remotely: Modify GRUB in VM console to recover system without reinstalling.

βœ… Key Commands Summary

TaskCommand
Edit GRUB entrye at boot menu
Interrupt bootAdd rd.break
Boot into emergencyAdd systemd.unit=emergency.target
Remount root RWmount -o remount,rw /sysroot
Change root environmentchroot /sysroot
Reset root passwordpasswd root
Continue bootexit (twice)

This process is a critical RHCSA skill for system recovery and is often tested in time-limited scenarios. Students should practice in a virtual machine to become confident.

Buy Me a Coffee