My Ubuntu is stuck in a login loop when trying to enter my desktop. When I login, the screen gets black and soon after that the login screen comes back.
I saw this solution: solution
But when I tried the solution it didn't work for me, then i saw a comment
@Nacht DON'T run sudo with startx. Using sudo to run startx is exactly how the permissions of the Xauthority file can get screwed up like this. Run startx as your normal user and it should work. If it doesn't, check the ownership of the .Xauthority file to make sure it's not owned by root again.
It worked but when I restart the laptop it still refuses to login.
.xsession-errorsfile (tail ~/.xsession-errors)? it can sometimes provide a clue as to the cause – steeldriver Sep 28 '18 at 13:59PATH, similar to this previous question: another login loop problem – steeldriver Sep 28 '18 at 19:21~/.bash_loginisn't provided by default - you will need to check all the other places wherePATHmight be defined, starting from/etc/environment,/etc/profile, files in/etc/profile.d/,~/.profile,~/.bashrc– steeldriver Sep 28 '18 at 19:57