If you’ve forgotten the root password or a sudo user’s password on your Ubuntu 26.04 system, don’t worry. Performing a root password reset on Ubuntu 26.04 is straightforward using the GRUB bootloader’s recovery mode. This guide walks you through the entire process step by step, so you can regain full administrative access to your system.
Software Requirements and Linux Command Line Conventions
Category
Requirements, Conventions or Software Version Used
System
Ubuntu 26.04 Resolute Raccoon
Software
GRUB bootloader (default), passwd command
Other
Physical or console access to the machine.
Conventions
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command $ – requires given linux commands to be executed as a regular non-privileged user
To perform a root password reset on Ubuntu 26.04, reboot into GRUB recovery mode, drop to a root shell, remount the filesystem as read-write, and use passwd to set a new password.
Quick Steps to Reset Root Password on Ubuntu 26.04
Step
Command/Action
1. Access GRUB menu
Hold Shift (BIOS) or press Esc (UEFI) during boot
2. Edit boot entry
Press e, change ro quiet splash to rw init=/bin/bash
3. Reset the password
passwd username or passwd root
4. Reboot
exec /sbin/init or reboot -f
Understanding the Root Password on Ubuntu 26.04
By default, Ubuntu 26.04 does not set a root password during installation. Instead, the first user account created is given administrative privileges through the sudo command. This means that if you forget your user password, you effectively lose all administrative access to the system.
Therefore, when we talk about a root password reset on Ubuntu 26.04, we typically mean resetting the password for your sudo-enabled user account. However, the same procedure also works if you have explicitly set a root password and need to reset it.
IMPORTANT
This procedure requires physical access (or console access for virtual machines) to the machine. It cannot be performed remotely over SSH. If you still have sudo access, you can simply change the root password directly using the passwd command without going through recovery mode.
Reset Password via GRUB Recovery Mode on Ubuntu 26.04
The most common method for a root password reset on Ubuntu 26.04 is through the GRUB bootloader. This approach works on both physical machines and virtual machines, and does not require any external media.
Access the GRUB boot menu: Reboot your Ubuntu 26.04 system. As the machine starts, hold the Shift key (for BIOS/legacy systems) or press the Esc key (for UEFI systems) to bring up the GRUB menu.
TIP
If Ubuntu is the only operating system installed, GRUB may be configured to skip the menu by default. Holding Shift immediately after the BIOS/UEFI screen forces the menu to appear.
Modify the kernel boot parameters: On the linux line, replace:
ro quiet splash
with:
rw init=/bin/bash
This tells the kernel to mount the root filesystem as read-write (rw) and to start a bash shell (init=/bin/bash) instead of the normal init system. Consequently, you will boot directly into a root shell without needing any password.
Boot with modified parameters: Press Ctrl+X or F10 to boot with the modified parameters. After a few moments, you will be dropped into a root shell prompt.
Verify the filesystem is writable: Although we specified rw in the boot parameters, it is good practice to confirm the root filesystem is mounted as read-write:
Reboot the system: Once the password has been changed, reboot the system:
exec /sbin/init
Alternatively, you can force a reboot:
reboot -f
After the system restarts, you should be able to log in with the newly set password.
Verifying the Password Reset on Ubuntu 26.04
After completing the root password reset on Ubuntu 26.04, verify that everything works correctly.
Test login: Log in to the system using the new password, either through the graphical login screen or a TTY console (Ctrl+Alt+F2).
Test sudo access: Confirm that sudo still works correctly for your user:
$ sudo whoami
The output should display root, confirming your user retains administrative privileges.
Check account status: Verify the account is not locked or expired:
$ sudo passwd -S linuxconfig
The second field should show P (password set), not L (locked) or NP (no password).
SECURITY RECOMMENDATION
After resetting your password, consider reviewing your system’s security. Anyone with physical access to a machine can use this same procedure to reset passwords. If this is a concern, you can set a GRUB password to protect the bootloader, or use full disk encryption (LUKS) which requires a passphrase at boot time before GRUB can access the kernel.
Conclusion
In this tutorial, we covered how to perform a root password reset on Ubuntu 26.04 using GRUB recovery mode. The process involves editing the kernel boot parameters to drop into a root shell, then using the passwd command to set a new password. This method requires physical or console access to the machine.
Can I reset a password on Ubuntu 26.04 remotely over SSH? No, the GRUB recovery method requires physical or console access to the machine. If you still have another account with sudo privileges on the system, you can reset any user’s password remotely using sudo passwd username. Otherwise, you will need direct access to the machine.
Does resetting the root password affect my files or installed software? No, a password reset only changes the authentication credentials for the specified account. All your files, applications, and system configurations remain untouched throughout the process.
What if the GRUB menu does not appear when I reboot? If holding Shift or pressing Esc does not bring up GRUB, try tapping the keys repeatedly during the early boot phase. On some UEFI systems, you may need to access the firmware settings and adjust the boot order or disable secure boot temporarily.
How can I prevent others from resetting my password using this method? Since anyone with physical access can use GRUB to reset passwords, you can protect your system by setting a GRUB bootloader password or by using full disk encryption with LUKS. Full disk encryption is the stronger option, as it requires a passphrase before the system can even boot.