vnc session show gray screen on ubuntu

user552285 picture user552285 · Nov 9, 2014 · Viewed 19.1k times · Source

I'm trying to install VNC server on Ubuntu 14 LTS. I installed the "vnc4server" package and started vncserver simply by: "vncserver" command line. (like: http://www.howtoforge.com/how-to-install-vnc-server-on-ubuntu-14.04)

i got the session and i am trying to connect to that via my vnc viewer but i see gray empty screen. how can i configure it in order to show normal desktop in the session?

Answer

rootcss picture rootcss · Oct 30, 2015

To fix this issue, first of all, check if you have any Desktop Environment (eg, Unity, Gnome, KDE, xfce, lxde etc) installed on your system. You may use: echo $DESKTOP_SESSION or you can verify from env.

In my case, I have installed LXDE on Ubuntu server. It is important now to find the exact executable path of lxde, which is /usr/bin/startlxde in my case.

Replace the content of your ~/.vnc/xstartup and paste following lines:

#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
export XKL_XMODMAP_DISABLE=1
/usr/bin/startlxde

Note: Above code is only valid for lxde.

Source (I have written a related post on my blog)