Technical Anshu
Tutorials Blog

A login loop means authentication succeeded but the graphical session failed to start. The classic causes are a full root or home disk, wrong ownership on .Xauthority or the home folder itself (often after running graphical apps with sudo), a broken graphics driver, or a corrupted session file. Do not reinstall Ubuntu first - in most cases you can fix this in a TTY console in a few minutes without losing any files.

Ubuntu login screen · GDM
Correct password entered - screen flashes black and returns to the login screen, again and again.

X You are sure the password is correct - it is accepted, then rejected back to login

X Caps Lock and keyboard layout are already checked

X The same loop happens on every login attempt

X Logging in on a text console (TTY) still works

LOGIN LOOP  The session crashes on start. It is almost never a password problem - read the disk space and file ownership first.

The fingerprint of this problem: the password is accepted, the desktop never loads, and you land back at login.

Before you start: you will work from a TTY, so write down the commands. Press Ctrl + Alt + F3 on the login screen to open a text console and log in there. Press Ctrl + Alt + F1 or F2 to return to the graphical login.
1

Open a TTY and Check Disk Space First

A completely full disk is the number one cause: the session cannot write its temporary files, so it exits at once.

  1. Press Ctrl + Alt + F3, log in with your username and password (nothing shows while you type the password - that is normal).
  2. Run df -h and look at the line mounted on / and on /home if separate. If Use% shows 100%, free space before anything else.
  3. Free space safely: sudo apt clean, then sudo journalctl --vacuum-time=3d, and empty large downloads you no longer need.
  4. Reboot with sudo reboot and try logging in normally. If the disk was full, the loop is usually gone.
2

Fix Ownership of Your Home Folder and Xauthority Files ⭐

If any graphical program was ever run with sudo, files in your home can end up owned by root. The session then cannot read its own authority files and quits. ⭐

  1. In the TTY, run ls -la ~ | head -30 and check the owner column - files should be owned by your username, not root.
  2. Fix the two session files: sudo chown $USER:$USER ~/.Xauthority ~/.ICEauthority - if a file does not exist, that error is harmless.
  3. If many files are root-owned, repair the whole home folder: sudo chown -R $USER:$USER $HOME
  4. Also check free inodes if the disk looked odd: df -i - a full inode table causes the same loop.
  5. Reboot and log in. This step fixes the majority of loops that are not disk-full cases.
3

Check That Your Home Folder Itself Is Writable

If the home folder permissions were changed, the session cannot create its runtime files.

  1. In the TTY run ls -ld $HOME - the line should start with drwxr-x--- or drwxr-xr-x and show your username as owner.
  2. If it does not, restore sane permissions: chmod 750 $HOME
  3. Test a write: touch ~/test-write && rm ~/test-write && echo OK - if this fails, the filesystem may be read-only; note it and continue to Fix 5.
4

Test With a New User to Separate Account Damage From System Damage

This one test tells you whether your account is corrupted or the whole desktop is broken.

  1. Create a test account: sudo adduser testuser and set a simple password when asked.
  2. Reboot, and log in as testuser on the graphical screen.
  3. If the new user logs in fine, your original account has a broken session file - rename the suspects from the TTY: mv ~/.config ~/.config-backup and mv ~/.cache ~/.cache-backup, then try your own login again.
  4. If the new user also loops, the problem is system-wide - go to Fix 5.
5

Repair the Display Manager and Graphics Driver

Use this only when a new user also loops, or the loop started right after a driver install or upgrade.

  1. In the TTY, reinstall the login manager: sudo apt update && sudo apt install --reinstall gdm3 then sudo dpkg-reconfigure gdm3
  2. If an NVIDIA driver was installed just before the loop, return to the open driver to test: sudo ubuntu-drivers autoinstall after checking ubuntu-drivers devices, or remove the broken driver package you installed.
  3. Check the session log for the real error: cat ~/.xsession-errors - the last lines usually name the program that crashed the session.
  4. Avoid editing display-manager config files by hand until the log points at a specific line.
Do not do this: do not reinstall Ubuntu over the top as the first step - you risk your files for a problem that is usually one ownership fix. Do not run graphical programs with sudo (use sudo -H sparingly or a terminal editor instead), because that is what creates root-owned files in your home. And do not delete your whole home folder or .config without a backup copy - rename first, delete only after login works.

More PC Fixes on Technical Anshu

Every week: Windows problems, hidden tools and full setup guides, explained step by step.

Subscribe on YouTube

Frequently Asked Questions

Why does Ubuntu keep returning to the login screen after the correct password?

The password is accepted but the desktop session crashes as it starts. The most common causes are a 100 percent full disk, root-owned .Xauthority or home files after running graphical apps with sudo, a broken graphics driver, or a corrupted session config. Open a TTY with Ctrl Alt F3, run df -h, and fix ownership with sudo chown on .Xauthority and .ICEauthority.

How do I open a terminal when I cannot log in to Ubuntu?

On the login screen press Ctrl Alt F3 to switch to a TTY text console. Log in with your normal username and password - the password does not echo as you type. Run the commands there, then press Ctrl Alt F1 or F2 to return to the graphical login, or reboot with sudo reboot.

What is .Xauthority and why does it cause a login loop?

.Xauthority in your home folder holds the access token the graphical session needs to talk to the display server. If it becomes owned by root, usually after running a graphical program with sudo, your session cannot read it and exits instantly. Fix it with sudo chown $USER:$USER ~/.Xauthority ~/.ICEauthority and reboot.

Will fixing a login loop delete my files?

No. Checking disk space, fixing ownership, and testing with a new user do not delete personal files. Freeing space with sudo apt clean only removes downloaded package cache files. Only reinstalling Ubuntu or deleting folders would put files at risk, which is why this guide renames config folders to a backup instead of deleting them.

A new user can log in but my account cannot. What does that mean?

It means the system and graphics driver are fine and the damage is inside your own account - usually a broken file in .config or .cache. Rename those folders from a TTY with mv ~/.config ~/.config-backup, reboot, and log in. Ubuntu rebuilds fresh defaults, and you can copy back settings selectively from the backup.

Guide by Technical Anshu · Problem collected from Ask Ubuntu user reports of the Ubuntu login loop; solution written in original words and verified against Ubuntu and GNOME GDM documentation on TTY login, file ownership and display-manager recovery, verified on 11 November 2026. No matching long video exists on the channel for this exact fix, so this blog has no video section - the topic joins the fresh video-topic bank. No Shorts are linked in this blog.