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

  • 26
    Look in ~/.xsession-errors; there might be a clue there.
    – offby1
    Apr 21 '12 at 23:09
  • 3
    I had the same problem and it was simple. My Virtualbox Lubuntu 16.04 had run out of disk space. I cleared some space and - Shazam! Back again.
    – Ignorante
    Sep 20 '16 at 16:03
  • 5
    I don't have enough reputation to answer, but what worked for me was following instructions here. In short do sudo ubuntu-drivers devices, and then sudo apt-get install the recommended driver.
    – kabdulla
    Apr 4 '17 at 7:05
  • 1
    after trying many ways, I found that the problem was because of installing indicator-multiload . With purging it my problem resolved. I can not answer so I write my experience as comment!! Jun 20 '18 at 4:30
  • 2
    Happened to me today, Ubuntu 18.04. If none of the answers here work, look at /var/log/syslogand check for any error that might relate to something you did recently. My issue was an error related to flatpak, which I've installed the day before but ended up not needing it. After uninstalling it, everything went back to normal.
    – dferrazm
    Jun 6 '19 at 10:00

49 Answers 49


Solved using these commands:

 sudo apt purge gdm3
 sudo reboot
 sudo apt install gdm3
 sudo service gdm start

I had the same problem after I upgraded to 12.10.Then I came here from Google. I created another user and I could login.

As I don't use Unity, I uninstalled lighdm. After reboot, I could login. You can try that.

Good luck!


I have been experiencing the very same problem a couple of times every week and have tried most of solutions given here but the only way I can log back in is by restarting lightdm.

sudo service lightdm restart.

The funny thing is that even after I restrat lightdm, it does not log in on the first attempt but only on my second attempt even though I am entering the right password. I realised this a few weeks ago and I have verified this a few times, making sure that I am not accidentally keying in my password wrong. I am now certain that it does not log me in the first time after restarting lightdm but only on the second attempt!

  • Today I got a clue about my problem. I have an external monitor connected to my laptop. When I got into the login loop I decided to somehow get it working with restarting lightdm. From a bug report in launchpad I got an idea that it could be due to some issue in recognising my external monitor. So, I disconnected the monitor, dropped to tty1 and back and the login worked the first time! Not the second time like when I restarted lightdm. This is better but there has to be a solution which does not require this.
    – eshwar
    Jul 18 '14 at 10:17

If the other questions do not lead to a solution, my suggestion is to try to follow these steps:

  1. Login in character mode with a VC (Virtual Console). That is, Ctrl Alt F1 and your username/password login. Let's call this user original.

  2. Create a new user. You can use for example:

    adduser newuser --group sudo

    to add a new administrative user (that is, a user that can do sudo).

  3. Try to login as newuser. If it works, you now that the problem is in the specific setup of original user. Otherwise, stop reading here --- the problem is at system level and you'll probably need to reinstall something of the graphic stack.

  4. Now you can try to search what happened. Compare hidden files in ~original and ~newuser and try to find mismatches. Especially you should search for files not owned by you:

    find . \! -user original

    and files that are not writable to you (there will be more of them, especially in caches):

    find . \! -perm -u=w
  5. You can move suspicious files to a backup (sudo mv whatever whatever-backup) and try to login again.

  6. Files in /tmp and /var that can be sensible to this problem should be deleted by a reboot --- but sometime there is some remnant over there, too.

