34

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?

ckhatton
  • 589
  • 1
  • 5
  • 14
wajs
  • 441
  • 1
  • 4
  • 4
  • 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 '13 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 – Sergiy Kolodyazhnyy Feb 07 '15 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. – BrainSlugs83 Feb 07 '16 at 06:22
  • 1
    This will also happen if you somehow inadvertently remove `libssl` from your system. Very obscure, but reinstalling it via [package download](https://packages.debian.org/sid/amd64/libssl1.0.2/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 08 '16 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 '16 at 15:25
  • Echoing @EelkeSpaak's answer, I had this problem after a routine update. I was able to login to a terminal by pressing `ctrl-alt-1`, then I noticed some xsession logs in my home directory `tail -n30 ~/.xsession-errors`. I had the error "extension "GLX" missing", which (by googling) eventually led me to flush out my video drivers with (in my case) `sudo apt purge nvidea-340`. – Aaron Jan 24 '18 at 15:05
  • My stupid problem showing the same symptoms was having a full disk… After logging into a tty, it was obvious quite quickly. – Mormegil Feb 10 '21 at 12:32

10 Answers10

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.

Michael Hoffmann
  • 3,565
  • 6
  • 16
  • 26
animaletdesequia
  • 8,306
  • 4
  • 26
  • 43
6

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.

Mark
  • 283
  • 2
  • 10
  • (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 '14 at 06: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)

Tony Rozza
  • 31
  • 2
  • This might be dangerous - what will this command do? – Tim Jul 17 '14 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 '14 at 19:46
  • Changes the to what? – Tim Jul 17 '14 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 '15 at 00:14
  • @Tim changes to `youruser:yourgroup` in the example above. – gorodezkiy Oct 23 '15 at 00: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.

David Foerster
  • 35,754
  • 55
  • 92
  • 145
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.

adrianTNT
  • 216
  • 2
  • 6
1

Reinstall unity, by using the following commands:

sudo apt-get update
sudo apt-get install --reinstall ubuntu-desktop
sudo apt-get install unity
v2r
  • 9,367
  • 11
  • 49
  • 52
user205988
  • 21
  • 2
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.

cheshire
  • 264
  • 2
  • 3
  • 9
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.

Philip Rego
  • 408
  • 1
  • 5
  • 19
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.

BuZZ-dEE
  • 13,993
  • 18
  • 63
  • 80
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.
Shmit
  • 1