Ubuntu gets stuck in a login loop
My Ubuntu is stuck in a login loop when trying to enter my desktop. When I login, the screen gets black and soon after that the login screen comes back.
I've read that the problem might be caused by an error depending on the graphics, here's my graphics card: ATI Radeon 7670M
Did you end up here after running sudo startx
? Nevertheless:
Press Ctrl+Alt+F3 and login into the shell.
Now run ls -lA
. If you see the line
-rw------- 1 root root 53 Nov 29 10:19 .Xauthority
then you need to do chown username:username .Xauthority
and try logging in (you may also need to do the same for for .ICEauthority
).
Else, do ls -ld /tmp
. Check for the first 10 letters in the left: they should read exactly so: drwxrwxrwt
.
drwxrwxrwt 15 root root 4096 Nov 30 04:17 /tmp
Else, you need to do sudo chmod a+wt /tmp
and check again.
If not both, I'd recommend you either
sudo dpkg-reconfigure lightdm
- or uninstall, reinstall it.
Now press Alt+→ until you reach the login screen again, and restart.
I had this and after looking at /var/log/Xorg.0.log
I found out that it's a Nvidia problem (there was a line saying Xlib: extension "GLX" missing on display ":0
).
I realized I have Nvidia drivers from official website which are not really stable and tested (so I've read and also experienced in the past).
The solution here was to install package nvidia-current
from Ubuntu repos; it is an awfully outdated version, but it's tested properly at least. Its installer is quite capable too and it uninstalled successfully my hack-installed unstable version from Nvidia website.
TL;DR, just try logging into the shell (Ctrl+Alt+F2 or whatever F between F1 and F6) and type
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt install nvidia-367
If it succeeds, reboot.
sudo reboot
If you're lucky enough, problem solved, you should be able to login to Unity.
UPDATE
Please note that sometimes nvidia-current
might install the wrong driver. In that case, search the latest compatible driver for your video card and install it. For example, on Ubuntu 16.04, nvidia-current
points to the version: 304.131-0ubuntu3. This might be incompatible with your graphics card; therefore, search with sudo apt-cache search nvidia-[0-9]+$
for the package you need, and install it.
I encountered this exact problem and none of the suggested fixes above worked for me. After almost giving up I looked at the .xsession-errors
and noticed I had a typo in my .profile
(I had an extra }
in the file after I edited it earlier in the day).
That was causing the login loop. It might be another place to look if the other suggested fixes don't work for you.
I had a nearly identical problem a few months ago. Switching into a console from the LightDM login screen (Ctrl-Alt-F1), logging in with administrative username and password, and entering the following commands resolved the issue:
sudo mv ~/.Xauthority ~/.Xauthority.backup
sudo service lightdm restart
My home folder was full :-( df -h
will give you this answer I had to connect through ssh made some space and worked like a flower
ctrl+alt+F1, login as user, free up some space and restart your X server! mostely sudo service sddm restart