
How to Stop the Cycle While Logging Into Ubuntu How to End the Cycle During Ubuntu Login If you happen to be trapped in a login loop on Ubuntu Linux, use Ctrl+Alt+F3 to open a terminal and verify or take away the .Xauthority
file. If that does not work, ensuring root owns the /tmp
folder, reconfiguring gdm3
, and liberating up arduous drive house also can break you out of the loop.
The Ubuntu login loop is an irritating drawback that makes it not possible so that you can log in. We describe six completely different points that may trigger these habits and the best way to repair them.
What Is a Login Loop on Ubuntu?
The Ubuntu login loop is an issue that returns you to the login display screen as a substitute for logging you in and presenting you along with your desktop. It’s as in case your credentials are being rejected, however, that’s not the case. It’s simply not letting you in. Regardless that you’re undoubtedly typing within the appropriate consumer identity and password, you’ve bounced properly again to the login display screen.
Of all of the potential issues with a pc, not with the ability to log in is among the scariest. If you happen to can’t get in, how will you repair it? Fortunately, Linux offers us multiple methods to log in, and we are able to leverage that to our benefit in this situation.
Really, this drawback can occur to different distributions as effectively. It appears to have been tagged the “Ubuntu login loop” as a result of there’s impression that it’s reported on computer systems working Ubuntu extra continuously than on different distributions. I think that’s a result of there being extra computer systems working with Ubuntu Linux than every other distribution.
Test Possession of the.Xauthority File
This repair is just for individuals who’ve opted to run Ubuntu utilizing Xorg, reasonably than on Wayland, the brand new show server. A show server handles display screen drawing performance. Purposes discuss with the show server, and the show server writes to the display screen. It’s used to assemble what you see in graphical desktop surroundings.
Xorg was changed by Wayland because the default show server, however, you possibly can nonetheless log in to Ubuntu utilizing the Xorg server if you wish to or must. Some older purposes work higher with Xorg than they do with Wayland.
To log in to Ubuntu utilizing Xorg, click on the cogged wheel icon on the login display screen, and choose “Ubuntu on Xorg” from the menu.

This setting will persist throughout reboots. To return to utilizing Wayland, you’ll manually change this setting again to “Ubuntu.”
So, if you happen to’ve been utilizing Xorg and end up within the login loop, the very first thing to verify is the possession of the “.Xauthority” file—in case you have one. If you happen to don’t, skip this and the subsequent sections.
On the login display screen, press “Ctrl+Alt+F3” to open a terminal display screen.

Log in along with your ordinary username and password.

You probably have one, your “.Xauthority” file is a hidden file discovered in your house listing. We’ll search for one with the -a
(all) possibility, in order that ls
lists hidden records data.
ls -ahl .X*
On this laptop the file is current, however, it needs to be owned by the present consumer, not by the root. However, that’s an easy repair. We’ll use the chown command to set ourselves because of the proprietor. You’d substitute your individual consumer identity within the command, after all.
sudo chown dave:dave .Xauthority
ls

Checking with ls
reveals we’re the proprietor and group proprietor of the file.
You probably have a file known as “.ICEauthority”, be sure to be the proprietor of that file too. We didn’t have one on our check laptop. The format of the chown
command is similar:
sudo chown dave:dave .ICEauthority
Reboot by typing “reboot” and urgent Enter, and try to log in when your system’s again up.
Take away the . Xauthority File
If taking possession of the “.Xauthority” file didn’t work, attempt eradicating it and recreating it.
On the log in display screen, open a terminal window with “Ctrl+Alt+F3”, and use the rm
command to delete the file.
rm .Xauthority

Utilizing the startx
command to attempt to begin an X desktop session forces a brand new “.Xauthority” file to be created.
startx

