Pizzachu22
Posts: 2
Joined: Sun Mar 04, 2018 7:11 pm

(HELP) forgot password and I cannot change it!

Sun Mar 04, 2018 7:28 pm

Hello there. During the summer, my school held a raspberry pi camp and that's how I got my Pi3. Fast forward to march 2018 where we went ahead and set it up with a monitor and some old 90's-ish speakers. Today. I went ahead to try and install some software but I needed a password. However, since I had gone multiple months without use of my pi, I forgot my pi's password. Now I cannot change it and therefore cannot install anything If there is someone out there with a solution, let me know.

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: (HELP) forgot password and I cannot change it!

Sun Mar 04, 2018 8:42 pm

Get another SDCard and a USB reader.

Build a fresh copy of Raspbian Stretch on the new SDCard. Boot that in your RPi. Open an LXTerminal and get root authority shell with sudo -s.

Mount the borken card in the Reader. Insert the reader in your RPi. The automounter will pop-up, cancel any windows that pop-up.

Run
for i in /dev/sda*
do
umount $i
fsck -f -y $i
done

ignoring any errors.

Mount the rootfs (/dev/sda2 if not NOOBS, /dev/sda6 if it is NOOBS) with
mount /dev/sda2 /mnt # or mount /dev/sda6 /mnt

Mount some special filesystems
mount -t proc /proc /mnt/proc
mount -t sysfs /sys /mnt/sys
mount -o bind /dev /mnt/dev


Change to the /mnt directory and chroot the /dev/sda filesystem.
cd /mnt
chroot .
# there's a full stop on the end of that one.

You now have the original card's filesystem available and you're running as root. Use
passwd pi
and follow the prompts to reset your pi password to a known string.

Exit the chroot, unmount everything. Poweroff, swap cards and you're good to go.
exit # the chroot not the root shell
for i in dev proc sys
do
umount /mnt/$i
done
umount /dev/sda2
eject /dev/sda
poweroff
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

n67
Posts: 938
Joined: Mon Oct 30, 2017 4:55 pm

Re: (HELP) forgot password and I cannot change it!

Sun Mar 04, 2018 10:09 pm

Or you can use the "-R" option in passwd, saving yourself all that manual work.
"L'enfer, c'est les autres"

G fytc hsqr rum umpbq rm qyw rm rfc kmbq md rfgq dmpsk:

Epmu Sn!

J lnacjrw njbruh-carppnanm vxm rb mnuncrwp vh yxbcb!

User avatar
davidcoton
Posts: 5027
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK
Contact: Website

Re: (HELP) forgot password and I cannot change it!

Sun Mar 04, 2018 11:42 pm

If you never set a personal password, then the pi account has password "raspberry".
Signature retired

User avatar
HawaiianPi
Posts: 5838
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: (HELP) forgot password and I cannot change it!

Mon Mar 05, 2018 4:39 am

davidcoton wrote:
Sun Mar 04, 2018 11:42 pm
If you never set a personal password, then the pi account has password "raspberry".
Yup, try raspberry
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

Return to “Troubleshooting”