Life happens. When we run the Raspberry Pi 3 as headless and it comes time to change a setting or upgrade packages, we sometimes find ourselves remembering the password just to learn its the wrong one.
Well, this simple but quick password reset for the Pre-installed Ubuntu Server, for the Raspberry Pi 3, will allow you to reset your account password and be back up and running without having to start over from scratch.
- Make sure your Raspberry Pi 3 is off and remove the micro sd card.
- Insert your micro sd card into your adapter and then into another system.
- Open cmdline.txt in your text editor and add the number 1 at the end of the line and save the file (do not copy and paste this line because it may not be exact) :
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline
It should now look similar to:
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline 1
- Now reinsert the micro sd card into your Raspberry Pi 3 and boot it up.
- You will be prompted to press Enter to continue to diagnostic or press Ctrl + D to continue booting. Press Enter.
- You should have a terminal prompt as superuser. Type passwd [your username] and follow the prompts to change your password. Where [your username] is your actual username such as pi or ubuntu.
- When you’ve changed your password, reboot your Raspberry Pi 3.
- Now when prompted, press Ctrl + D to continue booting Ubuntu Server normally.
You should be able to login with your new password at the tty prompt.
Be sure to remove the edit that was made in the cmdline.txt file so your Raspberry Pi 3 will boot normally.