How to Reset Forgotten Root Password in Ubuntu 22.04
It happens to the best of us—you’re working on your Ubuntu system and suddenly realize you’ve forgotten the root password. Frustrating, right? Since the root account is crucial for performing essential administrative tasks, losing access can feel like a major roadblock.
But don’t worry! In this guide, we’ll walk you through the steps to reset a forgotten root password on Ubuntu 24.04, 22.04, and 20.04 LTS, so you can regain control of your system in no time.
Access the GRUB Menu
To access the GRUB menu on your Ubuntu system, start by powering it on or rebooting. As it boots up, press the Shift or ESC key to bring up the GRUB menu, which allows you to choose different boot options.
If you’re using VirtualBox, hold down the Shift key during startup to access the boot menu.

Edit the GRUB Menu
Once you’re in the GRUB menu, use the arrow keys to navigate to the Ubuntu entry. Then, press the ‘e’ key to edit the GRUB parameters.

Scroll down until you find the line that starts with ‘linux.’

The entire line will be highlighted for reference. Look for the section that contains “ro quiet splash $vt_handoff” and replace it with “rw init=/bin/bash” to set the root file system to read and write mode.
Once you’ve made the change, press Ctrl + X or F10 to reboot your system.

Remount the Root Filesystem
Your system will boot into a root shell screen, as shown below. To verify that the root filesystem has read and write access, run the following command. If the output includes “rw,” it confirms that the filesystem has both read and write permissions.
# mount | grep -w /

Reset the Root Password
With the root filesystem mounted in read-write mode, you can now reset the root password using the passwd
command. Simply enter a new password, confirm it, and you’ll receive a notification confirming that the password has been successfully updated.
# passwd

After resetting the root password, it’s a good idea to remount the root filesystem as read-only to improve system security.
# mount -o remount,ro /

Finally, restart your Ubuntu system to apply the changes and enable you to log in with the new root password.
# exec /sbin/init
OR
# reboot
After rebooting, you should be able to log in as the root user with the new password you set.