cancel
Showing results for 
Search instead for 
Did you mean: 
  • 718 Views

forgotten root password not working

Hi there! I am currently learning RHEL 9 and I've run into an issue. After attempting to reset root password using the below steps, I am now being prompted to create a new user every time I start or reboot the system. Unfortunately, I am unable to access the terminal to troubleshoot the problem. Is there anyone who can offer some guidance or assistance with this issue? Any help would be greatly appreciated!

 

    1. Boot with 'rd.break' argument

      • Press 'e' to start editing for Rescue kernel
      • Scroll down to the "linux" line. This line tells GRUB 2 to boot with rescue kernel.
      • Move to the end of the line. Add the string "rd.break" to the end after the space.
      • (Optional but recommended) If you want to see as you type-in, you have to also remove the "rhgb quiet" part of that line.
      • Once you have finished that change, press Ctrl-x to accept the edit, and to boot using that rescue kernel
    2. You would reach to screen shown below, just press Enter to get the shell

      Press Enter for maintenance
      (or press Control-D to continue):
    3. The file system is mounted read-only on /sysroot/. You will not be allowed to change the password if the file system is not writable. Remount the root filesystem in read-write mode:

      sh-5.1# mount -o remount,rw /sysroot
    4. The file system is remounted with write enabled. Change the file system’s root as follows:

      sh-5.1# chroot /sysroot
    5. Enter the passwd command and follow the instructions displayed on the command line to change the root password.

      sh-5.1# passwd
    6. Updating the password file results in a file with the incorrect SELinux security context. To relabel all files on next system boot, enter the following command:

      sh-5.1# touch /.autorelabel
    7. Exit the chroot environment:

      exit
    8. Exit the switch_root prompt:

      exit
4 Replies
Chetan_Tiwary_
Moderator
Moderator
  • 698 Views

@MonsterbabyHack were you not able to follow the steps you mentioned in the post ? What is the error that you are facing ? Do you have a screenshot of the error ? is this something happening in the course labs or in your own home/work  lab /system ? 

If you are following the steps , you should get a rescue shell at step 2.

We can help more if we know what is happening there for you.

0 Kudos
  • 672 Views

@Chetan_Tiwary_  "I was able to follow the steps mentioned in the post and completed them successfully. However, I am facing an issue after completing those steps. I am using VMware on my home lab system. I have included the link to the issue I am facing below. Could you please take a look at it? Thank you." Video of the issue 

Chetan_Tiwary_
Moderator
Moderator
  • 661 Views

@MonsterbabyHack in your video I am not able to see any root password resetting - all I can see is a boot process stuck here :

Chetan_Tiwary__0-1710836572203.png

seems like more of an OS config issue. Boot with the rescue kernel and see journal logs using journalctl -xb  to see any error logs. 

admpeln
Cadet
Cadet
  • 617 Views

Any luck adding enforcing=0 after rd.break ?
Don't forget to eneble SELinux when done.

Join the discussion
You must log in to join this conversation.