So earlier today I decided that I would improve the security of my Ubuntu 22.04 device a bit by adding a password for the recovery mode(GNU Grub). I read a couple of blogs and I followed them step by step. After I was done I rebooted my system to test it out, only to find that I had been locked out of my device. I couldn't boot any option without it prompting me to enter a username and password. I did not know why this happened, but after a bit of research, I realised that I had forgotten to make an encrypted password and I had only did the last parts of the designated script, which was to make the system prompt you to enter the username and password every time you boot up recovery mode. I am now locked out of my device because of an unknown grub password. If you don't set a password for grub, is there a default password or something?
You will need to boot the system from your install media USB device. (At least not the target OS.)
Select trial Ubuntu.
From a command prompt: -
Identity the Ubuntu partition on your target disk
Then mount it (replace x & y with your Ubuntu details)
Then goto the grub boot directory
Edit the file as below using your preferred editor (I use vi).
Search for
password
and comment it out.Save file; sync the disk and unmount it. Then reboot.