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:
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.
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):
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
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).