How to Reset the Root Password in Red Hat Enterprise Linux (Two Proven Methods)
Resetting the root password is a core Linux skill. Whether you are studying for the RHCSA exam or recovering a production system, two reliable methods are available:
- The
rd.break
method - The
init=/bin/bash
method
Both approaches give you low-level access to the system before the login screen, and both allow you to safely reset the root password, including proper SELinux handling.
Why Learn Both?
There is no official mandate requiring one method over the other for the RHCSA exam. Red Hat expects you to solve problems using Linux tools. Each method has different behavior and use cases.
Knowing both methods helps you handle:
- Boot failures where systemd may not start
- Environments with different init setups
- Recovery under pressure during exams or emergencies
Method Comparison
Feature | rd.break | init=/bin/bash |
---|---|---|
Boot environment | Emergency shell | Minimal root shell |
PID 1 process | systemd | bash |
Reboot command works | Yes | No |
Filesystem | Read-only initially | Read-only initially |
SELinux relabel needed | Yes | Yes |
Safe reboot method | exit (twice) | exec /usr/lib/systemd/systemd |
Method 1: Reset Root Password Using rd.break
1. Reboot and access GRUB
When the GRUB menu appears, press e
.
2. Locate the kernel line
Find the line beginning with linux
or linuxefi
, usually ending in:
rhgb quiet
3. Append rd.break
to the end
rhgb quiet rd.break
4. Boot the system
Press Ctrl + x
to boot into an emergency shell.
5. Remount the root filesystem
mount -o remount,rw /sysroot
6. Enter the real root filesystem
chroot /sysroot
7. Reset the password
passwd
8. Prepare SELinux relabeling
touch /.autorelabel
9. Exit and reboot
exit
exit
You will reboot, SELinux will relabel, and the login screen will appear.
Method 2: Reset Root Password Using init=/bin/bash
1. Reboot and access GRUB
Press e
at the GRUB screen.
2. Locate the kernel line
Look for the line starting with linux
or linuxefi
.
3. Add init=/bin/bash
at the end
init=/bin/bash
Example:
linux /vmlinuz-... ro init=/bin/bash
4. Boot into the shell
Press Ctrl + x
.
5. Remount root as writable
mount -o remount,rw /
6. Change the root password
passwd
7. Prepare SELinux relabel
touch /.autorelabel
8. Replace bash with systemd
exec /usr/lib/systemd/systemd
This lets the system finish booting normally.
What Is PID 1 and Why Does It Matter?
Every process in Linux has a Process ID (PID). PID 1 is the first process started by the kernel. It manages system startup, services, and shutdown.
- Normally,
systemd
is PID 1 - When you boot using
init=/bin/bash
, bash becomes PID 1 - In this state,
reboot
andexit
will not work properly - Use this command to hand control back to systemd:
exec /usr/lib/systemd/systemd
Verifying the Password Reset
After reboot, test root access:
su -
If your prompt changes to root@hostname
, the reset worked.
RHCSA Practice Tips
- Use
rd.break
for daily practice - Try
init=/bin/bash
weekly to understand how boot and PID 1 work - Always remount the root filesystem and relabel with
touch /.autorelabel
- Time yourself as part of exam prep
Mastering both methods gives you confidence for the exam and control in the real world.