I know to recover the root password with RHEL 7 and 8, and CentOS 7 and 8, but when I attempt to remount or chroot to /sysroot that does not seem to work on Rocky Linux 8.
Can someone provide the official instructions for recovering the root password for this brand?
I reset mine perfectly fine with this method:
- Reboot server, at grub screen press e to edit.
- Go to end of the linux line and add
- Do CTRL-X to boot.
mount -o remount,rw /sysroot
Now reboot, and you should be able to login with the new root password. The command in point 7 is required for selinux, else it won’t work. This will then relabel all files that would have had their selinux permissions reset after the commands we just ran. If selinux is disabled on your system this probably can be omitted, but recommend running it anway.
Thanks, I had tried these steps, so I am guessing that when I renamed one of the libraries (for a video I was going to make and share) I must have broken the OS.
Thanks @iwalker !
@iwalker , can I also recover my root password if I have the media in the “drive” considering this is a VM in reality?
Not sure to be honest. Maybe it’s possible to do it like that, by chrooting after booting from the media and following the remaining steps.
I tried that, but could not find /mnt/sysroot.