0

Let me put you in context, you see this is the third time I install ubuntu on my laptop (Asus Laptop, running NVDIA GTX 1050), althought this installation was different because I once for all removed the original Windows 10 that came with my Laptop.

My first attempts were on Ubuntu 18.04 LTS and were in a dual booting manner yet I did not had a great time, you see I ran into the login-loop problem twice!, some fellas of mine told me that the reason of it might have been because Ubuntu 18.04 was not the kindest with NVDIA graphics card, anyways I never knew exactly how did I got involved with the login loop problem and I never solved it even tho I did try many posible solutions.

6 months has passed since the last attempts and yesterday in my insanity I installed Ubuntu 19.10 for good throwing Windows away, since I heard that Ubuntu 19.10 fixed the problems with NVDIA graphics and so far I have no problems with it, Im actually happy and amazed, it runs so smoothly.

But deep inside im scared of the login loop curse that i have, does any of you guys know how to PREVENT the login loop from happening, what causes the login loop?

  • How do you know the question is simple? What if there are many possible reasons? How many do you want? – mikewhatever Nov 25 '19 at 20:41
  • You are right, I do not know, I just want to know what caused it or what might caused them? Any information is useful – Benjamin Gil Nov 25 '19 at 20:49
  • I can think of a dozen typical causes for the display server or desktop environment to crash, resulting in a "login loop". Each possible cause has, of course, it's own range of possible fixes. – user535733 Nov 25 '19 at 23:49

2 Answers2

0

One of the most common things that can cause a login loop is the use of sudo to start a graphic application... like:

sudo gedit filename

The way to prevent this is to use sudo -H... like:

sudo -H gedit filename.

See man sudo for more details about -H.

And because of this, what can happen is that these two files get changed to root ownership... and you get a login loop.

ls -al .*authority

-rw------- 1 username username 451352 Nov  2 13:34 .ICEauthority
-rw------- 1 username username     58 Jun 23  2017 .Xauthority

Then you would have to boot into Recovery Mode, and manually set the file ownership back to the proper username using the sudo chown command.

Update #1:

Instead of booting into Recovery Mode, an alternate way is you can simply go to another virtual console (e.g., Ctrl+Alt+F2 to go to tty2), log in there, run ls -l to see what files are affected, and then run whatever sudo chown ... command is appropriate.

heynnema
  • 70,711
  • 1
    There's no need to boot into recovery mode to fix this, because it doesn't affect non-graphical logins. One can simply go to another virtual console (e.g., Ctrl+Alt+F2 to go to tty2), log in there, run ls -l to see what files are affected, and then run whatever sudo chown ... command is appropriate. – Eliah Kagan Nov 26 '19 at 13:04
  • @EliahKagan thanks for the additional info. Are virtual consoles available at the login screen? I'll have to try that sometime when I have some kind of trouble. I'll add your quote in my answer. – heynnema Nov 26 '19 at 14:43
  • Yes. Virtual consoles are provided by the kernel. The GUI, if running, will be on one of them, in the sense that switching to it shows the GUI and switching away hides it. This works both at the greeter (login screen provided by a display manager) and while logged in to a desktop session. Switching from a GUI to the nth virtual console (ttyn) requires Ctrl+Alt+Fn; otherwise, Alt+Fn is enough. Usually not all virtual consoles have a terminal with a login prompt on them, but the first 6 or so usually do. – Eliah Kagan Nov 26 '19 at 16:07
-1

Changing the file /etc/fstab if you dont know exactly what you are doing would give you the login loop, if you're looking for causes, but I think you are more into preventing the login loop at all, and I think you can never know for sure. Don't be discouraged tho there is a way to avoid it and that is everytime you're going to touch some config file or system file, cp the file into a file.old and that way if you get the login loop you just have to press Ctrl+Alt+F3 in the login screen and revert the change you did using the shell.

Wonky
  • 331
  • What do you mean by system files, you mean does files that are outside of my /home/myusername folder. that being the case I should be carefull when I run commands like apt-upgrade or apt-install right ? – Benjamin Gil Nov 25 '19 at 21:28
  • Well apt-upgrade and apt-install wont hurt a thing, editing files outside your /home/username that is what I mean. Just be careful when using rm and nano/gedit on files. – Wonky Nov 25 '19 at 21:35
  • Okay, that makes sense, thank you!. – Benjamin Gil Nov 25 '19 at 21:46
  • I don't see how editing /etc/fstab can cause a login loop. – heynnema Nov 25 '19 at 23:45
  • @BenjaminGil I'm not sure I'd buy this. – heynnema Nov 25 '19 at 23:46
  • Well it was the only reason I've gotten login loop so far. I was trying to mount my lvm partition and got something wrong in the dump and pass syntax that caused the login loop, it was a nooby mistake but as new ubuntu user i though it was pretty common. I think if you read carefully the rest of my answer I gave an useful answer for a new user which is basically to make backups of files before editing giving a way to revert the changes in case he gets the login loop. – Wonky Nov 26 '19 at 00:10