How to run vnc server on a headless ubuntu 16.04 without flashback GUI?
Unfortunately, it turns out that vncserver, tightvncserver and vnc4server sometimes has problems with gnome and Ubuntu desktop alone (e.g. top bar not displaying username and shell not activating), I tried a bunch of methods and it seems that the simplest solution (at least in the case of Ubuntu 16.04 LTS) is to use XFCE4 instead of gnome3, you can do this install by executing in terminal:
$ sudo apt-get install gnome-core xfce4 firefox nano -y --force-yes
You can then install Xfdashboard 0.4.0 on Xubuntu 16.04 with XFCE to get some nice extra functionalities by executing:
$ sudo add-apt-repository ppa:xubuntu-dev/extras
$ sudo apt-get install xfdashboard
Once all the new installation succeeds we have to edit the VNC xstartup file (~/.vnc/xstartup) to match the configuration given below so that it properly displays XCFE4. To do this, start by opening the file on an editor like NANO or VIM. Note: This file will only be created after you start a VNC session for the first time.
$ nano ~/.vnc/xstartup
Now edit the end of the file to match it with the below configuration.
#!/bin/sh
autocutsel -fork
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
startxfce4 &
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
Save the file by pressing ctrl + o and then pressing enter exit by pressing ctrl + x and then pressing enter.
Now you can launch the VNC session again,
$ vncserver -geometry 1680x1050 :1
it should all work and look better with the top bar icons
Related videos on Youtube
Dusan
Updated on September 18, 2022Comments
-
Dusan over 1 year
I have an Ubuntu 16.04 machine in the cloud which (obviously) doesn't have a monitor. I have installed multiple vnc software (tigervnc, vnc4server etc.) via ssh but none of them managed to give me full gnome/unity UI.
I usually get the dumbed down (2D) version like this
What I would like is full gnome/unity desktop. With Super key functionality and functional top bar.
I think that for this x11vnc is necessary but it requires some magic cookie which I don't know where to find, auth -guess doesn't work. I think I should create a dummy display but I have never done this.