What you will read?
Forgetting your password can be a frustrating experience, especially when it locks you out of your Linux Mint 20 system. Thankfully, there are reliable methods to reset your password without losing any data. This guide will walk you through the necessary steps to regain access to your system quickly and securely.
Accessing Recovery Mode
To reset your forgotten password in Linux Mint 20, you’ll first need to access the Recovery Mode. Recovery Mode allows you to perform administrative tasks with root privileges, including resetting passwords.
Here are the steps to access Recovery Mode:
- Restart Your Computer: Begin by restarting your Linux Mint 20 system.
- Access GRUB Menu: As your computer boots up, press and hold the Shift key (for BIOS systems) or press Esc repeatedly (for UEFI systems) to bring up the GRUB boot menu.
- Select Advanced Options: In the GRUB menu, use the arrow keys to select “Advanced options for Linux Mint 20” and press Enter.
- Choose Recovery Mode Kernel: You’ll see a list of available Linux kernels. Select the one that has “(recovery mode)” appended to it.
- Access Root Shell Prompt: After selecting the recovery mode kernel, a menu will appear. Choose “Drop to root shell prompt” to gain root access.
Now, you have access to the root shell with administrative privileges, and you can proceed to reset your password.
Resetting the Root Password
Once you have access to the root shell prompt in Recovery Mode, the next step is to reset the root password. This process is essential for regaining full administrative privileges on your system. By default, the root file system is mounted as read-only in Recovery Mode, so you need to remount it with write permissions before proceeding.
To remount the file system with write access, enter the following command:
mount -o remount,rw /
After remounting, you can reset the root password by typing:
passwd root
You will be prompted to enter a new password for the root user. Make sure to choose a strong and secure password, and enter it twice for confirmation. Upon success, you should see a message indicating that the password has been updated successfully.
Changing the User Password
With the root password reset, you can now change the password for your regular user account. This is particularly useful if you’ve forgotten your user password but have root access. While still in the root shell prompt, type the following command, replacing username
with your actual username:
passwd username
Again, you will be prompted to enter a new password for your user account. Enter the new password twice to confirm. After the password is updated, you will have restored access to your user account and can proceed to use your system normally.
Exiting Recovery Mode
After resetting your root and user passwords, the final step is to exit Recovery Mode and boot into your Linux Mint 20 system normally. This will allow you to log in with your new credentials and ensure that everything is functioning as expected.
To exit Recovery Mode, you can simply reboot your system. While still in the root shell prompt, type the following command to restart:
reboot
Alternatively, if you prefer to continue the boot process without a full reboot, you can type:
exit
This will return you to the Recovery Menu. From there, select the option “Resume normal boot” to continue booting into your system.
Once the system restarts or resumes, you will reach the login screen. Enter your username and the new password you set to log in.
Using a Live USB for Password Reset
If you are unable to access Recovery Mode or prefer an alternative method, using a Live USB to reset your password is an effective solution. A Live USB contains a bootable version of Linux Mint, allowing you to run the operating system directly from the USB drive without installing it on your hard drive. This method enables you to access your system files and reset your password even if you’re locked out.
To reset your password using a Live USB, first create a bootable USB drive with Linux Mint. You can do this on another computer by downloading the Linux Mint ISO image and using a tool like Etcher to write it to a USB drive. Once the Live USB is ready, insert it into your locked computer and boot from the USB drive. You may need to change the boot order in your BIOS or UEFI settings to boot from USB.
After booting into the Live USB environment, open a Terminal window. You’ll need to identify the partition where your Linux Mint is installed. You can use the following command to list all partitions:
sudo fdisk -l
Once you’ve identified your root partition (it might be something like /dev/sda2
), mount it to a temporary directory. Create a mount point and mount the partition:
sudo mkdir /mnt/linuxmint sudo mount /dev/sda2 /mnt/linuxmint
Next, change the root directory to the mounted partition using the chroot
command:
sudo chroot /mnt/linuxmint
Now, reset your user password by typing:
passwd username
Replace username
with your actual username. You’ll be prompted to enter a new password and confirm it. After successfully changing the password, exit the chroot environment:
exit
Unmount the partition:
sudo umount /mnt/linuxmint
Finally, reboot your system without the Live USB:
sudo reboot
Your system should now boot normally, and you can log in with the new password you set.
Troubleshooting Common Issues
Even after following the steps to reset your password in Linux Mint 20, you might encounter some issues. Below are some common problems and their solutions to help you troubleshoot effectively.
Issue: GRUB Menu Does Not Appear
If the GRUB menu doesn’t show up when you reboot your system, you might need to adjust your boot settings. Make sure you’re pressing the correct key (Shift for BIOS systems or Esc for UEFI systems) at the right time during boot. If it still doesn’t appear, you may need to check your BIOS/UEFI settings to enable the boot menu.
Issue: Unable to Remount the File System with Write Permissions
If you receive an error when attempting to remount the file system with write permissions, ensure that you have entered the command correctly:
mount -o remount,rw /
If the problem persists, it might indicate an issue with the root file system, which may require a file system check or repair.
Issue: Password Not Updating Successfully
If you encounter an error message when trying to reset the password using the passwd
command, it could be due to the file system still being in read-only mode. Double-check that you’ve successfully remounted it with write permissions. Also, ensure you’re entering a strong password that meets the system’s requirements.
Issue: Changes Not Saved After Reboot
If your new password isn’t recognized after rebooting, it’s possible that the changes weren’t saved. This can happen if the file system wasn’t properly remounted with write permissions before changing the password. Repeat the remount and password reset steps, making sure each command executes without errors.
Issue: System Boots into Recovery Mode Repeatedly
If your system keeps booting into Recovery Mode, there might be issues with your boot configuration or hardware problems. Verify your GRUB configuration to ensure the default boot option is set correctly. If necessary, consult Linux Mint support resources for further assistance.
Preventing Future Password Loss
Forgetting your password can be a time-consuming inconvenience. To prevent this from happening in the future, consider implementing some best practices for password management. One effective strategy is to use a reputable password manager. Password managers securely store your passwords and can generate strong, unique passwords for each of your accounts. This not only enhances your security but also relieves you from the burden of remembering multiple complex passwords.
Another approach is to set up password recovery options. Linux Mint allows you to create a password reset disk or configure security questions that can help you regain access without going through the recovery mode process. Regularly updating your passwords and keeping them in a secure location, whether digitally or in a physical notebook stored safely, can also mitigate the risk of password loss.
Restoring Default Settings
In some cases, resetting your password might not resolve underlying system issues caused by misconfigurations or corrupted files. Restoring your system to its default settings can help resolve persistent problems. Linux Mint offers tools like Timeshift, which allows you to create and restore system snapshots.
To restore default settings using Timeshift:
- Boot into your system or use a Live USB if necessary.
- Open Timeshift from the application menu.
- Select a previous snapshot taken when your system was functioning correctly.
- Follow the prompts to restore your system to that snapshot.
Keep in mind that restoring a snapshot will revert system files and settings to their previous state, which may result in the loss of recent changes or installed applications.
Conclusion
Regaining access to your Linux Mint 20 system after forgetting your password is entirely feasible using the methods outlined above. By accessing Recovery Mode, resetting passwords via a Live USB, and taking preventative measures, you can ensure a smooth and secure computing experience. Remember to implement password management strategies to prevent future password loss, and consider creating regular system backups to safeguard against potential issues.