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

What happened

I wanted to install KDE and Gnome along with Unity. I don't know when I installed gnome-shell on my Ubuntu 12.10, but I installed KDE minimal desktop just now using

sudo apt-get install kde-plasma-desktop

and selected lightdm as my default DM. Then I entered this to install gnome

sudo apt-get install gnome-shell

and it said I already have it installed.

So, then I restarted in normal mode and Ubuntu didn't start.


I went to recovery mode and from root shell I used


it throws these bunch of errors:

/etc/X11/X is not executable
xinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: server error

and when I tried

chmod +x /etc/X11/X

it says

chmod: cannot operate on dangling symlink `/etc/X11/X'

I can't use apt-get to reinstall packages, because our ISP uses portal login - and I don't know how to login from terminal (so can't connect to network). May be I can use live disk, but I don't know how to configure packages on my HD from livedisk.

I am on Windows 8 now. Any help regarding how can I get my desktop back is appreciated!

share|improve this question
Does /usr/bin/Xorg exist and is it executable? The error message says that the symlink from /etc/X11/X to /usr/bin/Xorg is broken. – Ed Manet Dec 26 '12 at 14:49
@EdManet: No. There is no folder or file with name xorg or Xorg in /usr/bin. I don't understand what went wrong? – Forbidden Overseer Dec 26 '12 at 18:17

you have to try this

 sudo dpkg-reconfigure -phigh xserver-xorg
share|improve this answer
It says: ln: failed to create symbolic link `/etc/X11/X': File exists – Forbidden Overseer Dec 26 '12 at 18:18
Try deleting the broken symlink first. rm /etc/X11/X – Ed Manet Dec 26 '12 at 23:07
deleted it and tried to startx. It says: X: cannot stat /etc/X11/X (No such file or directory), aborting. – Forbidden Overseer Dec 27 '12 at 7:12
@EdManet: I got it back working, somehow... I posted it as an answer. However, I don't feel that my answer is a perfect answer for this question. Seems like I broke xorg while installing those packages, but couldn't figure out what happened exactly but somehow got ubuntu working again. What do you guys think might have happened? and again, thanks for your help! – Forbidden Overseer Dec 27 '12 at 20:27
I got this after updating HWE, then cleaning package config from ubuntu-tweak. Thus --purge removes the link because xserver-xorg was replaced with xserver-xorg-lts-<release>. I've seen this both with precise with trusty HWE and trusty with utopic HWE. doing sudo dpkg-reconfigure -phigh xserver-xorg-lts-utopic fixed it – Sylwester Jun 22 '15 at 22:50
up vote 4 down vote accepted

I am writing an answer for my question, but actually I haven't figured out exactly what happened that gave rise to those errors.

I am assuming that the whole xorg itself broke and I got my desktop back by using a live disk and chrooting (yeah - had to do that as its hard to connect to internet from terminal and its lot more easier to connect to internet from live disk and copy resolv.conf from here to there).

So, after creating a live disk and in Try Ubuntu mode, I chrooted into old partitions (I followed the guide here) and did

apt-get update && apt-get upgrade
apt-get install -reinstall xserver-xorg
apt-get install -reinstall gdm gnome-desktop-environment xorg

Then I changed my default display manager to gdm at /etc/X11/default-display-manager by changing this line (I think this step is not needed if after a restart your desktop is working fine, but I basically did a couple more things than said above and broke lightdm too, so I had to change to gdm... oops!)




and restarted. Well, unity is working and I got my desktop back working.

share|improve this answer
required a change on apt-get cli => apt-get install xserver-xorg --reinstall – Fiasco Labs Apr 11 at 20:35

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.