I installed Ubuntu 18.04 yesterday, done some app installation and configurations and went to sleep. This morning, the login simply didn't work: the system is unable to log into my session, even with the correct password. Every time I try it, it flashes the screen into black and purple, the mouse pointer is available, but it flashes back to the login screen again: no error message prompts and I spent quite some time amusing myself trying to win it by attrition =). I also tried switch over to Wayland, and the same result: screen flashes to black, couple of seconds later, I'm back at the login stage.

There is nothing wrong with my password, since I can log into my user account on the Terminal (CTRL+ALT+F1). Once there, I did a sudo apt update/upgrade in the hopes it'd fix something, but my system was up to date and it didn't solve anything after I rebooted.

I've seen a lot of similar reports on the internet and the only solution that it seemed worthwhile to my noobish eyes was removing/deleting the .Xauthority file. But when I tried it, the return I got was that there was no such file on my Home directory. The other solutions applied to people upgrading their systems - mine was a fresh install - or with pretty specific hardware and conditions that don't apply to me.

So, what should I do to fix this?

  • 2
    Possible duplicate of Ubuntu gets stuck in a login loop – Elder Geek Jul 25 '18 at 21:43
  • Did you find a solution for this? I have the same problem and the solution mentioned on the above link does not work for Ubuntu 18.04 – Sumit Sep 25 '18 at 6:37
  • Check again ls -l ~/.Xauthority ls -l ~/.ICEauthority ls -ld ~ – Vijay Oct 30 '18 at 15:35

15 Answers 15


I had the same problem.
Then I found out that I accidentally changed the ownership of my /home/username directory to root.

So you can go to the terminal by CTRL+ALT+F1, and change the username directory ownership with

sudo chown <username>:<username> -R /home/<username>
  • 1
    This saved me after a whole morning of headache, thank you! – FMM Apr 24 '19 at 10:06
  • How you accidentally changed your directory to root? – absentia May 3 '19 at 17:27
  • 1
    Same situation for me on Ubuntu 19. How did it happen? Likely me working with not enough sleep and doing a chown on the wrong folder. Fix was as shown above. – Peter Drinnan May 21 '19 at 2:37
  • I had the same problem. /home/user was owned by root:root instead of user:user thanks! – Sean McCarthy Dec 17 '19 at 0:20
  • Thanks, this solved one of my issue – MACMAN Nov 26 '20 at 5:51

I just spent WAAAY too much time solving this issue. What finally solved the issue was replacing the /usr/local/lib/libreadline.so.7 library with a link to /lib/x86_64-linux-gnu/libreadline.so.7

sudo mv /usr/local/lib/libreadline.so.7 /usr/local/lib/back.libreadline.so.7
sudo mv /usr/local/lib/libreadline.so   /usr/local/lib/back.libreadline.so
sudo ln -s /lib/x86_64-linux-gnu/libreadline.so.7  /usr/local/lib/libreadline.so.7
sudo ln -s /usr/local/lib/libreadline.so.7  /usr/local/lib/libreadline.so

A good indication that there was a problem was that gawk did not work because of the same missing external in libreadline with:

$ gawk
gawk: symbol lookup error: /usr/local/lib/libreadline.so.7: undefined symbol: UP

My ~/.Xauthority was fine, no amounts of updates made any difference. Right after my upgrade from to Ubuntu 18.04.1, my system would stop booting in the middle somewhere. I switched to lightdm from gdm3 with

sudo dpkg-reconfigure lightdm

and the system would boot but then I could not login.

I hope this can help somebody.


Login loop issues, type Ctrl+Alt+F3, at terminal login, if your password is correct, all is well, then at prompt type startx, then you see your desktop. The worked on two computers.

  • Although this didn't work for me, it helped me identify the issue. After startx, I couldn't login but I got to see the error log associated with my problem. In my case I didn't have enough storage on my home. – NimaAJ Oct 10 '19 at 7:09

I experienced this issu in debian I installed node.js and i added it into the path when i rebooted it takes me to a login loop I used to pass in CLI by Ctr Alt F2 and deleted the extra link i added to path Then i Ctr Alt F1 returned to GUI and authentificated normally


Experienced the same problem today for the first time since moving on to Beaver. Weirdly immediately post full wizard install.
Initially I thought it was a Wayland issue but despite attempts to force other compositors the issue remained until I cracked-open a Shell and removed my freshly created user /home folder. Upon the next initialisation of my chosen GDM I was shown the new user config wizard and all has been fine since.


I ended up solving this by disabling secure boot on my notebook. As I understand, my issue was caused by wonky Nvidia drivers.


I just faced this issue on my Ubuntu 18.04. Putting correct credentials, would flash a blank screen and go back to the login again.

So I Alt-Ctrl-F3 and tried almost all the answers from Ubuntu gets stuck in a login loop, none worked.

Then I decided to find any clue on /var/log/syslog. One of the errors popping up there would be related to flatpak, where a Permission Denied error was thrown when trying to read one of this package's file.

Then I remembered one of the things I did the day before was installing flatpak for some reason, but ended up not using it.

So I just apt purge flatpak && apt autoremove and logging in worked again.

HINT: check syslog for anything unusual and that might relate to something you did recently.


I installed Gnome Global Application Menu (HUD for Gnome) at the extensions.gnome.org website (already had Gnome Shell Extensions installed). The computer needed to restart. After the computer rebooted, it got stuck in a login loop with LightDM. (I have also installed Unity for 18.04.) I could enter the Unity version but not the Gnome or Wayland version.

Solution: If you can get to a command prompt (Ctrl+Alt+F1, to exit: Ctrl+Alt+F7), view the installed Gnome shell extensions with this:

ls ~/.local/share/gnome-shell/extensions

I disabled the nefarious extension (gnomeGlobalAppMenu@lestcape) with this:

gnome-shell-extension-tool -d gnomeGlobalAppMenu@lestcape

I was able to log in after this. I'm not certain, but it was probably conflicting with the Dash to Panel extension.


In my case, the issue was linked to my home directory beeing encrypted with ecryptfs, it seems.

I logged in to the console (Ctrl+Alt+F1), and installed ecryptfs-utils :

sudo apt-get install ecryptfs-utils

It solved the problem.


Are you using Xorg? Check the /var/log/Xorg.0.log first.

I ran into a similar issue. I saw a error message in the Xorg log complaining about a missing symbol drmModeListLessees. I searched this symbol in the libdrm libraries and didn't find it.

Then I downloaded libdrm-2.4.91 and installed the libdrm to overwrite the ones on the system. Finally the startx can work without any error.


I upgraded my Ubuntu 16.04 to 18.04.3 with the updater and thereafter it got into a login loop. I pressed ctrl+alt+F3/F4 to log into the console terminal and tried some of the suggested commands but in vain.

sudo apt-get -y install lightdm/gdm3
sudo apt-get -y install lubuntu-desktop
sudo reboot

also verified the owner and group of .Xauthority and /tmp

chown <username>:<username> .Xauthority
sudo chmod a+wt /tmp

reconfigured lightdm

dpkg-reconfigure lightdm
sudo service lightdm restart

and checked the log files with no errors.


To me, the only solution is to install a new 18.04.3. The following are my notes on how to save and restore user data during the reinstall.

  1. Insert a USB flash drive and find its drive with

    sudo fdisk -l | grep sd

    lsblk -l | grep sd

  2. Suppose the drive is /dev/sdb1, mount it to /mnt or /media

    sudo mount /dev/sdb1 /mnt

  3. cd to ~/Documents where the user data resides and tar it

    tar -cvf Ubuntu_16_04_Doc_Save.tar

    gzip Ubuntu_16_04_Doc_Save.tar

  4. cp or mv the resultant file to the USB drive

    mv Ubuntu_16_04_Doc_Save.tar.gz /mnt

  5. Insert a bootable Ubuntu 18.04.3 USB flash drive, reboot and hit F12 to select the USB boot option to install the Ubuntu.

  6. When finished, log in and verified it with

    lsb_release -a

    Description: Ubuntu 18.04.3 LTS

  7. Insert the saved USB drive and repeat steps 1 through 4 except to untar it.

  8. cd ~; rmdir Documents;

    mv /mnt/Ubuntu_16_04_Doc_Save.tar.gz .

    tar xvfz /mnt/Ubuntu_16_04_Doc_Save.tar.gz

Now we have restored the user data in ~/Documents.


For a fresh install if you get this error like I did and none of the recommendations worked such as renaming the .Xauthority file when you do not have one, the issue is with the Ubuntu installation step when you choose "Install 3rd party software". There is some software being installed that is causing the issue, at least in my case it was. I unchecked this option and when the installer finished, I rebooted and was able to log in.

I manually installed my GPU driver for Nvidia and all is well. Perhaps it's the version of the Nvidia driver that is being installed during the fresh install that is causing the issue? In any case, try this method and you should be ok. You just have to install 3rd party software on your own.


I upgraded the packages from my Ubuntu 18.04 yesterday and today I couldn't login anymore.

The solution for me was to deactivate Wayland in /etc/gdm3/custom.conf I uncommented the line WaylandEnable=false so that it looked like this.

I did this at the Recovery mode from the grub menu. To initiate grub, reboot and hold SHIFT key.

Note: LightDM is the display manager running in Ubuntu up to version 16.04 LTS but it has been replaced by GDM in later Ubuntu releases (https://wiki.ubuntu.com/LightDM).


For me, this problem was caused by not having the /bin directory in my PATH environment variable. I had edited the /home//.profile file, intending to add a location to my PATH when instead I accidentally replaced the PATH altogether. Removing the offending line allowed me to log in again.


This is due to the ownership on /home/username directory having been changed to root.

We can check this with ls -lh /home/:

$ ls -lh /home/

drwxr-xr-x 26 root root 4.0K Oct 26 19:08 username

To fix this, open a TTY window with CTRL+ALT+F2, and change the username directory ownership from root to username with the command:

sudo chown username:username -R /home/username

Check ls -lh /home/ again to verify the change was successful:

$ ls -lh /home/

drwxr-xr-x 26 username username 4.0K Oct 26 19:08 username

Press CTRL+ALT+F1 to leave the TTY and go back to your desktop.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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