As a last resort, you can backup the important info of original (not all the home dir! or you'll propagate the problem), and delete and recreate it, although it is better to be able to find where the problem is.


In my case the problem was caused by wrong permissions on my home directory.

1: Boot from a live media (or different linux distro installed on the same system) and open a terminal with Ctrl-Alt-T

2: Make a temporary mount point and Mount the partition that contains your /home (in my case it was /dev/sda6)

sudo mkdir /mnt/sda6 sudo mount /dev/sda6 /mnt/sda6

3: check permissions

sudo ls - la /mount/sda6/

you should see an entry username` where username is your username

From this point forward we will use the username tvbox (change this to your username)

You should see something like this:

drwxr-x--- 67 tvbox tvbox 12288 May 1 07:00 tvbox

This indicates that tvbox is a directory and the owner has the required read, write an execute permissions.

4: correct permissions if incorrect.

If the above is incorrect in any way we need to correct it.

If data was moved by root you will see root root rather than tvbox tvbox (owners name owners group) This could be referred to as the "root cause" ;-)

To fix this issue the command `sudo chown -R tvbox:tvbox /mount/sda6/tvbox

If somehow the other permissions aren't right you will need to modify them with sudo chmod +rwx tvbox adding read write and execute permissions.(the execute bit on a directory allows you to traverse it.)

5: reboot the problem OS

6: login

If this doesn't resolve your problem refer to the many other quality answers here.

  • It seems that Elder Geek's issue was caused by a user ID mismatch.This fixed it for me sudo chown -R NEWUSER:NEWUSER * sudo chown -R NEWUSER:NEWUSER .* # to include hidden files and directories For more details see askubuntu.com/questions/1230434/…
    – Christians
    May 3 '20 at 13:52

For me following worked. Type ctrl + alt + F1 and login with your username at command prompt.

user@dell$ ls -l ~/.ICEauthority
-rw------- root root 3668 May 28 09:28 /home/user/.ICEauthority
user@dell$ sudo chmod 777 ~/.ICEauthority
user@dell$ ls -l ~/.ICEauthority
-rwxrwxrwx root root 3668 May 28 09:28 /home/user/.ICEauthority

ctrl + alt + F7 and login worked.


I've experienced this issue on a Xenial installed on a usb key, mounted on a HD-less laptop, running unity and gnome-flashback. Tried about every workaround in here without success, then remembered that some days ago, while in chroot and using qemu, if I choose gnome-flashback-compiz I got the issue while with unity I didn't. Tried with gnome-flashback-metacity and it worked.

In this case too, it doesn't work with gnome-flashback-compiz but with gnome-flashback-metacity and with unity it worked.



In my case, my user folder somehow got chown'ed by root! The answer lies in .Xauthority and other files in your home folder; if user config data can't be opened read/write, lightdm will fail.

I simply ctrl+f1, logged in, then sudo chown /home/<userdir>, then sudo service lightdm restart (may not be necessary), and then I was able to get back in.

Some diagnostic messages would be more useful, but such is life with free software.


Regarding Gnome Users:

I tried all of these optionals to no avail. Likely due to using Gnome as my preferred UI.

After looking at Sooth's Answer I was able to get it to login with the ubuntu and xubuntu GUI, so his post helped a spark in my brain.

I didn't see anything related to Gnome, so I looked up some instections and followed this guide from OMG Ubuntu for Gnome 3.2 on Ubuntu 16.04.

I had Gnome working flawlessly so I have no clue what went wrong one day. It's a bit of a download and upgrades but this worked for me with Gnome and I'm happy without the login loop of death!


I found another way to cause a login loop not covered by any of these answers, yay me!

I had a script to set up my dual monitors that was referenced in /etc/lightdm/lightdm.conf as a session-setup-script. When I went to a single monitor config, I deleted the script, but did not remove the reference. Next time I booted up - login loop.

Examining the logfile in /var/log/lightdm/lightdm.log I found an explicit error message telling me the script was not found and therefore lightdm failed to start. Commenting out the reference in lightdm.conf fixed it.


After reading James answer , I realized I had changed the user password by logging in as root. I knew the old password, so I logged in as root again ( to login as root press ctrl+alt+F3 give the username as root and and enter your root password) and changed the password for that user to old one by below command

passwd <username>

Now change the password to old one , press ctrl+alt+F7 and login normally. This solution works only if you have encrypted home directory issue and incase you had changed password using root.


I had a similar issue recently. Ubuntu made some updates and i got this login-loop that seemed to be related to lightdm.

I finally managed to solve the issue after trying several things.

I suspect amdgpu to be the reason of failure but because i dont know for sure, i am going to post everything, that i tried:

Taken from my original question on askubuntu: See here

  1. uninstall amdgpu-pro (amdgpu-pro-uninstall)
  2. install the open source driver (see here). I also installed all those *hwe* packages.
  3. reinstall and reconfigure lightdm, ubuntu-dektop, unity

At this point - after rebooting - my keyboard would not respond anymore, so i booted into recovery mode and selected the option to repair broken packages, which worked and i could use my keyboard again.

Unfortunately the login still would not work. Additionally i added my user to the lightdm group, but i doubt that is of any importance.

Then i found other similar issues and tried the following steps:

# as root
add-apt-repository ppa:paulo-miguel-dias/pkppa
apt-get update
apt-get upgrade

Still no success so far, so i decieded to try another upgrade method

# as root
apt full-upgrade

And then i was able to login again.

My personal conclusion

It seems the problem exists within the amdgpu driver and ubuntu will not be able to install a working driver unless you add the ppa mentioned above. It says to work only with Ubuntu 18.04 but i tried it anyway and it worked for now.


Same problem on multiple RPIs (version 2B and 3). Solution:

  • check the .xsession-errors file: cat ~/.xsession-errors. Mine showed:

Xsession: X session started for pi at ****

Xsession: unable to start X session --- no "/home/pi/.xsession" file, no "/home/pi/.Xsession" file, no session managers, no window managers, and no terminal emulators found; aborting.

  • to solve this reinstall the following packages:
sudo apt-get install xserver-xorg-core xserver-xorg-input-all \
xserver-xorg-video-fbdev libx11-6 x11-common \
x11-utils x11-xkb-utils x11-xserver-utils xterm lightdm openbox

Source: https://www.raspberrypi.org/forums/viewtopic.php?t=154190

fyi: I used the RPIs before with auto-login and non-gui mode. Thus, I reinstalled lightdm and ended up at the login loop problem after switching to auto-login GUI mode (raspi-config).


If you cannot log in, the disk/partition of your home folder might be full.

To find out if your disk/partition is full: press Ctrl + Alt + F3, login and type df. You get information on the used disk space.


I'm sure nobody except someone with an extreme case of the issue will see this, but if you do... maybe this will help! :)

Adding to the current answers - and building off of them to a large extent, I have once or twice had the problem that files other than .Xauthority are owned by root for some reason. This can create login loops, problems with secondary monitors, and a host of other issues. To locate suspect files, run:

user@hostname:~$ find -user root

From there, you kind of have to fish around in the output and see if you can't locate something that looks unusual.

As a side note, it also shows if .Xauthority is owned by root...


In my case, this was caused by a newly installed software through the Software center (or whatever its called) called Brightness Control (Xrandr). So I logged into Ubuntu using Unity from the logging window and then I opened up the Software Center to uninstall it. After rebooting I could log into Ubuntu (Gnome).


There is another possible cause for this problem not covered in the other answers:

If your homefolder is encrypted and you changed the user password without changing the encryption password.

In this case when you login, your password will not be the same as the encryption password and your home folder cannot be loaded. As a result, your .Xauthority file will not be able to be loaded, and you won't even find it if you try to as suggested in @SiddharthaRT's and many others' answers.

(As a hint if you don't remember if your home folder was encrypted, if you do ls -lA you should see some files with "encrypt" in their name and a folder called .Private if your home folder was encrypted.)

You have two options:

  1. The easiest is to reinstate your old user password, using

    sudo passwd user

    where user is your username. Then you'll be able to login as normal again. However, if you changed your user password you probably have a reason for this, so the 2nd option is better.

  2. Rewrap (i.e. change) your encryption password, as explained here. Basically, to do this (assuming you have kept your new user password), mount your encrypted home folder as follows


    and then set the encryption password to the new password with

    ecryptfs-rewrap-passphrase ~/.ecryptfs/wrapped-passphrase

    Then everyting should be mounted as normal again.


GNOME-Shell extensions installed to user's profile were apparently causing the login-loop in case of Bionic Beaver installation here. User is able to again successfully login to its graphical environment not until removal of all of GNOME-Shell extensions installed to user profile. Found then removed from Bash had been ext-helper@amanda.darkdna.net and workspace-grid@mathematical.coffee.gmail.com.

I believe to had found that track by examining systemd journal, there was also a signal in web addressing Gnome shell extensions in this or close context.

Problems started to occur after installation of security and basic updates in calender week #3 of 2019. Actually no reconfiguration at system level was conducted by user that time.

Now two system-level GNOME-extensions are left because no way was found to uninstall them too. However these are set to disabled. Extensions' main switch is also put to OFF. Maybe middle or long term I will try to use extensions again, however by progressing with caution and in small steps.

Consequently none of hints found here could help as the underlying points were OK, e.g. ~/.XAuthority, ~/.ICEAuthority, /tmp directory, Nvidia stack. lightdm-based approach was undesired as in this case Ubuntu 18.04 is used which does not use lightdm as default. It is installation running in VmWare-hypervisor so the emulated graphic card is not from Nvidia. Those hints could not be applied too nor help. I was also unable to find in ~/xsession-errors directive hints.

I found Rmano's approach interesting and applied that which in consequence uncovered few other interesting points, these will be raised in new Questions. Also Rmano's hint contributed to success in this case. Thank you.

  • 3
    Thank you for giving an account of what you experienced ... but I don't see how it answers the original question.
    – PerlDuck
    Jan 27 '19 at 11:31
  • My Question raised one week ago or so was put by other members to duplicate of this one. You see zero commonalities?
    – Fifi Cek
    Jan 27 '19 at 12:36

I got into the login loop by running the software updater for 18.04 on Jan 30 2019. It was very hard to get into terminal mode per Ctrl+Alt+F1 or F2 or F3, succeeding typically only after a number of reboots. Getting into terminal mode per Ctrl+Alt+F3 became reliable only after installing lightdm and switching to that as suggested in the popular answer above. The other standard recipes (check ownership of .Xauthority and .ICEauthority and permissions of /tmp) were in order and mucking with the nvidia driver didn't help. After much googling I found Khalil Laleh's suggestion at Ubuntu 18.04 Login window loop to check your gnome extensions. Bingo! In my case Zakkak's workspace grid = 'workspace-grid@mathematical.coffee.gmail.com' in directory ~/.local/share/gnome-shell/extensions needed to be removed to make Ubuntu finally start up, and then reinstallation from https://extensions.gnome.org restored my workspace layout.


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