0

I'm new to Raspbian.

I started the GUI for the first time (following a fresh install) using the instructions found here: How to set my Raspberry Pi to boot into the GUI? and the command:

sudo apt-get install lightdm

I rebooted the machine, but the default login (pi) and password (raspberry) no longer work. I don't know of any other way to reset the password.

Other than re-flashing the Raspbian image to the SD card, how can I get out of this situation?

frepie
  • 113
  • 5

1 Answers1

2

Getting a terminal makes no difference. Also there you are ask for a username and a password. But you can reset the password if you can mount the ext4 root partition on another computer. Connect the SD Card with a card reader to a linux computer and mount the root partition to e.g. /mnt. Then edit

/mnt/etc/passwd

change
pi:x:1000:1000:,,,:/home/pi:/bin/bash
to
pi::1000:1000:,,,:/home/pi:/bin/bash

/mnt/etc/shadow

change
pi:ljrp9kgwknldgp80ooutqwwe06aswrjhgdhäthtltlehihifhiljlofwerndsl/RoIJcnHQ7kAzdXi3gN.Uw6kDFNLsJqtDZk0:17761:0:99999:7:::
to
pi::::

exact 4 colons are important.

Booting this in your RasPi you should be able to login without password: username pi, password just <enter>. If you want to do it on a terminal you can try the key combination <ctrl><alt><F1> when you are on the GUI. Most GUI switch with it to a terminal.

And yes, don't forget to give a new password.

Ingo
  • 42,961
  • 20
  • 87
  • 207