I’m running raspbian on my RaspberryPi 2 and until yesterday it logged in automatically into pi on boot without any problem.

Today it didn’t. Luckily I had already changed root’s password so now I can log into that user. I’d like to return using pi (which in /etc/shadow has an * in the password field and an xin /etc/passwd).

I’ve even checked in lightdm.conf and autologin-user=pi in not commented I tried raspi-config->Boot Options->Desktop/CLI->Desktop autologin (the phrase next to ‘Desktop autologin’ even said ‘autologin as ‘pi’’

I don’t know what else I should try, could anybody help me?

EDIT: RESOLVED. All I had to do was sudo chown pi /home/pi/.Xauthority

  • Can you log in manually as pi? – goldilocks Dec 10 '17 at 16:18
  • No, I even tried modifying the password and then logging in, but it just keeps returning to the login screen after a few seconds of black screen – Kiro Dec 10 '17 at 17:05

which in ‘/etc/shadow’ has an asterisk in the password field

I think this points to one of two situations although the first one I am not sure about:

  1. There's an encrypted password in /etc/passwd. This is pretty obvious, as it is a long string of random characters. This seems to happen sometimes when passwd is run and not followed up with pwconv (it may be that it happens when passwd is run by a non-root user). Ideally pwconv should be run, but the account should still work.

  2. There's no encrypted password in /etc/passwd, meaning you have no password. There's two variations on that, one in which you can login with no password -- the field in /etc/passwd in will be empty, nothing between two colons (::).

    The other variation is there's an x in the /etc/passwd password field (:x:). In this case the significance of the asterisk in /etc/shadow is (from man 5 shadow):

    encrypted password

    Refer to crypt(3) for details on how this string is interpreted.

    If the password field contains some string that is not a valid result of crypt(3), for instance ! or *, the user will not be able to use a unix password to log in (but the user may log in the system by other means).

What you should try in the second case (it sounds like this is the problem, checking those two files would confirm it) is to run passwd pi as root, then (again as root) pwconv, check the two files again (there should be an x in the password field of /etc/passwd, and an encrypted string in /etc/shadow), and try logging in as user pi.

Presumably that is what is preventing the autologin, so once the manual login works it should too.

If all else fails you could also try removing the password field in /etc/passwd (leave just the two separator colons with nothing between). You should now be able to log in without a password (just hit enter when asked).

  • I tried doing as you said, but both modifying the password and removing the ‘x’ in passwd, the situation hasn’t changed. It seems that it tries to log in but it fails, because when I enter the password, no error is displayed, the screen turns black for a few seconds and then it returns to the login screen – Kiro Dec 10 '17 at 19:15
  • Sounds like something is going wrong with the GUI display manager. You should try from a console. Use Ctrl-Alt-F[1-6] to find an open one without a GUI; there will be a plain text login there. That should work, which will rule out an issue with the password, etc. -- if those files are set up correctly, a text login pretty must work, if it doesn't, you've done something wrong, try again. Of course, know it is not actually a password issue won't fix the GUI. – goldilocks Dec 10 '17 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.