Skip to content
  • Windows
  • Linux
  • Mac
  • Internet
  • Android
  • iOS
  • More
    • Hardware Guides
    • Chrome OS
    • Gadgets
    • How Things Work
    • Product Review
    • Smart Home
    • Gaming
  • About
    • About Us
    • Contact Us
    • Write For Us
    • Advertise with Us
    • Privacy Policy

How to Fix the Ubuntu Login Loop

By Nick Congleton / Dec 27, 2018 / Linux
Fix Ubuntu Boot Loop

One of the more common and arguably most frustrating bugs experienced by Ubuntu users is the login boot loop. When you try to log in to Ubuntu after starting up, you get taken right back around to the same login screen, and the process repeats indefinitely.

It might seem like you’re out of luck, but there are a couple of ways to break the loop. The most common cause is a strange permission issue with a file Ubuntu needs to start the graphical desktop. You can work your way around it by entering the command line shell and correcting the file permission. It’s a quick fix, and it works in most cases.

Related: How to Check for Available Memory in Ubuntu

Log in to the Shell

Ubuntu Login Screen

Start Ubuntu like you normally would. Let it get all the way to the login screen. When you get there, don’t sign in. Instead, press Ctrl + Alt+F3 on your keyboard. Ubuntu will drop out of the graphical login screen and into a black and white terminal.

Ubuntu Terminal Prompt

Enter your username in the prompt, then provide your password when asked. You’ll arrive in a familiar-looking terminal screen. You can navigate here exactly like you do in your graphical terminal windows.

Ubuntu Terminal Logged In

Check the Permissions of Xauthority

Ubuntu Lookup Xauthority

The file that you need to check is in the root of your “/home” folder. After logging in, you should already be there. The file is a hidden “dot file,” so you’re going to need to use the right flags when looking it up. Search using ls and grep in the following command.

ls -lah | grep -i Xauthority

You should see the file listed with the permissions first, followed by the username and group that own it. If you see “root” listed there, you’ve found the source of the problem.

Related: How to Take a Screenshot of the Login Screen in Linux

Change the Permissions of Xauthority

Now that you know what’s causing the problem, it’s time to set it right. Instead of root, your user and group should own that Xauthority file. You can change the ownership by running the chown command with sudo.

sudo chown username:username .Xauthority

That should go off without a hitch, so you’re ready to try logging in again. Press Ctrl + Alt + F7 to return to your normal login screen. Log in to Ubuntu!

Other Options

If that didn’t work or your Xresources file was owned by your regular user, you have a couple of other options to try. These aren’t necessarily guaranteed either, but they’re worth a try.

Change “/tmp” permissions

Sometimes the “/tmp” folder, which stores the temporary files your computer is working on, experiences the exact same issue as the Xauthority folder. The process of fixing it is very similar.

Ubuntu TMP Permissions

Go ahead and log in to the terminal again. Then, check the permissions of “/tmp.”

sudo ls -lah /tmp

You’re looking at the permissions for the top entry, the single “.” If they look like “drwxrwxrwt,” you’re okay. If not, you should reset them to that state with chmod and sudo.

sudo chmod 1777 /tmp

Change Display Manager

Finally, when all else fails, you can try switching your display manager. This was a much more common issue prior to Ubuntu 17.10 when it switched to GNOME and GDM for logins. Still, on some versions of Ubuntu LightDM is the standard. On the other hand, if you’re using GNOME and GDM, you can try LightDM. Log in to the terminal again. From there, install the display manager you want to try. During the install Ubuntu will ask you if you want to switch. Agree to this.

With any luck, one of these methods solved the problem, and you’re able to log in to Ubuntu as usual.

Nick Congleton Nick Congleton

Nick is a freelance tech. journalist, Linux enthusiast, and a long time PC gamer.

Is this article useful?
  • Facebook
  • Tweet

26 comments

  1. dragonmouth
    Dec 27, 2018 at 11:00 am

    “How to Fix the Ubuntu Login Loop”
    It’s not like Ubuntu is the only game in town like Windows. There are literally hundreds of other Linux distros that one can use that do not have this login problem. If Canonical is not capable or unwilling to fix this, they can keep their distro.

    1. Francoise Labelle
      Oct 17, 2019 at 6:55 am

      Look for “linux login loop” and you’ll realize it’s not just a Ubuntu thing.

  2. Nova
    Dec 28, 2018 at 2:14 am

    I have used every version of Ubuntu including the current 18.10 and never have I seen this happen on any device. I would say the user is at fault with messing something up.

  3. Jim Darkmagic
    Dec 28, 2018 at 6:29 am

    .Xauthority is regenerated on each new login. You can just delete the old one instead of changing ownership or permission on it.

    1. wenyu jiang
      Dec 31, 2018 at 9:32 pm

      That’s great.

  4. Jim
    Jan 1, 2019 at 2:49 am

    Try Ubuntu Mate. Traditional desktop. Community developed. And I at least have never had this problem.

    1. Patrice
      Sep 29, 2019 at 6:45 pm

      I just got this problem with Ubuntu-MATE 19.04 few minutes ago!
      This page (happily first on google when searching “Ubuntu 19.04 cannot login” save my day

      1. MobileJAD
        Nov 1, 2019 at 6:10 pm

        I came here after upgrading to Ubuntu 19.10, for me GDM3 failed and after typing my users password simply shot back to login, of course switching to alt-ctrl-f2 works, but randomly it would display the contents of my graphical desktop behind my terminal screen, almost taunting me with what I couldn’t graphically touch.
        Switching from GDM3 to LightDM got me my graphical desktop back.
        I use Ubuntu for my laptop and accessing my Steam account on the go, but now with how weird the ride has been with Ubuntu not knowing where they want to go with their distro, I might just switch to OpenSuSE.

  5. cmcanulty
    Jan 1, 2019 at 3:49 am

    please be clearer. Do you actually use username:username or fill in your actual ubuntu username. Thanks for a good article

  6. shubham
    Feb 14, 2019 at 11:36 pm

    I trie the ls -lah command but

    no File name .Xauthority appears

    please help

  7. Aaa
    Feb 22, 2019 at 4:36 am

    I have seen this at least twice. If it is known and short of common issue why haven’t they psyched it by now?

  8. habana
    Mar 2, 2019 at 2:54 am

    Ctrl + Alt+F3 gets me to a login prompt but still no go logging in. What next?

    1. alender
      May 15, 2019 at 12:36 am

      Same problem here: when I’m entering the password, bum, login incorrect. Anyone knows how to fix this bug? Please help! :)

      1. habana
        May 16, 2019 at 12:38 am

        I reinstalled Ubuntu and all now good.

  9. A. S.
    Apr 3, 2019 at 10:43 am

    I just had this bug on my device running ubuntu MATE. After trying the strategies described in this post I noticed that I get an error message about bash not being able to create temp files due to too little space. I uninstalled some software with apt and it worked. Might be worth trying if the other solutions weren’t any good.

    1. julia
      May 4, 2019 at 2:28 am

      How did you uninstall software if I may ask.. I have the same problem, but don’t know how to uninstall anything in the terminal and I don’t know what

      1. A. S.
        May 5, 2019 at 6:37 pm

        If you’re on Ubuntu or Mint the command:
        sudo apt remove (name of your package)
        should work. I’m not sure about other Linux distributions though.

    2. KR
      Jul 12, 2019 at 6:31 pm

      Same issue for me. The partition was actually out of space.
      I used “sudo apt-get autoremove” and uninstalled a few packages with “sudo apt-get uninstall “and was enough to get through the login screen.

  10. ebroo
    May 22, 2019 at 4:15 am

    Command sudo is available in /user/bin/sudo
    Sudo: command not found?

  11. NinjaKeks
    May 25, 2019 at 2:16 pm

    Nothing of this solutions worked for me.
    But after a few hours I got the idea.

    Try to think about which programs do you installed before your last reboot.
    Maybe one of this programs or libraries causes this login loop.
    In my fault I think the ‘indicator-multiload’ tool caused my login loop.
    However… After uninstalling it my Ubuntu login works perfect again. :)

    1. Emmanuel Balpe
      Aug 20, 2019 at 11:26 am

      Thanks Man I had exactly the same problem

  12. Haseeb Zulfiqar
    Jun 26, 2019 at 3:40 am

    I just had it stuck at the next screen when it should show the login prompt – it just showed a solid wine coloured screen (with a subtle Ubuntu at the bottom).

    I was using a virtual machine (VirtualBox) and the fix was to change the Display setting from VMSVGA to VBoxSVGA. Phew!

  13. JamesZBL
    Aug 9, 2019 at 7:31 am

    Thanks for your blog. It really helps me. I finally realized that it’s the permission problem !

  14. Juanje
    Sep 23, 2019 at 4:48 am

    Hi guys, for me it was an permission issue, $home was changed to own to root instead of my user, so I’ve changed the owner and it’s woarking again. It occurs after kubernetes installation.

  15. Max
    Sep 25, 2019 at 4:32 am

    I got the login loop after “Ubuntu Software Updater” updated some GPU libraries. I’ve fixed it by downgrading of all libraries.
    This answer helped me https://askubuntu.com/a/34908

  16. Radhika
    Nov 7, 2019 at 11:08 am

    After running all the command I am unable to get my graphical login screen..can you please help me?

Comments are closed.

Popular Posts

How to Run Bash Commands in the Background in Linux

5 of the Best Linux Distros for Windows Users in 2021

How to Set Up a Local Web Server (Windows, Mac, Linux)

The Beginner's Guide to Git

10 of the Best Launcher Docks for Linux

7 of the Best Linux System Cleaning Tools

How to Control Your Wi-Fi Network in Linux

How to Download, Install, and Configure Plank Dock in Ubuntu

How to Back Up Files to Google Drive on Linux

7 Linux Port Scanners for Admins and Enthusiasts

Affiliate Disclosure: Make Tech Easier may earn commission on products purchased through our links, which supports the work we do for our readers.

Never Miss Out

Receive update of our latest tutorials.

Privacy Policy

© 2021 Uqnic Network Pte Ltd.
All rights reserved.

  • About
  • Contact
  • Advertise
  • Write For Us
  • Terms of Use
  • Privacy Policy
  • RSS Feed Terms
Do not share my Personal Information