VNC grey screen and start on boot 12.04

I have 12.04 LTS installed and I am trying to get VNC to work. I want to be able to connect to existing sessions, and have it start on boot. I followed this guide and have left a comment to try and fix my problems but no dice. I have also tried all solutions I have found on google, including the one here, but I could not get it to work (I am missing something easy I am sure).

When I connect to the VNC session I get a grey screen with three checkboxes:

  • Accept clipboard from viewers
  • Send clipboard to viewers
  • Send primary selection to viewers

Here is my xstartup:

#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
gnome-session -session=gnome-classic &

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &

I have also edited my to include:

/usr/bin/vncserver -geometry 1024x768

It does not start on boot, but when I run the command it starts, but I get the grey screen.


Solution 1:

Check for solution on this link

Alternatively you can edit xstartup file located in your home folder by running sudo vi .vnc/xstartup from the terminal.

#!/bin/sh
# Uncomment the following two lines for normal desktop:

unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc

gnome-session --session=gnome-classic &
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

xsetroot -solid grey
vncconfig -iconic &

#x-terminal-emulator -geometry 1280x1024+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &

Solution 2:

There are a number of things which can cause the grey screen problem. Your best bet is to look at the log file in .vnc to see what the error is. The log file name is hostName:display#.log, for example, on my machine, whose name is "golden", it was golden:1.log.

In my case the ./vnc/xstartup file did not have the right permissions, so chmod +x ./vnc/xstartup fixed the problem. I could have fiddled with the contents of xstartup until the cows came home and it wouldn't have helped.

Solution 3:

I was also looking around the net for a solution for the same problem and I found many ways people were suggesting but none seem to help me, until I found while tinkering with the .vnc/xstartup file by moving the gnome-session --session=gnome-classic & to the end of the file worked for me. Please see my working .vnc/xstartup file; note that I also added a second unset line due to I was getting a dbus error and I found that line while googling and at the very end there is a unity desktop session for those who prefer a default Ubuntu look. Hope it helps!

 #!/bin/sh

 # Uncomment the following two lines for normal desktop:

unset SESSION_MANAGER

unset DBUS_SESSION_BUS_ADDRESS

 # exec /etc/X11/xinit/xinitrc


[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

 xsetroot -solid grey

 vncconfig -iconic &

 # x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

 # x-window-manager &

 gnome-session --session=gnome-classic &

 # gnome-session --session=ubuntu-2d &