Few things can make you panic faster than logging into your computer and being denied access. Click on your username. You enter your password. You hit enter and… nothing.
Unfortunately, this kind of experience is more common with Ubuntu than you might think. The good news is that this problem isn’t too difficult to fix when you know what to do. If your Ubuntu system is stuck in a login loop, follow along, and we’ll have you back up and running in no time.
Go to terminal from ubuntu login screen
The first thing you need to do is get out of the graphical login screen and into a terminal. To do this, boot your system normally and wait for the login screen to appear. From the login screen, press Ctrl+Alt+F3.
Some laptops use function keys for things like setting screen brightness or sound volume. On these machines, you may need to hold down another key to make your F3 key act as a function key, not a volume control or whatever it may be doing.
For example, Dell laptops have a key labeled Fn. On these machines you have to press Fn + Ctrl + Alt + F3 simultaneously.
Pressing this key combination will take you to a terminal screen with a prompt to log in. Log in with your username and password, and you’ll be at a command prompt in your home directory. You can enter commands here just as you would in the Terminal app from your desktop.
We recommend that you try each of the following possibilities to resolve the Ubuntu login loop issue.
1. Check Ownership Settings for Configuration Files
One of the most common reasons behind Ubuntu login loops is incorrect file ownership settings on one or two files that help control the login screen on some systems. They exist as hidden files in your home directory.
At the end of the listing, look for a file named .Xauthority. This file may not exist on your system. If there is no file named .Xauthority, skip to the next suggestion. If the .Xauthority file exists, look at the owner and group of the file. These two attributes appear to the left of the file name and size.
In the image above, they are highlighted and both are set to root. If this file exists on your system and shows up as owned by root, then that’s going to be your problem. You must own the file, not the original user.
Of course, you should enter the command and replace “username” with your actual username. Be sure to enter the command as shown. Note the colon between the two usernames, the dot at the beginning of the file name, and the capital X.
When done, list the directory again, and File Owner should now be your username.
If the .Xauthority file is set up correctly, look further up the directory listing to see if a file named .ICEauthority exists. If you see this file, check its owner as well. If the owner is set to root (or a name other than your username), use the same command shown above to correct the ownership settings; Just change .Xauthority to .ICEauthority in the aforesaid command.
2. Check permission settings on /tmp directory
Another common issue that can cause login loop issues is incorrect permission settings on the system’s /tmp directory. This directory holds all kinds of temporary files and can wreak havoc when system processes can’t access their files.
The /tmp directory should appear near the end of the list. Here, you want to look at the string of letters in the leftmost column of the directory listing. They represent the permissions for the directory.
3. Check Available Free Space
Another common reason for unexpected behavior is running out of space on your hard drive. When your system can’t write to the hard drive it will do all kinds of weird things.
This will show you the space used and available on the drive that holds your home directory. If there is less than three or four gigabytes of free space, you should look for files to delete. Your Downloads directory is probably a good place to start.
If the results of this command show that there is no free space left on any device, you’ll need to figure out how to delete some files from that device or increase the partition size to open up more space.
4. Delete and reinstall your desktop environment
If all else fails, as a last resort, you can try to remove and reinstall the Ubuntu desktop environment (including GDM). This may take a while to complete, but you only need to enter a few commands.