User avatar
piglet
Posts: 900
Joined: Sat Aug 27, 2011 1:16 pm

[Solved] Stuck in loop asking for password before desktop. Check your .profile

Fri Oct 06, 2017 11:11 am

Hi All,

This is the second time I've had this problem. Last time I gave up and rebuilt from a new download of Rasbian.

Expected functionality: Pi3 (Raspbian, Stretch, up to date) is set to "Boot to desktop". When I turn on I get to the desktop and can do stuff. No password required. I have been using the pi this way since 23rd August with no problems whatsoever.

Symptoms after a reboot today - different to every other reboot I've done:

1) Through SSH I can log in using default word "raspberry".

2) When connected to HDMI/keyboard/mouse instead getting to the desktop I get to a login prompt for pi on desktop screen3)
3) If I enter the correct password "raspberry" I get a black screen and then the login prompt comes back
4) If I enter an incorrect password deliberately it tells me, correctly, that I got it wrong.

5) Over SSH I added a new user with useradd, and using that user I can login successfully to the desktop at the login prompt .
6) Over SSH I changed the password for user pi, however when I try to use that to get to the desktop I get the symptoms in 3 above.

Please can someone help me find out what has gone wrong and how to correct it so that I can log in as "pi"?

If this has happened to me twice, it seems likely that this is probably happening to other people.
Last edited by piglet on Fri Oct 06, 2017 9:31 pm, edited 1 time in total.

wh7qq
Posts: 1298
Joined: Thu Oct 09, 2014 2:50 am

Re: Help please - can't log in to desktop as Pi after reboot! Again?

Fri Oct 06, 2017 7:19 pm

I can't really see why your system should have changed overnight like that. Did you do any updates or other changes?

I have seen some weirdness in the login/password process pretty much ever since RPF got security conscious about ssh logins (basically a good thing to do but confusing in the implementation). I have found that it is necessary to change the password in both the desktop Preferences>Raspberry Pi Configuration utility and in the terminal using

Code: Select all

passwd pi
. I can't recall if I used "sudo" with that or not and it may make a difference. Of course,I did use the sudo to get into raspi-config from the terminal. I have changed it every way I could think of. I don't think the LXDE desktop talks to the underlying Linux in every case.

Several suggestions:
1..Be sure to put the empty file called ssh in the top directory of the boot partition before your first boot.
2. Change to your new password in raspi-config from the terminal window. Do the same from your LXDE configuration utility as I stated in the last paragraph.
3. If you still have difficulties, change the password using passwd pi as outlined above.
4 Good Luck!

User avatar
piglet
Posts: 900
Joined: Sat Aug 27, 2011 1:16 pm

Re: Help please - can't log in to desktop as Pi after reboot! Again?

Fri Oct 06, 2017 9:02 pm

Hi, no. All I did was reboot. It's not that the pi user password is wrong - I can log in with it over ssh or from another terminal session (ctrl-alt-Fn). I've changed passwords with no effect. I can't do it whilst on the desktop - as the problem stops me from getting there.

In searching I see lots of other people have had this problem - 2014 to 2016 so it looks to me like there's a bug here that hasn't been fixed: viewtopic.php?t=28521

https://raspberrypi.stackexchange.com/q ... cant-login
https://www.youtube.com/watch?v=aKJw4YUt0ho
http://engineer2you.blogspot.co.uk/2016 ... login.html
http://forum.erlerobotics.com/t/raspber ... creen/1376
Last edited by piglet on Fri Oct 06, 2017 9:22 pm, edited 3 times in total.

User avatar
piglet
Posts: 900
Joined: Sat Aug 27, 2011 1:16 pm

Re: Help please - can't log in to desktop as Pi after reboot! Again?

Fri Oct 06, 2017 9:13 pm

Here's the /var/log/lightdm/lightdm.log output from a BAD login:

It goes wrong starting at "[+1007.22s] DEBUG: Session pid=1375: Exited with return value 0"

Code: Select all

