Oh! Well you are on the right track. But first, you cannot do this headless - you will need a keyboard and monitor connected. If you think about the security of that it makes sense.
Remove your SD card, mount it on some other computer, edit the cmdline.txt file and look for a line that says something like:
At the end of that line, add a space and the following statement (this MUST be on the same line):
Dismount/eject/remove the card and put it back in your Pi (with a keyboard and monitor) and boot it up. You'll see "stuff" as it boots, then it will appear to stop/freeze. You will then issue the following command:
After that you will be in the system as root. Issue the following command and follow the instructions:
After you successfully change the password, issue the following two commands:
It will do it's thing and then seemingly lock up. Give it another full minute after that to finish just in case. Then power off your Pi. Remove the SD card again and mount it on some other computer as you did previously. Again edit the cmdline.txt file and remove the init=/bin/sh statement. Save the file, dismount/eject/remove the card, put it back in your Pi and power it up. You should be good to go at this point.
Remove your SD card, mount it on some other computer, edit the cmdline.txt file and look for a line that says something like:
Code:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
Code:
init=/bin/sh
Code:
mount -o remount, rw /
Code:
passwd pi
Code:
sync
exec /sbin/init