I'm trying to connect to Amazon EC2 Ubuntu 14.04 instance through VNC but always fail (only grey background). Some articles say we should have a line in .vnc/xstartup which reads exec sh /etc/X11/xinit/xinitrc But I checked this file and found that this file does not exist at all in EC2 Ubuntu. So if sh /etc/X11/xinit/xinitrc is executed, there should be an error like

sh: 0: Can't open  ...

I guess that this is the reason why I can not display the desktop of EC2 ubuntu from TightVNC (I can successfully connect). So my question is: is /etc/X11/xinit/xinitrc supposed not to exist? If so, what happens if the execution of sh /etc/X11/xinit/xinitrc fails? If it should exist, what contents should this file contain?

  • The file belongs to the xinit package, so you may want to install (or reinstall) xinit. – Gunnar Hjalmarsson Dec 21 '14 at 5:58
  • Yes, I have installed xinit package. I know that by running a command dpkg -l|grep xinit and seeing xinit in the results output. – user280121 Dec 21 '14 at 6:00
  • Then purge it and install it again to get /etc/X11/xinit/xinitrc. – Gunnar Hjalmarsson Dec 21 '14 at 6:02
  • @Gunnar Hjalmarsson: I did, no use. – user280121 Dec 21 '14 at 6:31
  • Strange. (I still posted an answer to clarify.) – Gunnar Hjalmarsson Dec 21 '14 at 6:42

If you have the xinit package, the file you mention should be installed.

$ dpkg -L xinit | grep xinitrc

If it's not, these commands ought to fix it:

sudo apt-get purge xinit
sudo apt-get install xinit
  • Thank you for the answer. I tried your method again, this time /etc/X11/xinit/xinitrc appeared, with a line ". /etc/X11/Xsession" in it. But I still only get a grey screen in the remote desktop when connecting. – user280121 Dec 21 '14 at 6:56
  • @user280121: Then the cause for the problem is something else. Can't help with that, I'm afraid. – Gunnar Hjalmarsson Dec 21 '14 at 8:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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