[+1006.56s] DEBUG: Continue authentication
[+1006.75s] DEBUG: Session pid=1375: Authentication complete with return value 0: Success
[+1006.75s] DEBUG: Authenticate result for user pi: Success
[+1006.75s] DEBUG: User pi authorized
[+1006.81s] DEBUG: Greeter requests session lightdm-xsession
[+1006.81s] DEBUG: Seat seat0: Stopping greeter; display server will be re-used for user session
[+1006.81s] DEBUG: Session pid=1342: Sending SIGTERM
[+1006.85s] DEBUG: Greeter closed communication channel
[+1006.86s] DEBUG: Session pid=1342: Exited with return value 0
[+1006.86s] DEBUG: Seat seat0: Session stopped
[+1006.86s] DEBUG: Seat seat0: Greeter stopped, running session
[+1006.86s] DEBUG: Registering session with bus path /org/freedesktop/DisplayManager/Session5
[+1006.86s] DEBUG: Session pid=1375: Running command /etc/X11/Xsession default
[+1006.86s] DEBUG: Creating shared data directory /var/lib/lightdm/data/pi
[+1006.86s] DEBUG: Session pid=1375: Logging to .xsession-errors
[+1006.98s] DEBUG: Activating VT 7
[+1006.98s] DEBUG: Activating login1 session c15
[+1007.05s] DEBUG: Seat seat0 changes active session to
[+1007.05s] DEBUG: Seat seat0 changes active session to c15
[+1007.05s] DEBUG: Session c15 is already active
[+1007.22s] DEBUG: Session pid=1375: Exited with return value 0
[+1007.22s] DEBUG: Seat seat0: Session stopped
[+1007.22s] DEBUG: Seat seat0: Stopping display server, no sessions require it
[+1007.22s] DEBUG: Sending signal 15 to process 1329
[+1007.23s] DEBUG: Seat seat0 changes active session to
[+1007.23s] CRITICAL: session_get_login1_session_id: assertion 'session != NULL' failed
[+1007.39s] DEBUG: Process 1329 exited with return value 0
[+1007.39s] DEBUG: DisplayServer x-0: X server stopped
[+1007.39s] DEBUG: Releasing VT 7
[+1007.39s] DEBUG: DisplayServer x-0: Removing X server authority /var/run/lightdm/root/:0
[+1007.39s] DEBUG: Seat seat0: Display server stopped
[+1007.39s] DEBUG: Seat seat0: Active display server stopped, starting greeter
[+1007.39s] DEBUG: Seat seat0: Creating greeter session
[+1007.39s] DEBUG: Seat seat0: Creating display server of type x
[+1007.39s] DEBUG: Using VT 7
[+1007.39s] DEBUG: Seat seat0: Starting local X display on VT 7
[+1007.39s] DEBUG: DisplayServer x-0: Logging to /var/log/lightdm/x-0.log
[+1007.39s] DEBUG: DisplayServer x-0: Writing X server authority to /var/run/lightdm/root/:0
[+1007.39s] DEBUG: DisplayServer x-0: Launching X Server
[+1007.39s] DEBUG: Launching process 1434: /usr/bin/X :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
[+1007.39s] DEBUG: DisplayServer x-0: Waiting for ready signal from X server :0
[+1007.93s] DEBUG: Got signal 10 from process 1434
[+1007.93s] DEBUG: DisplayServer x-0: Got signal from X server :0
[+1007.93s] DEBUG: DisplayServer x-0: Connecting to XServer :0
[+1007.93s] DEBUG: Seat seat0: Display server ready, starting session authentication
[+1007.94s] DEBUG: Session pid=1447: Started with service 'lightdm-greeter', username 'lightdm'
[+1007.99s] DEBUG: Session pid=1447: Authentication complete with return value 0: Success
[+1007.99s] DEBUG: Seat seat0: Session authenticated, running command
[+1007.99s] DEBUG: Session pid=1447: Running command /usr/sbin/pi-greeter
[+1007.99s] DEBUG: Creating shared data directory /var/lib/lightdm/data/lightdm
[+1007.99s] DEBUG: Session pid=1447: Logging to /var/log/lightdm/seat0-greeter.log
[+1008.13s] DEBUG: Activating VT 7
[+1008.13s] DEBUG: Activating login1 session c16
[+1008.13s] DEBUG: Seat seat0 changes active session to c16
[+1008.13s] DEBUG: Session c16 is already active
[+1008.29s] DEBUG: Greeter connected version=1.18.3 resettable=false
[+1009.53s] DEBUG: Greeter start authentication for pi
[+1009.53s] DEBUG: Session pid=1476: Started with service 'lightdm', username 'pi'
[+1009.55s] DEBUG: Session pid=1476: Got 1 message(s) from PAM
[+1009.55s] DEBUG: Prompt greeter with 1 message(s)
This is output from a good login on the same machine for the test user "me" I added earlier:

