2

I can't log in to my ubuntu 12.04. Once I login I got returned back to the original screen after a trial to enable X11 Forwarding.

Can you help me with this.

3
  • Are you trying to login remotely? What did you do to try to enable X11 forwarding?
    – ish
    May 19, 2012 at 21:40
  • Does this only happen when trying to log in remotely? Or are you having this problem logging in locally as well? Mar 27, 2013 at 1:07
  • Check your .xsession-errors in your home directory, I found an error over there, fixed it, then I can login from desktop. I did try to change the permission and ownership of .Xauthority but it doesn't help in my case.
    – user288195
    Jun 3, 2014 at 23:25

9 Answers 9

7

I haven't tried to enable X11Forwarding, but I used to have the same problem. You can fix this in a few steps:

  • When you get to the graphical login screen, hit Ctrl+Alt+F2, thus you get to a textual login.
  • Put in your name and password (password is not displayed when you type, neither as stars or bullets).
  • Type sudo apt-get install gdm and hit enter, give your password and wait to get a line ending with a dollar sign again.
  • Type sudo dpkg-reconfigure gdm.
  • Hit Enter at the first screen.
  • Select gdm in the list you get in the second screen with the arrow keys.
  • Hit the Tab button (above the caps lock one). Now you see the word Ok highlighted. Hit Enter.
  • Type sudo reboot and hit enter. You'll get another graphical login screen, but you'll be able to log in!

P.S.:

  1. If you are used to running some programs like ifconfig or others which are administrative ones from a terminal emulator (e.g. gnome-terminal) you'd better add a line like PATH="$PATH:/sbin:/usr/sbin" at the end of the .bashrc file in your home directory. You can do it with echo 'PATH="$PATH:/sbin:/usr/sbin"' >> ~/.bashrc.

  2. If you want to change back to the other graphical login screen from time to time and see if it was bug-fixed and it works again you can run sudo dpkg-reconfigure gdm and select lightdm and reboot (doesn't look like it works if you just run sudo pkill X).

6

I encountered the same issue after installing package vnc4server in Ubuntu 12.10. (Maybe it sets up X11 forwarding, not sure.) I found that in my home directory, files .Xauthority, .bash_history and folder .vnc were all owned by user root and group root. Changing them (and all files underneath .vnc) to be owned by my own user with the chown command allowed me to login (I rebooted first).

To make these corrections, either ssh into the box from elsewhere or switch to text console with Ctrl+Alt+F2.

1
  • I had just ~/.Xauthority as root owner. Thank you a lot! Jun 18, 2019 at 10:04
4

I found out my problem was related to a messy package repository. I updated my repositories and reinstalled ubuntu-desktop:

  • Log in to bash, (Ctrl+Alt+F1)

    sudo apt-get update

    sudo apt-get install --reinstall ubuntu-desktop

Solved.

1
  • I've tried the other solutions but did not work for me. This worked, thanks :-) Feb 13, 2014 at 18:40
0

This can happen if there is an error in your .bashrc or .profile file. From the graphical login screen hit Ctrl+Alt+F2 and login from there. Fix any errors that you see printed to the console. Type: sudo reboot

2
  • Can you elaborate on this?
    – nanofarad
    Oct 17, 2012 at 22:26
  • .bashrc isn't sourced from a login shell like the one you get from the TTY console. Oct 18, 2012 at 6:03
0

Had the same problem when I accidentally used:

sudo apt-get autoremove

I found that it had removed ubuntu-desktop for some reason. You can try Ctrl+Alt+F1 and use the following command:

sudo apt-get install ubuntu-desktop

After it has finished, press Ctrl+Alt+F7 and login as usual. Mine was still lacking the Restart and User accounts buttons on the panel; for that, go to terminal and use:

unity --reset

Solved my problem.

0

Check your .xsession-errors file in the home dir for any errors after logging in via CTRL+ALT+F1

In my case, .xsession-errors showed an error saying I had bad characters in my .profile file from my git installation(human error.. my bad)

After I fixed the error in my .profile file, I was able to login via the login GUI

Comment #18 at the below link helped me. https://answers.launchpad.net/ubuntu/+source/lightdm/+question/197479

0

My problem was that somehow due to manipulations with SSD, permissions of /tmp were messed up and I found on some Ubuntu forum this solution which helped me:

chmod 777 /tmp
chmod +t /tmp
sudo chown root:root /tmp
0

It has happened to me a couple of times and each time I restarted the Display Manager and could log in.

Drop to tty1 with Ctrl-Alt-F1.

sudo service lightdm restart

-1

Log in to bash, (Ctrl+Alt+F1)

$passwd
$newpasswd
$newpasswd

You are good to go now! that's what solved my issue.

You must log in to answer this question.

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