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.
Log in to the Shell
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.
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.
Check the Permissions of 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.
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.
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.
26 comments
Comments are closed.
“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.
Look for “linux login loop” and you’ll realize it’s not just a Ubuntu thing.
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.
.Xauthority is regenerated on each new login. You can just delete the old one instead of changing ownership or permission on it.
That’s great.
Try Ubuntu Mate. Traditional desktop. Community developed. And I at least have never had this problem.
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
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.
please be clearer. Do you actually use username:username or fill in your actual ubuntu username. Thanks for a good article
I trie the ls -lah command but
no File name .Xauthority appears
please help
I have seen this at least twice. If it is known and short of common issue why haven’t they psyched it by now?
Ctrl + Alt+F3 gets me to a login prompt but still no go logging in. What next?
Same problem here: when I’m entering the password, bum, login incorrect. Anyone knows how to fix this bug? Please help! :)
I reinstalled Ubuntu and all now good.
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.
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
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.
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.
Command sudo is available in /user/bin/sudo
Sudo: command not found?
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. :)
Thanks Man I had exactly the same problem
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!
Thanks for your blog. It really helps me. I finally realized that it’s the permission problem !
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.
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
After running all the command I am unable to get my graphical login screen..can you please help me?