RHEL 7 Root Password Recovery

Latest response

Hi guys,

when I add add rd.break instead of init=/bin/sh to the line that starts with linux in Grub2, I get dropped in an emergency mode. Please see attached image. I am using a vm, hence " init=/bin/sh " doesn't give me keyboard.

Any way to fix this issue?




You did not mention what virtualization method, but can you boot the guest using boot.iso in resque mode (choose Troubleshooting -> Rescue a system)?


also see the comments in this Red Hat solution for some virtualization tips, namely the first comment by Red Hat's Matthew Casperson.

Thanks guys for the response. I figure out the problem. rd.break always drop to the emergency mode. It was not an issue on the OS, it was me not understanding the process. But I do now.



Adding rd.break to the end of the line with kernel parameters in Grub stops the start up process before the regular root filesystem is mounted (hence the necessity to chroot into sysroot). Emergency mode, on the other hand, does mount the regular root filesystem, but it only mounts it in a read-only mode. Note that you can even change to emergency mode using the systemctl command on a running system (systemctl emergency).

I updated the linked solution (Resetting the Root Password of RHEL-7 / systemd) to make the instructions easier to follow.

I've found recently that sometimes on a virtual system you have to add "console=tty0" at the end on a virtual system else the output goes to a non-available serial console.

RHEL 7 root Password Reset.

Step 1: Break the Consloe while Linux boot. Step 2: Press "e" to edit the kernel. Step 3: append the entry at the end of linux line as below rd.break console=tty1

Step 4: Press CTRL+X

Step 5: mount -o remount,rw /sysroot Step 6: change root password Step 7: touch ./autorelabel Step 8: Type exit two times

Thanks & Regards Namasivayam

1 - on grub menu, select the kernel to boot from and press "e". 2 - append the following to the end of the line that starts with "linux16" rd.break console=tty1 3 - use ctrl+x to bootup - mount -o remount,rw /sysroot 4 - chroot /sysroot 5 - passwd (enter new password). 6 - touch ./autorelabel 7 - ctrl+d twice to resume normal boot process.

If you use the syntax above (touch ./autorelabel (dot forward-slash)), the result is to create a file called autorelabel in the current directory. The result will NOT be a relabel function and a system you may not be able to log in to.

That should be "touch /.autorelabel" (forward-slash dot instead of dot forward-slash). Notice the position of the period in front of the autorelabel filename. The result is to create a file called .autorelabel in the root directory. The result will be a relabel function and a system you can log in to.

I have made that mistake!

// Bill //

following this and other directions to reset root in single user mode on RHEL7 gets me permission denied. even with / in rw

id post a screenshot but doesnt appear you can attach images here.

Here is the best documentation i found.


Same for RHEL7