453

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

  • 22
    Look in ~/.xsession-errors; there might be a clue there. – offby1 Apr 21 '12 at 23:09
  • @CalvinWahlers Since you installed Quantal, you couldn't start the system correctly? Have you installed drivers some? Could you connect from some TTY (Ctrl+Alt+F1..F6) with any user? – Lucio Nov 30 '12 at 2:13
  • no, it worked fin for I think month... But suddenly that happened – Calvin Wahlers Nov 30 '12 at 12:45
  • seems that I can't post an answer. I had a similar problem and after trying all workarounds mentioned here with no success, I found that my sessions where messed up in /usr/share/xsessions. Moved all files there to my /home dir (to have a copy) and tried to login using kdm (I use Kubuntu). To select kdm as login screen, I executed sudo dpkg-reconfigure lightdm and selected kdm. With kdm you can select a previous session or a default one. This was the way to go. – Ivan Ferrer Villa Feb 12 '14 at 21:40
  • 3
    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

45 Answers 45

1

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
1

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.

1

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
password:
user@dell$ ls -l ~/.ICEauthority
-rwxrwxrwx root root 3668 May 28 09:28 /home/user/.ICEauthority

ctrl + alt + F7 and login worked.

1

For me configuration of some packages was off, so running (after ctrl + alt + F3):

sudo dpkg --configure -a

fixed the problem.

0

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.

Silvia

0

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.

0

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!

0

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.

0

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.

0

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
reboot

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

# as root
apt full-upgrade
reboot

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.

0

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).

0

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 in 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.

  • 1
    Thank you for giving an account of what you experienced ... but I don't see how it answers the original question. – PerlDuck Jan 27 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 at 12:36
0

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.

0

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.

0

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...

protected by Community Jun 26 '13 at 13:55

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.