Code: Select all

[+1191.52s] DEBUG: Continue authentication
[+1191.72s] DEBUG: Session pid=1478: Authentication complete with return value 0: Success
[+1191.72s] DEBUG: Authenticate result for user me: Success
[+1191.72s] DEBUG: User me authorized
[+1191.78s] DEBUG: Greeter requests session lightdm-xsession
[+1191.78s] DEBUG: Seat seat0: Stopping greeter; display server will be re-used for user session
[+1191.78s] DEBUG: Session pid=1447: Sending SIGTERM
[+1191.83s] DEBUG: Greeter closed communication channel
[+1191.83s] DEBUG: Session pid=1447: Exited with return value 0
[+1191.83s] DEBUG: Seat seat0: Session stopped
[+1191.83s] DEBUG: Seat seat0: Greeter stopped, running session
[+1191.83s] DEBUG: Registering session with bus path /org/freedesktop/DisplayManager/Session6
[+1191.84s] DEBUG: Session pid=1478: Running command /etc/X11/Xsession default
[+1191.84s] DEBUG: Creating shared data directory /var/lib/lightdm/data/me
[+1191.84s] DEBUG: Session pid=1478: Logging to .xsession-errors
[+1192.09s] DEBUG: Activating VT 7
[+1192.09s] DEBUG: Activating login1 session c17
[+1192.09s] DEBUG: Seat seat0 changes active session to
[+1192.09s] DEBUG: Seat seat0 changes active session to c17
[+1192.09s] DEBUG: Session c17 is already active

User avatar
piglet
Posts: 900
Joined: Sat Aug 27, 2011 1:16 pm

[solved] Re: Help please - can't log in to desktop as Pi after reboot! Again?

Fri Oct 06, 2017 9:28 pm

Got it at last! Hint found here: https://askubuntu.com/a/246858

Something in the .profile wasm't right. Odd, as nothing unusual there.

Code: Select all

[email protected]:~ $ cat .xsession-errors
Xsession: X session started for pi at Fri  6 Oct 22:21:25 BST 2017
dbus-update-activation-environment: setting DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
dbus-update-activation-environment: setting DISPLAY=:0
dbus-update-activation-environment: setting XAUTHORITY=/home/pi/.Xauthority
localuser:pi being added to access control list
/etc/X11/Xsession: 25: /home/pi/.profile: Syntax error: "(" unexpected
Removed the .profile and I can log in as pi again.

vybhav
Posts: 7
Joined: Thu Mar 22, 2018 7:15 am

Re: [Solved] Stuck in loop asking for password before desktop. Check your .profile

Thu Jun 21, 2018 7:39 am

Hi
I am facing the same problem ,could anyone help me out please .

Thank You
Vybhav

thebarless
Posts: 1
Joined: Mon Jul 30, 2018 3:58 pm

Re: [Solved] Stuck in loop asking for password before desktop. Check your .profile

Mon Jul 30, 2018 4:03 pm

Ran into this issue. It turned out that I ran out of space on my SD card. Can diagnose by accessing the pi via SSH and running "df -h"

nekvt
Posts: 5
Joined: Wed Aug 08, 2018 7:33 pm

Re: [Solved] Stuck in loop asking for password before desktop. Check your .profile

Thu Aug 09, 2018 3:18 pm

Piglet: thanks for posting this helpful information. I have run into this problem three times - I am on my fourth complete restart - and this is the first useful info I have found, after searching for many days.

But, please tell us exactly what you did to correct the problem. Did you completely remove /home/pi/.profile?

Thanks, again.

jlnrgrs
Posts: 1
Joined: Mon Aug 27, 2018 2:03 pm

Re: [Solved] Stuck in loop asking for password before desktop. Check your .profile

Mon Aug 27, 2018 2:10 pm

Just like thebarless, I ran into this issue and I had run out of space. I was using the Pi as a picture frame and had loaded too many jpegs. Soon as I deleted some the password request went away.


User avatar
b_i_l_b_o
Posts: 2
Joined: Mon Jan 14, 2019 3:27 pm

Re: [Solved] Stuck in loop asking for password before desktop. Check your .profile

Mon Jan 14, 2019 3:39 pm

Another reason:
I had a /home/pi/.xsession file like this:
#fluxbox
#matchbox-desktop

with an empty third line.
Funny, isn't it?

Return to “Troubleshooting”