On Red Hat I forgot my administrator password and would like to reset it. However, if I boot with GRUB `rd.break`, then I face the attached interfaced where <kbd>enter</kbd> leads to the usual user login prompt.
Apr 29, 1:34am
To reset the root password on a Red Hat system when you've forgotten it, you typically use the GRUB bootloader to enter emergency mode. However, the screenshot you shared shows that after using rd.break, you are dropped into an emergency shell, but the root filesystem is mounted as read-only. Here’s how you can proceed to reset the root password:
Step-by-Step Guide to Reset Root Password
1. Reboot the System
Restart your machine.
At the GRUB menu, select the entry for your Red Hat system and press e to edit the boot parameters.
2. Edit the Boot Parameters
Find the line starting with linux16 or linuxefi.
At the end of this line, add the following:
text
rd.break init=/bin/bash
This will break the boot process before the root filesystem is mounted and drop you into a shell with a writable /sysroot.
Press Ctrl+X or Ctrl+Enter to boot with these changes.
3. Remount /sysroot as Read-Write
In the shell, run:
bash
mount -o remount,rw /sysroot
4. Chroot into /sysroot
Run:
bash
chroot /sysroot
5. Reset the Root Password
Now, use the passwd command to reset the root password:
bash
passwd root
Enter the new password twice when prompted.
6. Relabel SELinux (if applicable)
If SELinux is enforced, run:
bash
touch /.autorelabel
7. Exit and Reboot
Exit the chroot and shell:
bash
exit
exit
The system will continue booting. Log in with the new root password.
Why Your Current Approach Fails
The screenshot shows you are in emergency mode, but the root filesystem is mounted as read-only. The rd.break method alone does not automatically remount /sysroot as read-write, which is why you cannot edit files directly.
The init=/bin/bash parameter ensures you get a shell with the ability to remount /sysroot as read-write.
Summary of Commands
Remount /sysroot
mount -o remount,rw /sysroot
Chroot
chroot /sysroot
Reset Password
passwd root
Relabel SELinux
touch /.autorelabel
Apr 29, 1:34am
This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. It cannot be edited because it contains private files.