Software & AppsOperating SystemLinux

How To Fix Login Loop in Ubuntu 18.04

Ubuntu 7

A common issue that Ubuntu 18.04 users face is getting stuck in a login loop. This is where you enter your password, the screen goes black, and then it returns you back to the login screen. This can be quite frustrating, but don’t worry, there are several ways to fix this issue.

Solution 1: Check .Xauthority and .ICEauthority files

The .Xauthority and .ICEauthority files are used to store credentials for X sessions. If these files have incorrect permissions or ownership, it can result in a login loop.

Steps to fix:

  1. Switch to a terminal: Press CTRL+ALT+F3 to switch to a terminal.
  2. Login: Enter your username and password to login.
  3. Check the ownership and permissions: Run the following commands to check the ownership and permissions of the .Xauthority and .ICEauthority files:
    ls -l ~/.Xauthority
    ls -l ~/.ICEauthority
    ls -ld ~
    The -l flag in the ls command is used to show the file or directory details in a list format. The ~ symbol represents the home directory of the current user.
  4. Fix the ownership and permissions: If the ownership or permissions are incorrect, you can fix them by running the following commands:
    sudo chown username:username ~/.Xauthority
    sudo chown username:username ~/.ICEauthority
    sudo chmod 644 ~/.Xauthority
    sudo chmod 644 ~/.ICEauthority
    Replace “username” with your actual username. The chown command is used to change the owner of the files, and the chmod command is used to change the file permissions. The 644 permission means that the owner can read and write the file, while others can only read it.
  5. Restart your system: Restart your system and try logging in again.

Solution 2: Reset ownership of home directory

If the ownership of your home directory is set to root, it can also result in a login loop.

Steps to fix:

  1. Switch to a terminal: Press CTRL+ALT+F3 to switch to a terminal.
  2. Login: Enter your username and password to login.
  3. Check the ownership: Run the following command to check the ownership of your home directory:
    ls -lh /home/
    The -lh flags in the ls command are used to show the file or directory details in a human-readable list format.
  4. Fix the ownership: If the ownership is set to root, you can fix it by running the following command:
    sudo chown username:username -R /home/username
    Replace “username” with your actual username. The -R flag in the chown command is used to change the owner of the directory and its contents recursively.
  5. Restart your system: Restart your system and try logging in again.

Solution 3: Disable Wayland

Wayland is a protocol that specifies the communication between a display server and its clients. If Wayland is causing the login loop, you can disable it.

Steps to fix:

  1. Switch to a terminal: Press CTRL+ALT+F3 to switch to a terminal.
  2. Login: Enter your username and password to login.
  3. Edit the GDM configuration file: Run the following command to edit the GDM configuration file:
    sudo nano /etc/gdm3/custom.conf
    nano is a command-line text editor. sudo is used to run the command with root privileges, and /etc/gdm3/custom.conf is the path of the GDM configuration file.
  4. Disable Wayland: Uncomment the line #WaylandEnable=false by removing the “#” symbol. This will disable Wayland.
  5. Save and exit: Press CTRL+O to save the changes, and CTRL+X to exit the editor.
  6. Restart your system: Restart your system and try logging in again.

If none of the above solutions work, you can try other solutions mentioned in the comments or refer to the Ubuntu gets stuck in a login loop thread for more possible solutions.

What is a login loop in Ubuntu 18.04?

A login loop in Ubuntu 18.04 is a situation where after entering the password, the screen goes black momentarily, and then the user is redirected back to the login screen without successfully logging in.

How can I fix a login loop in Ubuntu 18.04?

There are several solutions to fix a login loop in Ubuntu 18.04. You can try checking and fixing the ownership and permissions of the .Xauthority and .ICEauthority files, resetting the ownership of the home directory, or disabling Wayland.

Leave a Comment

Your email address will not be published. Required fields are marked *