What to do when Linux Ubuntu gets stuck in a login loop. Here is how to fix the Ubuntu login loop. This is a common issue faced by many Ubuntu users during login. Let us see how to fix this.
How to Fix the Ubuntu Login Loop
Simply start Ubuntu like you normally do. When you see the login screen, don’t sign in. Instead, press Ctrl + Alt+F3 on your keyboard.
NOTE: Ubuntu will drop out of the GUI login screen and into a Terminal mode.
Enter your username in the terminal prompt and enter the password when asked. Now, run the following commands:
sudo apt update
sudo apt-get -y dist-upgrade
sudo apt-get -y autoremove
sudo apt-get -y clean
After executing the commands you will be able to login into Ubuntu successfully.
NOTE: To exit Command line, you can use keyboard shortcut that is CTRL+ALT+F2, to get back the Graphical User Interface.
Method 2 Change the Permissions of Xauthority
Run the command:
ls -lah | grep -i Xauthority
sudo chown username:username .Xauthority
Now press Ctrl + Alt + F7 to return to your normal login screen. Simply Log in to Ubuntu.
If that didn’t work try the other methods.
Method 3 Change “/tmp” permissions
Sometimes the “/tmp” folder also causes the issue. So to fix this, log in to the terminal again and run:
sudo ls -lah /tmp
If it looks like “drwxrwxrwt,” you’re all okay. If not, you will have to reset the permission uding chmod command.
sudo chmod 1777 /tmp
If this also does not work, go back to terminal (Ctrl+ALT+F3), login, and enter the following command:
sudo apt-get -y install lxdm
If lxdm is not selected, select it by using the UP and DOWN arrow keys and press ENTER. Then reboot using the command sudo reboot.