Reset a Forgotten Ubuntu Root Password (18.04 & 20.04) in Minutes
This guide walks you through accessing the GRUB menu, editing boot parameters, gaining a root shell, and safely resetting the root password on Ubuntu 18.04 LTS or 20.04 LTS without needing the original credentials.
Many users set complex passwords that they later forget, locking themselves out of their Ubuntu system. The following steps show how to reset the root password on Ubuntu 18.04 LTS and Ubuntu 20.04 LTS.
Reboot the machine and interrupt the boot process to open the GRUB menu. On a VirtualBox VM, press SHIFT during startup.
In the GRUB menu, highlight the default entry and press e to edit the boot parameters.
Locate the line that begins with linux /boot/vmlinuz. It contains the fragment ro quiet splash $vt_handoff. Replace that fragment with rw init=/bin/bash so the line reads something like: linux /boot/vmlinuz‑... rw init=/bin/bash ... Press Ctrl+X or F10 to boot. The system will start directly into a root shell.
Confirm that the root filesystem is mounted read‑write: $ mount | grep -w / The output should contain rw.
Set a new root password: $ passwd Enter the new password twice. You should see the message password updated successfully.
Resume normal boot by executing: $ exec /sbin/init The system will continue booting into the regular login screen.
After completing these steps you should be able to log in with the new root password. Remember to keep your passwords secure but memorable to avoid repeat resets.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
