Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

Any help would be greatly appreciated. Thank you!!

share|improve this question

6 Answers 6

up vote 3 down vote accepted

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 &
share|improve this answer

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 &
share|improve this answer

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.

share|improve this answer

Replace xstartup with the following content fixed it. Seems the if statement is the only thing added. I just copied this from my company working Ubuntu box. And it works immediately for me like a charm. I have a blog post regarding VNC with vnc4server: how-to-setup-vnc-on-ubuntu-linux

#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
#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 &

if [ -r /etc/default/locale ]; then
. /etc/default/locale
export LANG LANGUAGE
fi

vncconfig -iconic -nowin &
. /etc/X11/Xsession
share|improve this answer

Is there a reason because of the security setting?

I have tightvnc on Ubuntu 14.04 and try to connect from Windows 7 from tightvnc viewer.

I have tried a lot for xstartup files over the internet to get the vnc working, both xwindows and gnome-desktop-fallback. But all I get is a grey blank screen.

I then tried the default ubuntu vnc server: vino. Very easy setup. But I cannot connect through tightvnc viewer because I get "No matching security types".

Following a post that sort of disabling the enctryption of vino, I can connect from tightvnc viewer and use my linux desktop.

http://www.libregeek.org/2014/04/29/getting-remote-access-work-ubuntu-14-04-vino/

I also tried vino through Windows Remote Desktop, grey blank desktop again.

So I am really, really confused..

share|improve this answer

I had the grey screen issue. When the event that triggered the problem occurred, I did not react proactively. But now, having fixed the problem, I know this can be an issue: password length.

I have run installations with passwd longer then 8. Don't know why, but it does happen. Others, not. The system tends to prompt you that passwords will be truncated to 8 characters. That is a signal. A good behavioural rule is stick with 8 and tunnel via SSH.

The moment the passwd was changed back to 8 characters, vnc was functioning as expected.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.