35

After I log in to my user account on Ubuntu 13.04, I get automatically logged out after 1 second of black screen. This happens only with 1 specific user, and I can log in to another account fine.

What could have gone wrong? In which log files should I find my answer?

I installed a VNC server and turned on desktop sharing, and last time I could log in - maybe that is an issue. How can I disable it without GUI?

7
  • 1
    I installed gnome-shell and I could access my account from there, then I disabled desktop sharing and I logged out and logged in with Unity - it worked (either reconfiguring lightdm/gdm or disabling desktop sharing).
    – wajs
    Oct 28, 2013 at 12:40
  • most likely reconfiguring lightdm/gdm; this has been a solution on one of the questions here before. Just use gdm or another version of lightdm, for example lightdm-gtk-greeter Feb 7, 2015 at 16:07
  • As soon as I turned on desktop sharing this happened to me -- If I try to login with that user, I'm immediately logged back out. This is insane. Feb 7, 2016 at 6:22
  • 1
    This will also happen if you somehow inadvertently remove libssl from your system. Very obscure, but reinstalling it via package download resolved the issue (dpkg -i ...). I only discovered it chasing after another issue with wpa_supplicant not working. At least it told me libssl was missing.
    – Matt Borja
    Apr 8, 2016 at 20:53
  • 1
    Not sure why I can't add this as answer (I have 101 rep here because of other SE sites), so adding this as comment. I just had the same problem on 14.04 after a routine sudo apt-get update and upgrade followed by reboot. The problem was caused by proprietary AMD drivers not being compatible with my kernel (I think). The following solved it: sudo apt-get purge fglrx and sudo apt-get purge fglrx-\* and then reboot. Hope that helps someone!
    – EelkeSpaak
    Apr 14, 2016 at 15:25

10 Answers 10

26

I don't know if it would be exactly the same case, but this happened to me because somehow I corrupted the .Xautority file in my home. I think it's something related with remote access to the X server.

Log into a tty (Control+Alt+F6) and after typing your username and password:

sudo rm -v .Xauthority

The .Xauthority file is in /home/, which is where the terminal's default working path also usually is. If you use a tty to sign in as one user to delete another's .Xauthority file, make sure you've cd'd to the right directory first.

Then restart lightdm with:

sudo service lightdm restart

The sistem will recreate the .Xautority file.

7
  • 4
    Just for reference, it happened to me after I run sudo startx while logged in with the same profile user. Deleting it was enough.
    – user221931
    Apr 2, 2014 at 14:33
  • 1
    thank you so much, happened to me after a corrupt configuration of tightvnc
    – jansepke
    Aug 13, 2014 at 21:14
  • thanx, worked for me after badluck command service lightdm restart + overload my HDD and .Xautority file was damaged ! Jan 12, 2018 at 18:31
  • wow saved the day! Thanks mate, I hope my vnc setup still works though Feb 16, 2018 at 8:59
  • 1
    luckily I dumped up to this answer and who knows it saved me so many hours of struggle, hats off
    – Umair Ayub
    Sep 2, 2019 at 9:33
7

For me the immediately logout problem was caused by an error in ~/.profile. I am using 13.10. The (approximate) solution is found here or here. You can change or delete the file causing problems by pressing ctrl + alt + F6 and logging in that way.

1
  • (I am aware that this is not the problem @wajs has, but it might be useful for people looking for the symptoms in Google, where this question is in the top 3 results)
    – Mark
    Mar 17, 2014 at 6:47
2

What worked for me was reestablishing owner and group of the user's home directory.

In recovery mode (or CTRL+ALT+F6 at the login window):

sudo chown -R youruser:yourgroup /home/youruser

In many cases yourgroup = youruser.

(CTRL+ALT+F7 -> back to login window)

5
  • This might be dangerous - what will this command do?
    – Tim
    Jul 17, 2014 at 19:04
  • As with any action as root, proceed with caution. The OP installed a VNC server and turned on desktop sharing, which tells me they have root privileges. Because of the desktop sharing, some config files' ownership in the user's home folder may have been modified. @Tim, the chown command changes ownership of files and directories. The -R option changes ownership of all files and directories in the current directory, and all subdirectories (recursively).
    – Tony Rozza
    Jul 17, 2014 at 19:46
  • Changes the to what?
    – Tim
    Jul 17, 2014 at 21:02
  • This is exactly my issue. I had user with name of "anton" for example in my home partition. Then I re-installed ubuntu on the root partition and mounted home again. The user of new system was named "anton" and system didn't created new folder for this user and used the old one. So I had to change owner of the old folder though the username was the same.
    – gorodezkiy
    Oct 23, 2015 at 0:14
  • @Tim changes to youruser:yourgroup in the example above.
    – gorodezkiy
    Oct 23, 2015 at 0:15
2

I had the exact same problem and this was fixed by deleting the newly made ~/.pam_environment file that I had made to modify my Path variable. I logged in to a tty via Ctrl+Alt+F6 to delete the file since I could not log in the regular way.

1

Reinstall unity, by using the following commands:

sudo apt-get update
sudo apt-get install --reinstall ubuntu-desktop
sudo apt-get install unity
1

I had this problem today, after entering the user password, it accepts it and appears to log in, but after a second it returns to login screen.

My root partition was out of space.

I clicked Control+Alt+F6 to get a command prompt and login from there, ran df -h and it shown / root partition was 100% used, I deleted some files from Downloads folder, rebooted the computer, then I was able to login.

0

I had this problem with 14.04 upgrading from 12.04. I fixed it by Alt+Ctrl+F1 then using sudo useradd <username> -m -s /bin/bash then sudo passwd <username> to give them a password. Restart and login as that new user. Give them admin. role. Copy files from old home admin user directory to new one. Optionally delete the old user.

Bit of a cludge but I have no idea what was causing the kickout at login and didn't have time to find out so this was quick and required minimal knowledge of command line.

0

I had this same issue, and I could not find any solution so I decided to install gnome3 instead of unity to sort of side-step the issue. Turns out there was an error in the initialization of dpkg service. I ran

sudo dpkg --configure -a
and it worked like a charm.

0

I had a similar problem and couldn't even log in using tty. I edited ~/.profile before a reboot and knew that was probably causing an error.

Take your Live USB an boot from it. Then you can just mount your home partition:

sudo mount /dev/sdXY /mnt

now you can navigate to your home directory:

cd /mnt/username/home

and from there you can edit whatever file is causing a problem.

0

/bin and /sbin removed from $PATH will cause this issue. To fix:

Control+Alt+F6 login /bin/sudo /bin/vim /etc/environment insert PATH="/bin:/sbin" save and exit vim /sbin/shutdown -r now you should now be able to login normally.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .