Restore Ubuntu root password

Restore Ubuntu root password

Step 1. Load in recovery mode


Turn on your computer. Go to the menu Grub. It usually appears automatically, and if not, hold down the Shift key until the boot menu appears.

If you use Oracle VirtualBox or VMWare, you must hold down the Shift key when the Oracle or VMWare logo appears.

Select from grub menu “Advanced Options for Ubuntu” :

 Advanced Options for Ubuntu

Advanced Options for Ubuntu

Here you will see the possibility to go to repair mode :

 recovery mode

recovery mode

Selecting it you will see a dark screen first and after a short loading you will find yourself in the recovery menu.

Step 2. Go to the superuser shell

Then you will be presented with various options of recovery mode. Here you need to choose “Root Drop to root shell prompt” . Just press the Enter key to select this option.

 Root Drop to root shell prompt
Root Drop to root shell prompt

After that, you will see a command line at the bottom.

Step 3: Rewind root with write permissions

You must have write access to the root partition. By default, it has read-only access. Use the command below to rebuild it with write access:

mount -rw -o remount /

Step 4: Reset username or password

You will be given root access here. Use the following command to get a list of all available users:

ls /home

From the previous command select the user (username) for whom you want to reset the password. Now use the following command to reset the password for the selected user (instead of username specify our user name):

passwd username

We will be asked for a new password and confirmation. Enter the new password twice:

Enter new UNIX password:
Retype new UNIX password:

Done! You just successfully reset your password. Now exit the root:

command line.


When you exit, you will return to the recovery mode menu. Select the normal download option – Resume.

May display a warning about graphic mode compatibility, but do not worry. A full reboot will solve the problem, if any.

After the reboot, you will be able to log in with a new password.

Alternative Ubuntu

password reset method

If for some reason you have trouble going to the root shell and changing your password, you can try the following steps:

Reboot the computer. Hold Shift to open the grub screen (if it does not work automatically). Press E in the grub prompt to edit the grub.


Find the line starting with linux, change ro to rw and add init=/bin/bash at the end of this line.


Press Ctrl-X to save the changes and load them. You are now booted into the Linux kernel with read and write permissions, and instead of a GUI you will use the bash shell. In other words, your system will load into the root password without a password.

Enter passwd command with your username. If you don’t know your username, check with ls/home (as in the first method).

Set a new password now. After you have set a new password, exit the terminal. Simply enter reboot in the terminal or use the shutdown command.

shutdown -r now

Done! Password changed.

Capable problems and their solution

Error “Authentication token manipulation error”

If you enter a new password, you may get a message about the Authentication token manipulation error:

passwd username
Enter new UNIX password:
Retype new UNIX password:
passwd: Authentication token manipulation error
passwd: password unchanged

The reason for this error is that the file system is mounted with read-only access. Change the access and rebuild the file system as follows:

mount -rw -o remount /

No “recovery mode”

If there is no recovery mode, you need to select the line with your system, press E and finish with the word single at the end of the kernel options. Then press B to boot the same terminal with superuser privileges.

Error “end Kernel panic”

You can see this output:

end Kernel panic – not syncing: Attempted to kill init! exit code=0x0007f00

Make sure you remove the splash boot option when editing the grub.

menu item.

Error “Failed to connect to bus”

If you try to reboot with the command reboot you can get:

Failed to connect to bus: No such file or directory
Failed to talk to init daemon.

To get rid of this error, reboot as follows:

# exec /sbin/init


0 0 vote
Article Rating
Notify of
Inline Feedbacks
View all comments

Do NOT follow this link or you will be banned from the site!
Would love your thoughts, please comment.x

Spelling error report

The following text will be sent to our editors: