If you are facing the ubuntu login loop issue which keeps on prompting for credentials even after entering the correct password then you have landed on the right page! This is what the ubuntu login loop stands for. There are numerous causes of the ubuntu login loop. Sometimes it is due to updates, even some misconfiguration in the Ubuntu file system can trigger the login loop which makes you unable to access your user account via Ubuntu Login.
Here Are Some Possible Causes of Ubuntu Login loop:
1. Insufficient Disk Space (Root cause of Ubuntu login loop)
Ubuntu login manager requires some free space in the root partition, having Insufficient disk space in Ubuntu or Linux root directory is the main cause behind the Ubuntu login loop because every week Ubuntu Linux releases security updates and some of them include kernel updates as well. This could take a lot space depending upon the size of the root directory. So, It is advisable to delete the old kernel in order to free some space for the next updates.
Let us show you an example which gives you a clear idea about how Ubuntu login stuck occurs:
Suppose if you have 400mb space left in your root partition and ubuntu notifies you updates that need at least 450mb. Which means you need additional space. Although Ubuntu will still download updates the issues actually happen when ubuntu starts configuring every download package and at some point, it gets freeze because of insufficient space. Post which whenever you restart your Ubuntu Desktop, you will get stuck in a login loop.
2. Misconfiguration in Lightdm
Another cause of Ubuntu login loop is the misconfigured lightdm settings, Lightdm configurations are required for ubuntu login every time. If you think that lightdm has triggered the Infinite Login loop. Then you can make Fix it by typing below command:
Sudo dpkg reconfigure lightdm
3. Updates Crashed or Failed
Sometimes update failure can also cause the login loop error. While installing updates please make sure you have closed the unnecessary programs. Because Ubuntu takes huge resources while configuring updates. So have some patience while it gets completed. If somehow your updates actually got failed, you can re-run the update process before log out or else you can type in terminal:
sudo apt-get install -f
And press, Enter.
How to Fix Ubuntu Login Loop:
If somehow your Ubuntu Gets Stuck at login loop here’s what you need to do:
Method 1: Change Ownership of .Xauthority
The first and most preferable step is to change the ownership of .Xauthority file which is located in the home directory of root partition by default.
What is .Xauthority File in Linux?
.Xauthority is a file in Ubuntu/Linux used to carry out credentials in the form of cookies which are required at every time when X session starts or we can simply say that “Every login”.
Now starting from step 1 follow these steps:
STEP 1: Switch to Command Line Mode
As ubuntu login screen flashes, Type
Ctrl+Alt+F3 in order to switch to a command line window.
STEP 2: Login from your Credentials
There you will be asked about login credentials just type your username and password one by one and press enter.
STEP 3: Look for .Xauthority file
Once you successfully logged in via terminal then all need to do is to look at the file Ending with .Xauthority see below:
-rw------- 1 webwiks webwiks 72 Sep 11 11:59 .Xauthority
-rw------- 1 webwiks webwiks 8.1K Sep 11 12:14 .xsession-errors
-rw------- 1 webwiks webwiks 7.0K Sep 11 11:57 .xsession-errors.old
Now, you need to take ownership of .Xauthority for that you need to use the “chown” command, for that type:
chown username:username .Xauthority
After successful execution, Press Enter and Reboot. Your Ubuntu login loop will be fixed.
Method 2: Re-install Lightdm
You can also fix the login loop error by resetting the settings of lightdm for that you have to reinstall lightdm by using the below commands one by one.
sudo apt-get purge lightdm or
sudo apt-get remove lightdm
sudo apt-get install lightdm
Note: While installing lightdm from command line mode (specially when you could not log in to GUI) please make sure you have an active wired connection as ubuntu packages may require internet access.