Fix TightVNCServer not showing Unity menu & tool bars under Ubuntu 12.04



XTightVNCServer under Ubuntu 12.04 Precise Pangolin does not start correctly. Using the default settings on Ubuntu 12.04 the remote desktop session is not started properly when VNC Server is launched. A user connecting to VNC Server in Virtual Mode will see a desktop background but will not see any other desktop features such as the Unity toolbars or launcher. To fix this the xstartup file should be modified, here's how...


Backup the original ~/.vnc/xstartup:
cp ~/.vnc/xstartup ~/.vnc/xstartup.bak

Edit the xstartup file:
vi ~/.vnc/xstartup

Change the contents to:
#!/bin/sh
# VNC Server (Virtual-Mode) start-up script compatible with Ubuntu 12.04
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
#
if [ -f /usr/bin/gnome-session ]; then
      # Some gnome session types won't work with Xvnc, try to pick a sensible
      # default.

      for SESSION in "ubuntu-2d" "2d-gnome"; do
            if [ -f /usr/share/gnome-session/sessions/$SESSION.session ]; then
                  DESKTOP_SESSION=$SESSION; export DESKTOP_SESSION
                  GDMSESSION=$SESSION; export GDMSESSION
                  STARTUP="/usr/bin/gnome-session --session=$SESSION"; export STARTUP
            fi
      done
fi

if [ -x /etc/X11/Xsession ]; then /etc/X11/Xsession
      elif [ -x /etc/X11/xdm/Xsession ]; then /etc/X11/xdm/Xsession
      elif [ -x /etc/X11/xinit/Xsession ]; then /etc/X11/xinit/Xsession
      elif [ -x /etc/gdm/Xsession ]; then /etc/gdm/Xsession gnome-session
      elif [ -x /etc/kde/kdm/Xsession ]; then /etc/kde/kdm/Xsession
      elif [ -x /usr/dt/bin/Xsession ]; then
            XSTATION=1 DTXSERVERLOCATION=local /usr/dt/bin/Xsession
            elif [ -x /usr/dt/bin/dtsession ]; then /usr/dt/bin/dtsession
      else
      if which twm > /dev/null 2>&1; then
            xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
            twm
      else
            xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop"
      fi
fi
vncserver -kill $DISPLAY

Restart the VNC server and try connecting.

Source: http://kb.realvnc.com/questions/196/

5 comments:

Note: only a member of this blog may post a comment.