Reboot and attempt to log in.
Test the Permissions on the /tmp Listing
Many processes use the “/tmp” listing to retailer non permanent recordsdata. If the permissions on the “/tmp” listing are tousled and turn out to be extra restrictive than they should be, these processes shall be adversely affected.
To verify this, we have to open a terminal display screen, and use ls
on the “/tmp” listing. So press Ctrl+Alt+F3 on the login display screen, and log in along with your ordinary credentials.
The “/tmp” listing needs to be owned by root. The basis consumer, the members of the basis group, and all different customers must have learn, write, and execute permissions in that listing. The one restriction is that folks within the others group—which on this case, is everybody however root and processes owned by root—can solely change (write and delete) recordsdata that they’ve created themselves.
cd /
ls -ahld tmp

We will see the permissions string for “/tmp” is drwxrwxrwt
and its proprietor and group proprietor are each “root.”
The permissions imply:
- d: It is a listing
- rwx: The proprietor has learn, write, and execute permissions.
- rwx: The group proprietor has learn, write, and execute permissions.
- rwt: All people else can learn, write, and execute recordsdata, however they will solely write to or delete recordsdata they’ve created themselves. The “t” is named a “sticky bit.”
If you happen to see something aside from this, use the chmod
command to set these permissions:
sudo chmod 1777 /tmp
ls -ahld tmp

As earlier than, reboot and attempt to log in.
Reconfiguring gdm3
Ubuntu makes use of gdm3 as its show supervisor. A show supervisor handles graphical login screens and graphical show servers. Typically forcing a refresh on gdm3 can treatment the login loop drawback.
Once more, on the login display screen, open a terminal window with “Ctrl+Alt+F3.”
We’re utilizing the dpkg-reconfigure
command to refresh gdm3. It ensures all required recordsdata are current and dependencies are met. It ought to depart gdm3 in the identical state as if it had simply been efficiently put in.
sudo dpkg-reconfigure gdm3

Reboot, log in, and see in case your situation has been solved.
Reinstalling gdm3
This course of purges gdm3 out of your laptop and re-installs it. It’s the long-handed approach of doing the earlier step. I’ve seen the earlier step work many occasions, but when it doesn’t, this often does.
sudo apt purge gdm3
sudo apt install gdm3

Give your laptop a reboot, and see if you happen to’ve mounted your drawback.
Checking Arduous Drive Free House
Operating out of arduous drive house has an analogous impact as not with the ability to create non permanent recordsdata. Even with the proper permissions on “/tmp”, in case you have no arduous drive house left, the system can not create recordsdata.
From the login display screen, open a terminal display screen as earlier than. we are able to use df
to verify on arduous drive capability and free house, and we are able to use du
to see what’s taking on the house. Our check machine had no points with free house, however that is what the output from the instructions will appear like.
Utilizing the -h
(human readable) possibility forces df
to make use of essentially the most applicable items for the figures it must show. It’s simpler than making an attempt to work in bytes.
df -h

The “Use%” column reveals the quantity of house used, expressed as a share. The “Used” and “Out there” columns are expressed in precise values.
The basis file system is mounted on “/dev/sda”, and 84 p.c of the capability of the drive has been used. That’s nothing to fret about, but when we had been investigating a tough drive that was exhibiting little or no house left, we might use du
to find what was taking on the house.
We’re going to make use of the -h
(human readable) and -s
(abstract) choices with du
, and we’re piping the output into type
. The choices we’re utilizing with type
are -h
(type human-readable values) and -r
(reverse type).
It will give us a sorted, descending listing with the biggest shoppers of arduous drive storage on the prime of the listing.
du -hs * | sort -hr

We will see that the “Footage” listing is by far the biggest wrongdoer. We will improve our du
command to look into the “Footage” listing. We’re additionally piping it via head
to point out us the 5 worst offenders.
du -hs ~/Pictures/* | sort -hr | head -5

Such a iterative probing permits us to establish the low-hanging fruit. Copying the largest directories to different inner drives or to exterior storage, after which deleting them from our dwelling listing, will unlock essentially the most arduous drive house.
When you’ve executed that—with regardless of the largest directories in your laptop occur to be—your system ought to allow you to log in.
Breaking Out of the Loop
The Ubuntu login loop is like being locked out of your individual dwelling. You’ve obtained the precise key, however the door nonetheless received’t open. Fortunately, with Linux there are different doorways we are able to use. And as soon as we’re in, we are able to attempt to determine what’s stopping the entrance door from working.