14

I'm seeing the login screen every time my pi boots up. At first it didn't need any password but after 3-4 boots, pi asks for a password. When I write the password displays the same screen again. I don't know what to do now :/

I'm using Raspbian on Raspberry Pi 3. Haven't installed tightvncserver as I saw other questions here. Screenshot of the screen below.

screenshot

I tried logging in from command line. I press Ctrl+Alt+F6 to get into command line and login from there.

After login I write startx, the screen turns black, and then it's showing the error:

xinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: server error
  • I assuming this is the login screen for VNC? The password will be whatever you set it. The default password for a Raspberry Pi is raspberry. – Darth Vader Apr 16 '16 at 16:02
  • Haven't installed vnc – arslion Apr 16 '16 at 16:04
  • did you try raspberry as the password? – Darth Vader Apr 16 '16 at 16:07
  • Yes i tried it works on command line but didn't works here on this screen. – arslion Apr 16 '16 at 16:09
  • A few ideas: Are you sure that neither NumLock or CapsLock is active when you enter your password? Did you check the syslog? You can't run startx from the command line because X is already running. – Bex Apr 16 '16 at 17:01
12

It looks like your X server is working fine, but either your login manager or your desktop environment are failing to run properly (the former is supposed to ask for a password, then start the latter for you).

How to investigate

Since you can login via command line, you can easily access important log files which you should check for error messages. Login manager (I assume lightdm) logs usually live in /var/log/lightdm/, desktop environments should also keep their log somewhere in /var/log/. Check man to find out.

Also try starting your desktop environment manually from command line (e.g. if you use LXDE run startlxde) and check the output for eventual error messages.

How to fix

Without knowing what exactly the problem is, here are some actions which might help:

  • reset permissions on your home folder: sudo chown -R pi /home/pi. (Specifically, the .Xauthority file may have the incorrect permissions. In this case, you may only need sudo chown pi:pi .Xauthority to correct the issue.)
  • reinstall your login manager and desktop environment. Use dpkg --purge to remove packages completely, including configuration files (you might want to back up files you have modified), then reinstall the packages back.
  • 1
    It was totally the xauthority problem for me, good call. – djhaskin987 Oct 5 '18 at 20:34
  • Thank you so much Dmitry and squareskittles! I was pulling my hair out trying before I found this solution. – Ryan Jensen May 9 at 18:05
2

Solution 1:

Insert the microSD card to some linux PC and clean some files. Lack of free drive space might cause this.

Solution 2:

While you see the login screen, press Ctrl+Alt+F1. This will bring the console. There you can type:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
reboot

These methods worked for me when I had this problem. Good luck.

0

I don't know if this will help and would appreciate feedback if there are any significant issues with my solution.

I had this problem and discovered that the shell being started to bring up the desktop (/bin/sh) is really just a symbolic link to dash (/bin/dash). I don't recall the details, but figured out that I had things in my .profile that were incompatible with dash and was causing the startup to fail.

The desktop had been working fine before I did an update, so I assume the update changed the link?

In any case, using putty on my PC to login via ssh I was able to delete the link to dash and created sh as a link to bash.

sudo rm /bin/sh
sudo ln -s /bin/bash /bin/sh

I rebooted the pi and everything worked again.

0

In my case this was caused by upgrading OpenSSL to the 1.0.2 developer version, as outlined in the docs for setting up AWS Greengrass. Skipping that step prevented the login loop.

https://docs.aws.amazon.com/greengrass/latest/developerguide/prepare-raspi.html

0

I got the exact same problem just now. It seems to relate to .Xauthority file. I just removed this file in the home folder by:

sudo rm /home/pi/.Xauthority

Now it's back to normal

  • I'd made a .xsession file in my home directory (when playing with xrdp) and removing that fixed it. – KERR Mar 10 '18 at 23:07
-1
  1. Use CtrlAltF6 to switch to a virtual console with a text login (if that doesn't work, try the same thing with F1-F5).
  2. Login user=pi pass=raspberry
  3. Try startx to launch a GUI.
  • Try sudo startx to GUI. – chutchai Nov 16 '16 at 1:41
  • I don't have a startx ? – mckenzm Oct 1 '17 at 9:17
-2

1 conect with ssh

ssh you_raspi_ip

user pi
password raspberry

cd ~
rm -R .xsession
sudo reboot
-2

This is sort of a combination of the other two answers:

  1. Use CtrlAltF6 to switch to a virtual console with a text login (if that doesn't work, try the same thing with F1-F5).
  2. Login user=pi pass=raspberry
  3. Use sudo chown -R pi.pi /home/pi. This will set the permissions correctly on any temporary files necessary for the GUI, etc.

protected by Community Dec 15 '17 at 9:53

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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