Suddenly cannot log in and LXDE not starting. How do I get back to normal startup?

I was working on a way to launch a script automatically at startup. I was editing .profile, .rc-local and root and user crontabs, testing to find a way.

Suddenly when I restarted the pi I was prompted with a login screen. So I tried using my user name and password but for some reason I cannot log in. I enter the correct user name and password and notably I do not get any error message, but the login screen shows up and asks me again and again to enter the user name and password.

Fortunately I can still SSH into the machine. Now I am wondering where things went wrong and how I correct this. The first thing I tested was to disable login using sudo raspi-config. But strangely, even after I disable login using the raspi-config tool the login screen persists.

Anyone knows how I can fix this?

Update: I was not able to log in yet. Tried to change boot mode using raspi-config to CLI mode. Did not reach a CLI screen, just a black screen with a mouse pointer. I wonder if this has something to do with X not starting or something.

I also compared rc.local and .profile with my ubuntu machine and they look similar now. Still not able to start into desktop mode (LXDE)


Could this be some kind of issue with lightdm?

This is what I see in /var/log/lightdm/lightdm.log

[+208.64s] DEBUG: Got signal 10 from process 1331                                  
[+208.64s] DEBUG: DisplayServer x-0: Got signal from X server :0                
[+208.64s] DEBUG: DisplayServer x-0: Connecting to XServer :0                 
[+208.65s] DEBUG: Seat seat0: Display server ready, starting session authentication
[+208.65s] DEBUG: Session pid=1342: Started with service 'lightdm-greeter', username 'lightdm'                                                                                  

[+208.75s] DEBUG: Session pid=1342: Authentication complete with return value 0: Success                                                                                       

[+208.75s] DEBUG: Seat seat0: Session authenticated, running command          
[+208.75s] DEBUG: Session pid=1342: Running command /usr/sbin/pi-greeter        
[+208.75s] DEBUG: Creating shared data directory /var/lib/lightdm/data/lightdm     
[+208.75s] DEBUG: Session pid=1342: Logging to /var/log/lightdm/seat0-greeter.log 
[+209.00s] DEBUG: Activating VT 7                                             
[+209.00s] DEBUG: Activating login1 session c4                                
[+209.00s] DEBUG: Seat seat0 changes active session to c4                   
[+209.00s] DEBUG: Session c4 is already active                                  
[+209.12s] DEBUG: Greeter connected version=1.18.3 resettable=false          
[+210.39s] DEBUG: Greeter start authentication for pi                   
[+210.39s] DEBUG: Session pid=1371: Started with service 'lightdm', username 'pi'  
[+210.44s] DEBUG: Session pid=1371: Got 1 message(s) from PAM                
[+210.44s] DEBUG: Prompt greeter with 1 message(s)

I don't know if it's an issue with lightdm, just a hypothesis. Anyone knows how to fix this?


This is the log from /home/pi/.xsession-errors, not sure if it's relevant:

(WW) warning, (EE) error, (NI) not implemented, (??) unknown.             
(==) Log file:       "/home/pi/.local/share/xorg/Xorg.2.log", Time: Sat Jan  6 14:33:45 2018                                                                                
(==) Using system config directory "/usr/share/X11/xorg.conf.d"                    
(EE) Fatal server error:                                                                
(EE) parse_vt_settings: Cannot open /dev/tty0 (Permission denied)                 
(EE) Please consult the The X.Org Foundation support at for help.                                                                         
(EE) Please also check the log file at "/home/pi/.local/share/xorg/Xorg.2.log" for additional information.                                                                                                                                                             
(EE) Server terminated with error (1). Closing log file.                           
xinit: giving up                                                                   
xinit: unable to connect to X server: Connection refused                         
xinit: server error                                                                
Couldn't get a file descriptor referring to the console
  • Please remember that we discourage signatures and greetings such as hello (and in fact they're automatically removed if at the start of the post). You don't need to include these, and it will likely help readers understand your question more quickly if you omit them. Thanks! – Aurora0001 Jan 6 at 10:13
  • 1
    @Vesa I've removed your comment, and I'll remind you to be nice. Remember none of the users on the site are paid, you should be appreciative that anyone is taking the time to help you out. – Darth Vader Jan 6 at 12:20
  • 1
    I remind you to be nice. Remember to be appreciative that someone is posting questions here, because if there are no questions there can be no answers. – Vesa Jan 6 at 13:21

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.