Website Vidya
DeploymentStep-by-Step Guide

How to Fix Broken Packages in Ubuntu: 7 Simple Ways

If you’ve been using Ubuntu for a while, chances are you’ve run into package-related issues at least once. A failed update, an interrupted installation, or conflicting dependencies can easily leave your system in a messy state. When that ha...

RR
Website Vidya TeamLead Systems Educator
Published:
8 min read
How to Fix Broken Packages in Ubuntu: 7 Simple Ways
AI Executive SummaryCORE CIS AI

8 min read

If you’ve been using Ubuntu for a while, chances are you’ve run into package-related issues at least once. A failed update, an interrupted installation, or conflicting dependencies can easily leave your system in a messy state. When that ha...

Key Highlights
  • Understanding Single-User Mode in Ubuntu
  • When Should You Use Single-User Mode?
  • Prerequisites
Grounded in full engineering runbookCORE CIS Ai Engine

Forgetting your Ubuntu user password can feel like hitting a wall—especially when the system refuses to let you log in and you have important work waiting inside. Fortunately, Ubuntu provides a safe and effective recovery mechanism that allows you to regain access without reinstalling the operating system or losing your data.

This guide explains how to reset forgotten Ubuntu user password using single-user mode, also known as recovery mode. We’ll walk through every step carefully, explain why each step works, and cover common mistakes and troubleshooting scenarios along the way.

Whether you’re a beginner who accidentally locked yourself out or an experienced Linux user managing multiple systems, this article will help you recover access confidently and securely.


Understanding Single-User Mode in Ubuntu

Before diving into the actual reset process, it’s important to understand what single-user mode is and why it works.

Single-user mode is a minimal operating state where Ubuntu boots without starting most services, network connections, or graphical interfaces. In this mode, the system grants root-level access directly from the bootloader, allowing administrative actions without needing a user password.

This is exactly why it’s useful for password recovery—but also why physical access to a machine is a security risk if disk encryption is not enabled.


When Should You Use Single-User Mode?

You should use single-user mode if:

  • You forgot your Ubuntu user password
  • You cannot log in via terminal or GUI
  • The system boots normally but rejects credentials
  • You don’t want to reinstall Ubuntu
  • You want to recover access without data loss

If your disk is encrypted and you don’t know the encryption passphrase, this method will not work, which is by design.


Prerequisites

Before proceeding, ensure the following:

  • Physical access to the Ubuntu machine
  • Ability to reboot the system
  • GRUB bootloader is accessible
  • Disk is not fully encrypted, or you know the encryption password

This method works on:

  • Ubuntu Desktop
  • Ubuntu Server
  • Most Ubuntu-based distributions

How to Reset Forgotten Ubuntu User Password (Single-User Mode)

Step 1: Reboot the Ubuntu System

The very first step in how to reset forgotten Ubuntu user password using single-user mode is to restart the system. This is necessary because recovery and single-user options are only accessible during the boot process, before Ubuntu loads the login screen.

If you are currently logged into Ubuntu and have terminal access, the safest way to reboot is by using the command line.

sudo reboot

However, in most real-world scenarios where users forget their password, logging in is not possible. In such cases, you can safely restart the machine using the physical power button:

  • Press and hold the power button for 5–10 seconds until the system turns off
  • Wait a few seconds
  • Press the power button again to turn the system back on

Modern Ubuntu systems are resilient, and a forced reboot at this stage is generally safe, especially since no password-protected session is active. The goal here is simply to get the system to restart so you can interrupt the normal boot process and access the GRUB bootloader, which is essential for entering single-user (recovery) mode.

Once the system starts rebooting, stay alert. The next step requires precise timing to access the GRUB menu. As soon as the manufacturer logo disappears or the screen briefly goes blank, you’ll need to press the appropriate key (Shift or Esc) to proceed to recovery options.


Step 2: Access the GRUB Menu

After restarting the system, the next crucial step in how to reset forgotten Ubuntu user password is accessing the GRUB boot menu. GRUB (Grand Unified Bootloader) is the program that loads Ubuntu before the operating system itself starts, and it’s where recovery and single-user options are located.

Timing is important here, because GRUB appears very briefly during startup.

As soon as your system powers on and begins booting, watch the screen carefully. You’ll usually see one of the following:

  • A black screen with a manufacturer logo
  • A brief flash before Ubuntu starts loading
  • No visible menu at all (on systems with fast boot enabled)

This is the moment when you need to interrupt the normal boot process.

Which Key Should You Press?

The key you press depends on how your system boots:

  • BIOS-based systems:
    Press and hold the Shift key immediately after the system powers on.
  • UEFI-based systems (most modern laptops and desktops):
    Press the Esc key repeatedly as soon as the system starts booting.

Holding or tapping the key forces GRUB to display its menu instead of automatically loading Ubuntu.

What the GRUB Menu Looks Like

If successful, you’ll see a text-based menu similar to:

Ubuntu
Advanced options for Ubuntu

This confirms that you are now inside the GRUB bootloader. From here, you can access recovery mode, which is required to reset the forgotten Ubuntu user password.

Step 3: Enter Ubuntu Recovery Mode

Once you have successfully accessed the GRUB boot menu, the next step in how to reset forgotten Ubuntu user password is to enter Ubuntu Recovery Mode. This mode is specifically designed for system maintenance, troubleshooting, and recovery tasks—making it ideal for resetting a forgotten password.

In the GRUB menu, you will typically see a simple list of boot options similar to:

Advanced options for Ubuntu

Use the arrow keys on your keyboard to move through the menu. The mouse does not work at this stage.

Highlight the option:

Advanced options for Ubuntu

Once it is selected, press Enter.

Now, a new submenu will appear. This screen lists multiple boot entries, usually one for each installed kernel version. Each kernel will have two options:

  • A normal boot entry
  • A recovery mode entry

The recovery entries will look something like:

Ubuntu, with Linux 6.x.x-generic (recovery mode)

Use the arrow keys to scroll through the list and select the option that ends with (recovery mode).

What Happens During Recovery Boot

After selecting recovery mode, Ubuntu will start booting, but unlike a normal startup:

  • The graphical interface is not loaded
  • Most background services are disabled
  • Network connections are not started
  • The system boots into a minimal, maintenance-focused environment

This stripped-down boot process ensures that the system is stable and not locked by running processes, which is essential when performing tasks like password recovery.

The Recovery Menu

After a few moments, you will see the Ubuntu Recovery Menu, a text-based menu with several options such as:

resume      Resume normal boot
clean Try to make free space
dpkg Repair broken packages
fsck Check file system
network Enable networking
root Drop to root shell prompt

This menu confirms that you have successfully entered Ubuntu’s recovery environment.

At this point, do not select “resume.” Instead, the next step will involve dropping into a root shell so you can reset the forgotten Ubuntu user password.

Step 4: Drop to Root Shell

After Ubuntu finishes loading Recovery Mode, you’ll be presented with a text-based screen called the Recovery Menu. This menu provides several maintenance and troubleshooting options, each designed to fix a specific type of system issue without fully booting into the operating system.

This step is where you gain administrative (root) access, which is required to reset a forgotten Ubuntu user password.

Using the arrow keys, move down and highlight:

Select:

root – Drop to root shell prompt

Once selected, press Enter.

At this point, you are logged in as the root user, but the filesystem is mounted in read-only mode.


Step 5: Remount Filesystem as Read-Write

After dropping into the root shell, the next and absolutely essential step in how to reset forgotten Ubuntu user password is making the root filesystem writable. By default, Ubuntu mounts the filesystem in read-only mode during recovery to prevent accidental or harmful changes. While this is a safety measure, it also means you cannot reset passwords yet.

To proceed, you must explicitly remount the filesystem with write permissions.

At the root shell prompt, run the following command exactly as shown:

mount -o remount,rw /

Let’s break this down:

  • mount – Manages filesystem mounting
  • -o – Specifies mount options
  • remount – Reapplies mount settings to an already mounted filesystem
  • rw – Enables read and write access
  • / – Refers to the root filesystem

If the command runs successfully, it will return no output, which is normal and indicates success.

To ensure the filesystem is now writable, create a temporary test file:

touch /testfile

If the command executes without displaying an error message, the filesystem is now mounted as read-write.

You can further verify by listing the file:

ls /

You should see testfile among the listed directories and files.

What If You See an Error?

If you encounter an error such as:

Read-only file system

or

Permission denied

This means the remount did not succeed. In that case:

  • Re-run the remount command carefully
  • Ensure you are in the root shell (root@hostname)
  • Check for typing errors

Do not proceed to reset the password until this step succeeds. Attempting to run passwd while the filesystem is read-only will result in authentication or token manipulation errors.

Clean Up the Test File (Optional)

Once confirmed, you may remove the test file:

rm /testfile

This step is optional but keeps the root directory clean.

Step 6: Identify the Username (If Forgotten)

Before you can reset a password, you must know which user account you’re working with. In many cases, users remember their password but forget the exact username, especially on systems with multiple accounts or servers managed by different people. This step helps you accurately identify the correct Ubuntu user account.

Ubuntu does not reset passwords by display name or email—it works strictly with system usernames. If you attempt to reset a password for a non-existent or incorrect user, the command will fail.

Listing All User Home Directories

Most regular Ubuntu users have a home directory inside /home. To list all user accounts with home folders, run:

ls /home

This command displays the names of directories inside /home, and each directory usually corresponds to a local user account.

Example output:

jack
admin
developer

In this example:

  • jack could be a personal user account
  • admin might be an administrative user
  • developer could belong to a project-specific user

Any of these usernames can have their password reset using the passwd command.

Choosing the Correct User

Select the username that matches:

  • Your login name at the Ubuntu login screen
  • The user that owns your files and documents
  • The account you normally use with sudo

If you’re unsure, you can inspect a directory:

ls /home/rajesh

Seeing familiar folders like Documents, Downloads, or project files can help confirm the correct user.

What If /home Is Empty or Missing the User?

In rare cases:

  • The user may be a system account without a home directory
  • The home directory may be located elsewhere

To list all users on the system, you can also run:

cat /etc/passwd | grep /home

This shows all users that have a home directory defined.

Important Tip

Be absolutely sure about the username before proceeding. Resetting the wrong account’s password won’t harm the system, but it won’t give you access to the files you need.

Once you’ve identified the correct username, you’re ready for the next step—resetting the password itself, which is the core action in how to reset forgotten Ubuntu user password using single-user mode.

Step 7: Reset Ubuntu User Password

This step is the core of the entire recovery process. Once you have identified the correct username and confirmed that the filesystem is mounted as read-write, you are now ready to reset the forgotten password. This is the moment where access to the Ubuntu system is restored.

Running the Password Reset Command

At the root shell prompt, run the following command:

passwd username

Replace username with the actual Ubuntu account name you identified in the previous step.

For example, if the username is rajesh, the command will be:

passwd rajesh

Press Enter to continue.

What Happens After You Run the Command

Once the command is executed, Ubuntu will prompt you to set a new password:

Enter new UNIX password:
Retype new UNIX password:

Important points to remember while entering the password:

  • No characters will appear on the screen as you type—this is normal
  • The cursor will not move, and nothing will be echoed back
  • Type carefully and slowly to avoid mistakes

After typing the password, press Enter, then retype the same password again to confirm.

Choosing a Strong Password

While resetting the password, it’s a good idea to choose a strong but memorable password:

  • Use a mix of uppercase and lowercase letters
  • Include numbers or symbols if possible
  • Avoid using your username, name, or common words
  • Make it long enough to resist guessing

Ubuntu may display a warning if the password is weak, but it will still allow you to proceed.

Successful Password Reset

If everything is done correctly, you will see the following message:

password updated successfully

This confirms that the password has been changed and written to the system’s authentication files.

At this point, you have successfully completed the most critical step in how to reset forgotten Ubuntu user password using single-user mode.

Common Errors and How to Fix Them

If you see an error such as:

passwd: Authentication token manipulation error

This usually means the filesystem is still mounted as read-only. To fix this:

mount -o remount,rw /

Then rerun the passwd command.

If you see:

passwd: user 'username' does not exist

Double-check the username spelling and list users again using:

ls /home

After successfully resetting the regular user password, you may optionally take a moment to review the root account’s security. While this step is not mandatory for regaining access, it is strongly recommended in certain situations—especially if the system is shared, exposed to multiple administrators, or used in a server environment.

Understanding the Root Account in Ubuntu

By default, Ubuntu handles administrative access differently from many other Linux distributions:

  • The root account exists, but it is usually locked
  • Administrative tasks are performed using sudo
  • Regular users with sudo privileges authenticate using their own password

However, when you boot into recovery mode, Ubuntu grants direct root access automatically. This makes it a good opportunity to ensure the root account is either securely protected or explicitly locked, depending on your security preference.

Resetting the Root Password

To set or reset the root password, run the following command:

passwd root

Press Enter.

You will be prompted to enter and confirm a new password:

Enter new UNIX password:
Retype new UNIX password:

As with user password entry:

  • No characters will be displayed while typing
  • Type carefully and confirm the password accurately

If the operation is successful, you’ll see:

password updated successfully

This means the root account now has a valid password set.

Step 9: Exit and Reboot the System

Once you’ve finished resetting the user (and optionally the root) password, the final step is to safely exit the recovery environment and reboot Ubuntu normally. This ensures that all changes are properly applied and that the system starts in its standard operating mode.

Exiting the Root Shell

You are currently working inside a root shell that was launched from recovery mode. Before rebooting, you should cleanly exit this shell session.

At the root prompt, type:

exit

Then press Enter.

This command ends the root shell session and returns you to the Recovery Menu. Exiting properly helps ensure that all system operations are closed gracefully.

Rebooting the System

After exiting the root shell, reboot the system to allow Ubuntu to start normally with the updated password.

You can reboot by running:

reboot

If the reboot command is not available at that point, you can alternatively select the resume option from the recovery menu, which will continue the normal boot process.


Step 10: Log In with the New Password

After rebooting the system successfully, you’ve reached the final stage of how to reset forgotten Ubuntu user password. This step confirms that the password reset process worked and that your Ubuntu system is fully accessible again.

You should now have full access to your Ubuntu system again.

Verifying Administrative Access

If your account previously had sudo privileges, you can verify them after logging in:

sudo whoami

If prompted, enter your new password. If the output is:

root

Your administrative access is working correctly.


What If You Get Authentication Token Manipulation Error?

One of the most common errors during this process is:

passwd: Authentication token manipulation error

This usually means:

  • Filesystem is still read-only
  • /etc/passwd or /etc/shadow cannot be written

Fix it by remounting again:

mount -o remount,rw /

Then retry the passwd command.


Resetting Password on Ubuntu Server (No GUI)

The steps are identical for Ubuntu Server installations.

The only difference is:

  • No graphical login screen
  • Recovery menu still works the same
  • Root shell is available by default

This makes single-user mode particularly useful for headless servers.


What If GRUB Menu Is Password Protected?

If GRUB itself is locked with a password, you cannot enter recovery mode without that password.

In such cases, your options are:

  • Boot from a live USB (if disk not encrypted)
  • Mount filesystem manually
  • Reset password using chroot
  • Reinstall Ubuntu (last resort)

Security Implications of Single-User Mode

The fact that you can reset passwords without knowing the old one highlights an important security lesson.

How to Secure Your Ubuntu System

  • Enable full disk encryption during installation
  • Set a GRUB password
  • Restrict physical access
  • Use BIOS/UEFI password protection

Without encryption, physical access equals root access.


Single-User Mode vs Live USB Password Reset

MethodComplexityRiskUse Case
Single-user modeLowMinimalForgotten password
Live USB + chrootMediumHigherBroken boot
Reinstall OSHighData lossLast resort

Single-user mode remains the cleanest and safest method.


Common Mistakes to Avoid

  • Forgetting to remount filesystem as read-write
  • Resetting the wrong user password
  • Typing password incorrectly (no visible characters)
  • Rebooting without exiting root shell properly
  • Assuming this works on encrypted disks


Final Thoughts

Forgetting your Ubuntu password doesn’t have to mean panic, data loss, or reinstalling your entire operating system. Understanding how to reset forgotten Ubuntu user password using single-user mode empowers you to recover access quickly, safely, and professionally.

This method is reliable, widely supported across Ubuntu versions, and teaches an important lesson about system security. Whether you’re managing servers, personal laptops, or learning Linux administration, mastering this recovery process is a valuable skill.

For more help, you can visit official Ubuntu documntation.


Topics:#Ubuntu
Written by

Website Vidya Team

Technology educator and researcher at Website Vidya.

Discussion

0
Share your thoughts, ask a question, or suggest a tip...
Write →

No comments on this guide yet. Be the first to share your thoughts or ask a question!

Recommended Reading10 Guides

Related Technical Guides

Tested runbooks, server administration walkthroughs, and troubleshooting guides

Deployment•

How to Install PDO Extension in PHP

PHP Data Objects (PDO) is one of the most important extensions in PHP for working with databases in a secure, consistent, and modern way. If you are building dynamic websites, APIs, CMS platforms, or enterprise applications, PDO is not opti...

RR
Rajesh Rai
Read More
Deployment•

25 Best Linux Commands Every Sysadmin Should Know

If you’ve spent any time managing Linux servers, you already know this truth: the command line is not optional. It’s where real troubleshooting happens, where performance issues are understood, and where outages are prevented before users e...

RR
Rajesh Rai
Read More
Deployment•

How to Fix Snapd Consuming High CPU / RAM on Linux

If you’ve ever opened your system monitor and noticed snapd quietly eating up your CPU or RAM, you’re not alone. Many Linux users—especially on Ubuntu and Ubuntu-based distributions—eventually run into this issue and wonder what’s going on ...

RR
Rajesh Rai
Read More