RED HAT ENTERPRISE LINUX
Interrupt the Boot
Process to Gain Access
Interrupt the boot process in order to gain access to a system
CIS126RH | RHEL System Administration 1
Mesa Community College
Every administrator eventually faces a system they cannot log into — a forgotten root password, a misconfigured service that blocks login, or a filesystem error that prevents the OS from completing its boot sequence. This module covers the techniques for interrupting the RHEL boot process to gain an administrative shell without normal credentials, with the root password reset procedure as the primary use case. This skill is tested directly on the RHCSA exam.
Learning Objectives
- Explain when and why boot interruption is used — Identify scenarios where normal login is not possible and boot-level access is the appropriate recovery technique
-
Interrupt the boot at the GRUB2 menu —
Pause the boot countdown, access the kernel parameter editor, and
add the
rd.breakparameter -
Navigate the initramfs recovery environment —
Remount the root filesystem read-write, use
chrootto enter the real OS installation, and perform repairs - Complete the root password reset procedure — Reset the password, correct the SELinux file context, and return the system to normal operation
When Boot Interruption is Needed
Boot interruption is the appropriate recovery technique when the system cannot be accessed through normal login channels.
| Scenario | Why normal login fails | Recovery technique |
|---|---|---|
| Root password forgotten or unknown | Cannot authenticate to the root account | rd.break — reset password in initramfs |
| Service prevents normal boot completion | System hangs before presenting a login prompt | Boot to rescue.target or emergency.target |
Corrupted /etc/fstab or failed mount |
Boot fails at filesystem mounting stage | Boot to emergency.target, fix fstab |
Misconfigured PAM or /etc/sudoers |
Authentication modules fail for all users | rd.break or rescue.target |
| SSH keys lost and no password set | Remote access impossible, console requires password | rd.break — set a password then log in |
The exam typically presents a system with an unknown root password and asks
the student to regain access. The rd.break method is the
standard tested solution.
The Boot Sequence and Where to Interrupt
The boot process has multiple stages. Different recovery techniques interrupt the boot at different points.
- BIOS/UEFI — firmware initialises hardware
- GRUB2 menu — press a key here to pause and edit ← first interrupt point
- Kernel loads — the kernel decompresses and starts
- initramfs — minimal filesystem; mounts the real root
rd.break stops here and gives a shell ← second interrupt point - systemd (PID 1) — real OS init process starts
- Target activation — services start in dependency order
rescue/emergency targets activate here ← third interrupt point - Login prompt — normal operation
Interrupting earlier in the boot gives more access but requires more manual steps
to reach a usable environment. rd.break is the earliest interrupt
and requires remounting and chrooting before anything can be changed.
Step 1: Reach the GRUB2 Menu
The GRUB2 menu appears briefly during every boot. You must pause it before the countdown expires to access the kernel editor.
- Reboot or power on the system
- Watch for the GRUB2 menu — it may appear for only 5 seconds
- Press any key immediately to pause the countdown
- On UEFI systems, hold Shift during power-on to force the menu
- The menu lists available kernels — the top entry is the default
Red Hat Enterprise Linux (5.14.0-362.el9.x86_64) 9.4 (Plow)
Red Hat Enterprise Linux (5.14.0-284.el9.x86_64) 9.3 (Plow)
Red Hat Enterprise Linux (0-rescue-...) 9.4 (Plow)
Use the ↑ and ↓ keys to change the selection.
Press 'e' to edit the selected item, or 'c' for a command prompt.
The GRUB2 countdown can be as short as 1–5 seconds. In the exam VM environment, start pressing keys as soon as the VM console comes up. If you miss it, the system boots normally — reboot and try again.
Step 2: Edit the Kernel Command Line
With the GRUB2 menu paused, press e to open the boot parameter editor for the selected kernel entry.
- The editor shows the full boot configuration for the selected kernel
- Use the arrow keys to navigate — find the line beginning with
linux - This line contains the kernel image path and all kernel boot parameters
- Navigate to the end of this line (use the End key or Ctrl+E)
- The line may be wrapped across multiple display lines — it is one logical line
# The linux line looks something like this (truncated for display)
linux ($root)/vmlinuz-5.14.0-362.el9.x86_64 \
root=/dev/mapper/rhel-root ro crashkernel=auto \
resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root \
rd.lvm.lv=rhel/swap rhgb quiet
# Find this line, go to the end, and add rd.break:
... rhgb quiet rd.break
Removing rhgb (Red Hat graphical boot) and quiet
from the kernel line shows detailed boot messages, which helps confirm that
the system has reached the rd.break shell and not stalled.
Step 3: Boot with rd.break
After appending rd.break to the kernel command line, press
Ctrl+X to boot with the modified parameters.
- The kernel loads and the initramfs initialises
- Device detection and basic filesystem setup runs normally
- Just before handing control to the real OS, the boot stops
- A shell prompt appears — no password is required
# After booting with rd.break, you see:
Generating "/run/initramfs/rdsosreport.txt"
[ OK ] Reached target Initrd Default Target.
Starting dracut emergency shell...
Warning: /dev/disk/by-uuid/... does not exist
Entering emergency mode. Exit the shell to continue.
Type "journalctl" to view system logs.
You might want to save "/run/initramfs/rdsosreport.txt" to USB.
switch_root:/# _
The switch_root:/# prompt confirms you are in the initramfs
environment running as root. The real RHEL installation is mounted read-only
at /sysroot.
Understanding the initramfs Environment
When rd.break stops the boot, you are inside the initramfs —
a minimal temporary filesystem, not the real RHEL installation.
What is available in the initramfs
- A root shell — no password required
- Basic utilities:
ls,cat,mount,chroot - The real RHEL root filesystem mounted at
/sysroot - The real filesystem is mounted read-only by default
What is NOT available
- Full RHEL tools (
vim,dnf,systemctl) - Network connectivity
- SELinux enforcement (not running in this environment)
# Confirm /sysroot contains the real OS
switch_root:/# ls /sysroot
bin boot dev etc home lib lib64 media mnt opt
proc root run sbin srv sys tmp usr var
Step 4: Remount /sysroot Read-Write
Before making any changes to the installed system, the root filesystem at
/sysroot must be remounted with write permission.
# Confirm /sysroot is currently mounted read-only
switch_root:/# mount | grep sysroot
/dev/mapper/rhel-root on /sysroot type xfs (ro,relatime,...)
# ^^ read-only
# Remount /sysroot read-write
switch_root:/# mount -o remount,rw /sysroot
# Confirm the remount succeeded
switch_root:/# mount | grep sysroot
/dev/mapper/rhel-root on /sysroot type xfs (rw,relatime,...)
# ^^ now read-write
If you run chroot /sysroot before remounting, any attempt to write
files (including passwd) will fail with "Read-only file system".
Always remount first, then chroot.
Step 5: chroot into /sysroot
chroot — change root — makes /sysroot the apparent
root directory for all subsequent commands. After chrooting, you are effectively
running commands inside the real RHEL installation.
# chroot into the real OS installation
switch_root:/# chroot /sysroot
# The prompt changes — you are now inside the RHEL installation
sh-5.1# _
# Commands now operate on the real filesystem
sh-5.1# cat /etc/redhat-release
Red Hat Enterprise Linux release 9.4 (Plow)
# The /etc/shadow file is now writable (via the real filesystem)
sh-5.1# ls -l /etc/shadow
----------. 1 root root 1234 May 25 07:00 /etc/shadow
Before chroot, /etc is the initramfs's /etc.
After chroot, /etc is the real OS's /etc at what was
/sysroot/etc. All commands run with the real RHEL binaries.
Step 6: Reset the Root Password
With the chroot active, the standard passwd command modifies the
real /etc/shadow file on the installed system.
# Inside the chroot — reset the root password
sh-5.1# passwd root
Changing password for user root.
New password:
(type the new password — no characters appear)
Retype new password:
(retype the new password)
passwd: all authentication tokens updated successfully.
# Confirm the shadow file was modified (timestamp changed)
sh-5.1# ls -l /etc/shadow
----------. 1 root root 1278 May 25 10:15 /etc/shadow
# ^^^^ size changed — new hash written
On the RHCSA exam, you may be asked to set the root password to a specific value.
Read the task carefully before running passwd. On a real recovery,
choose a strong password and document it in your password manager immediately.
Step 7: Fix the SELinux Context
The passwd command ran inside the initramfs chroot where SELinux
policy is not enforced. The resulting /etc/shadow entry has the
wrong SELinux security context — this must be corrected before rebooting.
Option A — Full filesystem relabel (simpler)
sh-5.1# touch /.autorelabel
# This file triggers a full relabel of all filesystems on next boot
# The relabel boot takes a few minutes — do not interrupt it
Option B — Targeted relabel (faster)
sh-5.1# restorecon -v /etc/shadow
Relabeled /etc/shadow from system_u:object_r:unlabeled_t:s0
to system_u:object_r:shadow_t:s0
# Only /etc/shadow is relabeled — no extra boot time needed
If you skip the SELinux context fix, the password reset appears to succeed, but
the new password will not work at login. SELinux enforces correct file contexts
on /etc/shadow and blocks access if they are wrong.
Step 8: Exit and Resume Boot
Two exits are required: one to leave the chroot environment, and one to leave the initramfs shell and allow the boot to continue.
# Exit the chroot — returns to the initramfs shell
sh-5.1# exit
switch_root:/# _ # back in the initramfs
# Exit the initramfs shell — boot resumes
switch_root:/# exit
# OR send Ctrl+D to signal end of input
# The system continues the boot sequence
The initramfs hands control back to the real OS init process (systemd). If you used
touch /.autorelabel, the boot pauses to relabel all filesystems before
completing — this takes several minutes and is normal. If you used
restorecon, the boot continues to the login prompt without the extra
relabelling pause.
The Autorelabel Boot
When /.autorelabel exists, the first boot after the rd.break
recovery performs a full SELinux filesystem relabelling before completing.
- The system detects
/.autorelabelearly in the boot - SELinux relabels every file on every mounted filesystem
- Progress appears on the console — do not interrupt or power off
- The
/.autorelabelfile is deleted when relabelling completes - The system reboots automatically a second time to complete the process
- After the second reboot, the system reaches the normal login prompt
On a system with many files, the relabelling scan takes 2–5 minutes or longer. The console shows progress. This is normal — do not interrupt the power. Interrupting will leave the filesystem partially relabelled and may cause SELinux to deny access to many system files.
Complete Procedure at a Glance
The eight steps from reboot to recovered system.
- Reboot and press a key to pause the GRUB2 countdown
- Press e on the default kernel entry
- Find the
linuxline; navigate to its end; appendrd.break - Press Ctrl+X to boot — wait for the
switch_root:/#prompt mount -o remount,rw /sysrootchroot /sysrootpasswd root(enter new password twice)- Fix SELinux:
touch /.autorelabelorrestorecon /etc/shadow exit(leave chroot) thenexitagain (leave initramfs)- Wait for the system to boot to the login prompt and log in with the new password
On the RHCSA exam, you will not have notes. Practice writing out these steps from memory until you can reproduce them without hesitation. Then practice the full procedure in your lab environment at least three times.
Common Mistakes
| Mistake | Symptom | Fix |
|---|---|---|
| Missing the GRUB2 countdown | System boots normally | Reboot and start pressing keys immediately when the console appears |
| Appending rd.break to the wrong line | System boots normally or with a kernel error | Append to the linux line only — not initrd or set |
| Chrooting before remounting read-write | passwd fails: "Read-only file system" |
mount -o remount,rw /sysroot before chroot /sysroot |
| Skipping the SELinux fix step | Password reset appears to succeed; login still denied | Run touch /.autorelabel or restorecon /etc/shadow before exiting |
| Only one exit after the password reset | Back at a prompt — system does not resume booting | Two exits needed: first exits chroot, second exits initramfs shell |
| Interrupting the autorelabel boot | SELinux contexts partially relabelled — files may be inaccessible | Wait patiently — the relabelling and second reboot take several minutes |
Knowledge Check
Answer these before moving to the next slide.
- What parameter do you append to the GRUB2
linuxkernel line to interrupt the boot and gain an initramfs shell? - After reaching the
switch_root:/#prompt, what are the first two commands you run, and why must they be in that order? - You run
passwd rootinside the chroot and get "Read-only file system". What went wrong and how do you fix it? - Why must you run either
touch /.autorelabelorrestorecon /etc/shadowbefore exiting the chroot? - After running
touch /.autorelabeland both exit commands, the system reboots but takes several minutes and reboots a second time. What is happening and should you interrupt it? - How many exit commands are needed to resume normal boot from the rd.break environment, and what does each one do?
Knowledge Check — Answers
- Append
rd.breakto the end of the line beginning withlinuxin the GRUB2 editor. - First:
mount -o remount,rw /sysrootto make the real OS filesystem writable. Second:chroot /sysrootto make /sysroot the working root so subsequent commands affect the real installation. The remount must come first — if you chroot into a read-only filesystem,passwdwill fail with a read-only error. - The remount step was skipped or failed —
/sysrootis still mounted read-only. Exit the chroot withexit, runmount -o remount,rw /sysroot, thenchroot /sysrootagain, and re-runpasswd. - The
passwdcommand ran outside SELinux enforcement. The new /etc/shadow entry has the wrong SELinux file context. When the system boots normally with SELinux enforcing, it denies access to a file with the wrong context — login fails even though the password was changed. The autorelabel or restorecon step corrects the context before SELinux runs. - SELinux is performing a full filesystem relabelling, triggered by
/.autorelabel. This is expected and correct — do not interrupt it. After relabelling completes, the system automatically reboots a second time and then presents the normal login prompt. - Two exits are required. The first
exitleaves thechroot /sysrootenvironment, returning to the initramfs shell atswitch_root:/#. The secondexitleaves the initramfs shell, allowing the kernel to resume the boot process.
Key Takeaways
-
rd.break interrupts the boot in the initramfs — no password required.
Append
rd.breakto thelinuxline in the GRUB2 editor. Press Ctrl+X to boot. The change is one-time — not saved. -
The procedure is: remount, chroot, passwd, fix SELinux, exit, exit.
mount -o remount,rw /sysrootthenchroot /sysrootthenpasswd rootthentouch /.autorelabelorrestorecon /etc/shadowthen two exits. -
The SELinux fix is mandatory — it is the most commonly missed step.
Without it the password is changed but SELinux blocks login because /etc/shadow
has the wrong context. Use
touch /.autorelabel(full relabel, slower) orrestorecon /etc/shadow(targeted, faster). -
Two exits are required, and the autorelabel boot must not be interrupted.
The first exit leaves the chroot. The second exit resumes the boot.
If
/.autorelabelwas used, the relabelling boot takes several minutes and is followed by an automatic second reboot — both are normal.
Graded Lab
- Reboot your lab virtual machine and successfully pause the GRUB2 menu. Practice pressing the key at the right moment until you can reach the menu reliably on the first try.
- From the GRUB2 menu, press e and locate the
linuxline. Appendrd.breakto the end of the line and boot. Confirm you reach theswitch_root:/#prompt. - At the initramfs prompt: run
mount | grep sysrootto confirm read-only, then remount read-write. Verify withmount | grep sysrootagain. - Chroot into
/sysroot. Verify by runningcat /etc/redhat-releaseto confirm you are in the real OS. - Reset the root password to
redhatusingpasswd root. Runrestorecon -v /etc/shadowto fix the SELinux context. Then exit twice to resume boot. - After the system boots, log in as root with the new password to confirm the
procedure succeeded. Run
idto verify root access.
"Interrupt the boot process in order to gain access to a system." Repeat this lab until you can complete the full procedure — GRUB2 interruption to confirmed root login — in under 5 minutes without consulting notes.
Next: Identify CPU/memory intensive processes and kill processes