Unity doesn't work on VNC server under 14.04 LTS

After upgrading to Ubuntu 14.04 LTS, I find the Unity destkop in vnc4server never works as it did under Ubuntu 12.04 LTS.

Here is my ~/.vnc/xstartup for vnc4server:

#!/bin/sh

xrdb $HOME/.Xresources
xsetroot -solid grey

/usr/bin/gnome-session &

That works fine starting Unity desktop on Ubuntu 12.04 LTS, but unfortunately on 14.04 LTS only a gray screen is seen in vncviewer.

I searched a little and find this article shows the way to start legacy gnome desktop (gnome-fallback) in vnc on 14.04, but what I want is the solution for a normal Unity desktop in vnc.

Has anyone successfully run Unity desktop in a vnc session (vnc4server, or any other vnc server) on Ubuntu 14.04 LTS?


Solution 1:

This Ask Ubuntu link shows the solution.

Install these packages:

apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal

Use this ~/.vnc/xstartup file:

#!/bin/sh

export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &

gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &

Solution 2:

For those using the gnome-fallback desktop environment, the proper xstartup file is:

#!/bin/sh

export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &

/usr/bin/autocutsel -s CLIPBOARD -fork

gnome-session --session=gnome-fallback --disable-acceleration-check &

For the clipboard sync to work correctly you also need to install autocutsel:

sudo apt-get install autocutsel

Don't forget to restart TightVNC Server:

vncserver -kill :1
vncserver

Good luck!