VNC Server in Virtual Mode does not start correctly on Ubuntu 12.04

来源:互联网 发布:linux中的ll是什么意思 编辑:程序博客网 时间:2024/05/21 04:16

http://kb.realvnc.com/questions/196/VNC+Server+in+Virtual+Mode+does+not+start+correctly+on+Ubuntu+12.04


Using the default settings on a 4.6.3 install on Ubuntu 12.04, the desktop is not started properly whenVNC Server in Virtual Mode  is launched.  A user connecting to VNC Server in Virtual Mode will see a backdrop and the VNC Server status window (without a title), but will not see any other desktop features such as toolbars or launcher.

The xstartup file should be created/modified as per below:

--------------------------------------------------

#!/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

--------------------------------------------------

Creating this file in ~/.vnc/xstartup and making the file executable should resolve the issue by launching a Unity session for VNC Server in Virtual Mode.  Alternatively, it can be copied to /etc/vnc/xstartup.custom and made executable to make it a system-wide default.