Why does VNC Server in Virtual Mode on Linux appear to hang, show a gray screen or not start at all?


You see a gray screen if the desktop environment of the remote computer requires capabilities that are not available to the X server built-in to VNC Server in Virtual Mode (Xvnc).

This is the case for the default desktop environments used by Ubuntu 13.04+ and CentOS/RHEL 7+.

Using VNC Connect 6.2+ on a Red Hat/CentOS computer?

From VNC Connect 6.2.0 onwards we recommend configuring VNC Server in Virtual Mode to work with the system Xorg server, rather than the outdated version built in to Xvnc. More desktop environments (such as Gnome 3), applications and extensions will likely be compatible out-of-the-box. See how to set this up.

Using VNC 5.x or VNC Connect 6.0-6.1, or on a different version of Linux?

We recommend you install one of the following desktop environments known to work with Xvnc:

Desktop environment Package name for Debian systems
Xfce xfce4
LXDE lxde
KDE Plasma Desktop  kde-plasma-desktop

In addition, older distributions which use Gnome 2 are also known to work well.

Each of the above should be easily installable on most Linux systems using the normal application installer. You can also do this from the command line using the package names mentioned in the table for Debian or Fedora-based systems - for other distributions you may need to search for the exact package name. There are also distributions which use these desktops by default (or example the Xubuntu, or Kubuntu "flavours" of Ubuntu).

If the desktop environment you've installed is not the default (for example, you've installed LXDE on a regular Ubuntu system), you will need to modify the xstartup script used by VNC Server to start your chosen desktop environment. Each desktop session should have a corresponding .desktop file in /usr/share/xsessions, which contains the command used to start the environment. You can use the following command to list the startup commands for all the available sessions installed on the system:

grep Exec= /usr/share/xsessions/*.desktop

Next, use a text editor to replace the existing xstartup script with the following template:

vncserver-virtual -kill $DISPLAY

This should be saved to ~/.vnc/xstartup, or /etc/vnc/xstartup.custom for all users on the system, and made executable using chmod +x.

Example for Xfce:

vncserver-virtual -kill $DISPLAY

Example for LXDE:

vncserver-virtual -kill $DISPLAY

Example for KDE Plasma Standard:

vncserver-virtual -kill $DISPLAY

Example for GNOME Classic:

env GNOME_SHELL_SESSION_MODE=classic gnome-session --session gnome-classic
vncserver-virtual -kill $DISPLAY


There is a known issue with the RENDER extension in current versions of Xvnc that causes problems with Xfce, resulting in the desktop failing to start. This can be resolved by disabling the RENDER extension; to do this, create /etc/vnc/config.custom (if it does not already exist) and add the command:

-extension RENDER

xstartup scripts and VNC Server 6.2.0+

Please be aware that VNC Server terminates when the xstartup script terminates. Therefore, it is recommended not to use an ampersand (&) to background processes started in this script if you are running VNC Server 6.2.0+.

Note: This is a change to the behaviour of previous versions of VNC Server which did require use of the ampersand (&). The change was introduced to allow the use of the built-in Xorg to support the Gnome desktop environment. See this article for more information.

So for example, from VNC Server 6.2.0+ use: 


and not:

startkde &

Was this article helpful?
25 out of 58 found this helpful



Article is closed for comments.