Page 1 of 1

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

Posted: Fri Oct 06, 2017 11:11 am
by piglet
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.

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

Posted: Fri Oct 06, 2017 7:19 pm
by wh7qq
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!

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

Posted: Fri Oct 06, 2017 9:02 pm
by piglet
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

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

Posted: Fri Oct 06, 2017 9:13 pm
by piglet
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

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

Posted: Fri Oct 06, 2017 9:28 pm
by piglet
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

pi@raspberrypi:~ $ 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.

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

Posted: Thu Jun 21, 2018 7:39 am
by vybhav
Hi
I am facing the same problem ,could anyone help me out please .

Thank You
Vybhav

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

Posted: Mon Jul 30, 2018 4:03 pm
by thebarless
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"

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

Posted: Thu Aug 09, 2018 3:18 pm
by nekvt
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.

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

Posted: Mon Aug 27, 2018 2:10 pm
by jlnrgrs
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.

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

Posted: Sat Sep 15, 2018 4:33 pm
by subtlenv

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

Posted: Mon Jan 14, 2019 3:39 pm
by b_i_l_b_o
Another reason:
I had a /home/pi/.xsession file like this:
#fluxbox
#matchbox-desktop

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

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

Posted: Sun Aug 18, 2019 4:48 am
by Connorboris
For my pi zero W I used sudo apt-get install lxsession followed by a sudo reboot and I was able to get out of the loop and actually boot to desktop

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

Posted: Wed Sep 18, 2019 1:46 am
by BalooRM
Connorboris Your excellent suggestion fixed the issue on my Pi 3b+. Thank you!

Code: Select all

sudo apt-get install lxsession

I had done an update and upgrade and found myself in exactly the same situation as piglet.

The output from the lxsession install indicates the likely cause:
...
Setting up lxsession (0.5.3-2+rpi1) ...
update-alternatives: warning: forcing reinstallation of alternative /usr/bin/startlxde-pi because link group x-session-manager is broken
...

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

Posted: Fri Sep 20, 2019 10:59 pm
by reekerder
Howdy everyone!

I'm having the same exact issue as OP. I've done my research, yet only two relevant articles are pulled up on Google - and this is one of them.
In both instances, people commonly advise to do X or Y through the tty, but I can't even pull up a tty! So if I'm stuck on the Login/Shutdown screen loop, how do I open a terminal(hotkeys, of course. I've tried ctrl+alt+F1/F2/F3, ctrl+alt+t), or do you have any other ways of me gaining access to my Pi oncemore, and delete the new usr I've added? Thanks a ton!