Privileged access to your Linux system as root or via the sudo command.
# - 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
Ubuntu 20.04 reset root password step by step instructions
The first step is to reboot into the GRUB menu. If Ubuntu 20.04 is the only operating system installed you need to keep pressing SHIFT for the GRUB menu to show up. Next, while your Ubuntu boot menu is highlighted press e to edit the Grub's boot prompt.
SUBSCRIBE TO NEWSLETTER Subscribe to Linux Career NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.
Using your navigational arrows locate the line containing the following string ro quiet splash $vt_handoff
Replace the string ro quiet splash $vt_handoff with the following text rw init=/bin/bash. Once you have made the change press F10 to initiate the regular boot sequence.
After the successful boot you should be welcomed with a root's shell without a need to enter the root password
Confirm that the root (/) partition is mounted as rw. To do so execute the mount | grep -w / command.
At this point we are ready to reset the root password. To do so simply execute the passwd command and follow the instructions. In case you need to reset your user password, simply execute the passwd followed by your username.
All done. Your root password should be now recovered. All what remains is to reboot your Ubuntu 20.04 system. To do so execute the exec /sbin/init
Enter new UNIX password:
Retype new UNIX password:
passwd: Authentication token manipulation error
passwd: password unchanged
Your root partition is mounted read-only. Try:
# mount -o remount,rw /
to resolve this issue.
[ end Kernel panic - not syncing: Attempted to kill init! exit code=0x0007f00
Make sure that you removed the splash boot option when editing the grub's menu item.
When trying to reboot with the reboot command I get:
Failed to connect to bus: No such file or directory
Failed to talk to init daemon.