How To Recover Linux Grub Boot Loader Password on RHEL 9

Hello, friends. In this post, you will learn how to Recover Linux Grub Boot Loader Password on RHEL 9. We know that security is important, but accidents often happen, and it is possible to forget the root password of this item.

Note for this post, it is assumed that you don’t know the root password, and you want to reset it. In case you do know it and want to change it, just edit the file /etc/grub.d/40_custom and change the directives password or password_pbkdf2 and apply the changes.

On the other hand, although this post is intended for RHEL 9, it should also work on all derivatives like Alma Linux 9, Rocky Linux 9 and so on.

So let’s get started.

How To Recover Linux Grub Boot Loader Password on RHEL 9

To perform this step, you need to have the ISO image of RHEL 9 or the system installed.

Boot with the CD and when you see the main menu choose the Troubleshooting option and then Rescue System Mode.

When you do this, it will start a basic system mode. When finished, you will see this screen.

Rescue mode on RHEL 9
Rescue mode on RHEL 9

On that screen, you need to decide the first option. So type 1 and press ENTER.

Then the installer will report that a system has been mounted on /mnt/sysroot and you are suggested to run a command to get permissions on it.

Run it as soon as the shell starts

chroot /mnt/sysroot

And check the contents of the folder

Rescue Mode console
Rescue Mode console

Once inside it, you can edit the grub configuration file that you used to set the password, e.g.

vi etc/grub.d/40_custom

And inside the file the only thing you have to do is to remove the set superuser directives and all the contents of password_pbkdf2, so that it looks like this

Recover Linux Grub Boot Loader Password on RHEL 9
Recover Linux Grub Boot Loader Password on RHEL 9

Save the changes and close the editor. To apply them.

grub2-mkconfig -o tmp/grub-cfg
mv tmp/grub.cfg boot/grub2/

Exit the console


And finally, reboot the system


You are done!


I hope this trick will help you to remove the GRUB key that although it is a security method, forgetting it can be a headache

I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.


Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook