If you can’t log into your computer, you can follow these instructions to reset the password for any user. Pop!_OS and Ubuntu allow for the root user to reset the password for any user account. In order to get to the root user, we need to restart the computer and use what’s called “single user mode”, which is the low level repair system for the computer.
On a fresh install Pop!_OS 18.04 and later, systemd-boot is used rather than GRUB. Please follow these instructions to reset your password. If your operating system is anything other than Pop!_OS 18.04 and later, please use the GRUB section.
First, bring up the systemd-boot menu by holding down SPACE or the ESC key. On the menu, choose Recovery Mode.
Once the recovery operating system has opened, click Install Pop!_OS in the top left, and choose quit. Then, press +T/ to open a terminal, and type in these commands:
This will show what the main internal drive is named, which will have 4 partitions on it. We will be working with the 3rd partition. If the main drive is an NVMe drive, it will be
/dev/nvme0n1p3 and if the drive is a SATA or regular M.2 drive, it will be
Next, run this command:
sudo mount /dev/sda3 /mnt
If the command fails and says
mount: /mnt: unknown filesystem type 'crypto_LUKS', then the hard drive has been encrypted, and additional commands are needed to unlock it. If the command succeeds (no output), then skip these next steps:
sudo cryptsetup luksOpen /dev/sda3 volume sudo lvscan sudo vgchange -ay
Take note as to what the volume group is called, substituting the correct info into this command. Make sure that ‘-root’ is on the end:
sudo mount /dev/mapper/data-root /mnt
Next, regardless of whether the drive is encrypted or not, run these commands:
sudo chroot /mnt ls /home
Take note of the users on this computer, then run this command to change a user’s password:
Type in your new password, and then enter these commands:
Now, enter the original passphrase. Here you will be prompted for the new passphrase, and then to confirm the new passphrase.
There are two ways to enter into the GRUB boot menu. The first is to restart your computer and tap ESC while the computer starts. The second is to power it off while it is starting up, which will make the menu show up on the next boot. Make sure to stop tapping ESC when the menu appears:
If you do tap ESC when the menu appears, a GRUB command prompt will appear:
If you get to the GRUB command prompt, type in
normal, then press ENTER and immediately press ESC.
Once in the GRUB menu, choose the second option Advanced options for Ubuntu, then, choose the 3rd option Ubuntu, with Linux <current kernel number> (recovery mode).
At the recovery menu, choose the root option, then press Enter to drop to a root prompt.
A note on the root prompt: Since the system is operating with only a single console, all output is printed to the screen. This can be really confusing, but nothing has changed – it’s just output. If your screen looks like the image below, with a timeout notice or similar, press Ctrl+C to return to the prompt and continue working. You will need to re-enter the command you were typing.
Now, type this command to make your hard drive editable:
mount -o rw,remount /
Then type this command to show what usernames are present on the computer:
Then, to change your password, type in this command:
april to the actual user whose password you would like to reset, as seen in the output of
Enter a new password, then press Enter. Even though you are typing, no text will be displayed as seen in the image below.
Enter the same password again to confirm, then press Enter.
If successful, you will see a message confirming `passwd: password updated successfully
You can now reboot:
This can be done in the operating system or in the recovery mode/partition.
First list the drives and partitions with this command:
Then to change the passphrase:
sudo cryptsetup luksChangeKey /dev/sda3 -S 0
Click on the drive that has the OS installed on it on the left side of the Disks application. Then click on the LUKS partition (where the root partition is) and then click on the gear icon under the ‘Volumes’ section.