9

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.

10 Answers 10

3

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 &
2
  • What is any difference between accepted code and code in the question?
    – Dims
    Oct 15, 2015 at 16:59
  • @Dims this line has a double dash gnome-session --session=gnome-classic & before session Feb 25, 2016 at 9:06
3

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.

2

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 &
0

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
0

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.

0

In my case, all of my storage are full. Deleting files to have vacant space plus restarting the service fixed it. ( Really, I googled a lot, and then I realized, I used my VPS to download Windows 10 ISOs first from Microsoft, then SFTP-ed from there to my laptop)

0

I have ubuntu 12.04 LTS and had the same problem. I don't like the Unity look and feel, so have always login using the gnome-classic. Naturally, I want my vnc to have the same gnome-classic look and feel.

I tried various solutions from other posts, but either get the grey screen or the Unity DM. Finally, I tried the answer posted by gilatpr, and that worked for me with a very minor tweak. The logs indicated --session=gnome-classic & is unknown. So I tried -session=gnome-classic &, and that did the trick. Here's my xstartup. Thanks.

#!/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 -nowin &
# x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
# x-window-manager &

# . /etc/X11/Xsession
gnome-session --session=gnome-classic &
0

Just delete # from x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop and restart. It worked for me.

1
  • You should suggest an edit on the relevant post.
    – muru
    Feb 8, 2017 at 11:00
0

Try installing vino instead, e.g.

sudo apt-get install vino
export DISPLAY=:0.0
/usr/lib/vino/vino-server &

If you've got the following error when connecting with VNC client:

No matching security types!

then modify the security with gsettings:

gsettings set org.gnome.Vino require-encryption false

For more details, see: Getting Remote Access To Work On Ubuntu 14.04 With Vino.

-1

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 encryption of vino, I can connect from TightVNC viewer and use my Linux desktop.

See: Getting Remote Access To Work On Ubuntu 14.04 With Vino.

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

So I am really, really confused.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .