Posted for my later reference.
It happened when I was about to connect the RPi to the interwebs. I changed the user password to something smart, then forgot it. Having not enabled the root user I was locked out.
As it turns out it’s really simple to reset. Just follow a simple step-by-step, like the one I found at rpi.tnet.com.
- Add init=/bin/sh to the end of cmdline.txt, which is to be found on the FAT-partition.
Make sure the contents in this file stays in one line.
- Power up the RPi
- A command prompt magically appears
- Type the following:
mount -o remount,rw / passwd pi (enter a new password) sync exec /sbin/init
Remove the added command from cmdline.txt, power up the RPi and log in with the new password.