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 you need to check is in 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. 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. Remember to replace username with your own username. 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.” 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.

Reinstall Your Desktop Environment

If you’re having absolutely zero luck in getting to your desktop and keep going back to the login screen even after you’ve tried all this stuff, you’re probably encountering issues with your display manager (the login screen you’re frustrated with) and the way it’s communicating with the desktop environment. To fix this, we’ll have to do something a little more drastic and perform a clean re-install of your desktop environment. Start by going back into the console or terminal mode and removing the DE package for your distro: If you installed another desktop environment alongside it, remove it as well (e.g., plasma-desktop). For now, don’t bother reinstalling those. We’ll only be getting back “ubuntu-desktop” during this process to make sure you reboot into the purest environment possible. To make this process more rigorous, we’ll need to operate with a fully updated and clean system. Great! You should have a shiny, clean Ubuntu distro running no desktop environment at all by now. Now, install Ubuntu Desktop. Before you do anything else, remember to reboot: With any luck, one of these methods solved the problem, and you’re able to log in to Ubuntu as usual.

No, while testing login loop scenarios, the same problems appear in every other distro that is using the X11 server, and in some scenarios, even in Wayland. The suggestions in this article work perfectly for other distros as long as you keep in mind that they use different package managers and have different package names. For example, to reinstall a desktop in Arch, I’d do: The process is similar but the flags in the first command perform the duties Ubuntu would with a few others.

2. How do I prevent this issue?

The best way to prevent system breakages is to make consistent updates and backup. One of my favorite tools to do this with is timeshift. Installing this application makes you capable of performing powerful incremental backups of your system that work in a similar way to how Windows’ System Restore works (except it’s faster!). To create a backup: To start the restoration wizard: To list your backups: It’s very simple to use, even for people who are just starting to understand the terminal. If you can boot to desktop, you can also manage timeshift through its GUI application!

3. I am trying to get into terminal mode but keep getting my original login screen. What do I do?

This could be because your system for whatever reason decided to run your display manager on that particular TTY session. Each Ctrl + Alt + F-key combination takes you to a different session. Try a different function key in that combination.