Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Are you trying to login remotely? What did you do to try to enable X11 forwarding? – izx May 19 '12 at 21:40
Does this only happen when trying to log in remotely? Or are you having this problem logging in locally as well? – Eliah Kagan Mar 27 '13 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 '14 at 23:25

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!


  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).

share|improve this answer

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.

share|improve this answer

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


share|improve this answer
I've tried the other solutions but did not work for me. This worked, thanks :-) – Feb 13 '14 at 18:40

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

share|improve this answer
Can you elaborate on this? – hexafraction Oct 17 '12 at 22:26
.bashrc isn't sourced from a login shell like the one you get from the TTY console. – Mark Paskal Oct 18 '12 at 6:03

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.

share|improve this answer

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.

share|improve this answer

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
share|improve this answer

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

share|improve this answer

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


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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.