Hi, i am trying to reset root password follwed this guide: https://docs.fedoraproject.org/en-US...root-password/ , on fedora VM (relase 41) for rescue mode the points mentioned in the guide are as follows:
i tried to do this points but its don’t work because after execute the VM reboot and i try to login with the root user, say to me password login incorrect. I specify that i follwed the guide step by step. Can someone help me figure out how to reset/recover the root password using the procedure from the bootloader menu? (I urgently need for the Red Hat RHCSA exam).
Hi @samueleaudace ,
There might be something wrong with the link you posted, but let me try to help you with these steps to reset the root password anyway
Append the following directive to the kernel line (at the end of the 'linux' line), then ctrl+x or f1
rd.break
Once in the emergency shell you'll need read and write access to modify the root password
mount -o remount,rw /sysroot
chroot /sysroot
Now change the password:
passwd
To ensure SELinux context is correctly applied to the new password, touch the autorelabel file:
touch /.autorelabel
Exit now
exit
exit
Let me know if you run into any issues
regards,
Does not work on 9.5 (using VirtualBox on a Mac) because the second (last) "exit". This just causes the prompt to display "logout" and then just sit there. Rebooting does not fully boot nor come up to a login prompt.
I'm thinking the exec /sbin/init instead of the second exit might be the solution. This was mentioned below by @Meher_Askri
Hmmm... I get an error, init: required arguement missing
EDIT:
So, going through the steps above works with the exception that you need to replace the last (second) exit command with exec /sbin/init
This will still give an error message about a missing arguement, but it will do the SELinux relabel and then reboot. You can then log in with the new password you set.
Grateful I had a snapshot saved
Regarding your method using 'rw init=/bin/bash,' I suspect the issue might be with the use of '/sbin/reboot -f.' This command forces a reboot without gracefully shutting down services or properly unmounting file systems. In contrast, using 'exit' allows the system to proceed with normal boot or shutdown processes, including reinitializing SELinux contexts if /.autorelabel was touched. Just my two cents.
did you try to nullify root password...after nully root password in /etc/passwd file in maintainace mode ...we should able to login servers without root password then you set root password.
There is no need to reboot the system forcefully, all your steps are correct just change the last one with exec /sbin/init instead to start the initialization process.
Hello,
Here is the Redhat Documentation for recovering root password:
https://www.redhat.com/en/blog/recover-root-passwd
Regards
Gopinath
I tried your instructions on RHEL 10 and got an extra step you need to add:
3a. remove any console or vcosnole key value pairs from the line.
After doind this i was able to reset the root password for the server without any issue. after relabeling i could login with my new password.
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.