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 am trying to use vnc on ubuntu 13.04 but I am unable to get full desktop. SO far what I have got is a error message that says "Failed to load session ubuntu-2d", or a blank screen or a desktop background with no shortcut icons or a desktop background with only a terminal window and no icons, with different changes in code. I want to have a full desktop view with toolbars and launcher, for all the functionality I need. I have the xstartup file [ both for user and root ] as


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

But its showing only a blank screen and the error message. Any ideas how to solve this? Also I am running Ubuntu on my machine using Oracle VirtualBox, can that be a part of problem?

share|improve this question

3 Answers 3

gnome does not work right with vnc on ubuntu, even though I have never tried x11vnc, but I tried vnc4server with xfce4 session and it works

to install xfce4 on Ubuntu

# apt-get install gnome-core xfce4 firefox nano -y --force-yes

edit your xstartup file to this

# nano ~/.vnc/xstartup

with this content

startxfce4 &

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
share|improve this answer

I think you should be using x11vnc. I've tried vnc4server and tightvnc, neither worked well.

Difference between x11vnc and traditional Unix VNC. x11vnc interacts directly with physical displays.

Install x11vnc

sudo apt-get install x11vnc

Create VNC password

x11vnc -storepasswd

NOTE: defaults to ~/.vnc/passwd file. Alternatively, use vncpasswd or -storepasswd pass file Store password pass as the VNC password in the file file. Once the password is stored the program exits. Use the password via "-rfbauth file". If called with no arguments, "x11vnc -storepasswd", the user is prompted for a password and it is stored in the file ~/.vnc/passwd. Called with one argument, that will be the file to store the prompted password in.

Start x11vnc

# Start x11vnc using ~/.vnc/passwd
x11vnc -safer -forever -display :0 -rfbauth /home/terry/.vnc/passwd
# less output to stderr -q -quiet
# this does not eliminate all informational output, it only reduces it
x11vnc -safer -forever -display :0 -rfbauth /home/terry/.vnc/passwd -q
# eliminate all output
x11vnc -safer -forever -display :0 -rfbauth /home/terry/.vnc/passwd 2>/dev/null 1>2&

Change the VNC port to listen on


The VNC port to listen on (a LibVNCServer option), e.g. 5900, 5901, etc. If specified as "-rfbport PROMPT" then the x11vnc -gui is used to prompt the user to enter the port number.

x11vnc -rfbport 5901

This force x11vnc to use port 5901 (this is VNC display :1.)

If something else is using that port x11vnc will exit immediately. If you do not supply the -rfbport option, it will autoprobe starting at 5900 and work its way up to 5999 looking for a free port to listen on.

Send x11vnc to background

x11vnc -safer -forever -display :0 -rfbauth /home/terry/.vnc/passwd -bg

Go into the background after screen setup. Messages to stderr are lost unless -o logfile is used.

VNC password file

The option -rfbauth .vnc/passwd provides additional protection by requiring a VNC password for every VNC viewer that connects. The vncpasswd or storepasswd programs, or the x11vnc -storepasswd option can be used to create the password file. x11vnc also has the slightly less secure -passwdfile and -passwd XXXXX options to specify passwords.

share|improve this answer
thanks for the reply ... I tried this and it worked but i am getting like a desktop inside desktop making it unusable ... do you know why i am getting that? –  user176646 Jul 23 '13 at 22:14
Don't really understand "desktop inside desktop". Any screenshots? –  Terry Wang Jul 24 '13 at 1:13
here is the link to screenshot - postimg.org/image/p4v09hyzl –  user176646 Jul 24 '13 at 2:59
OMG, it's terrible. I noticed that you are running Unity, I have only tested x11vnc with GNOME and KDE 4, I don't use Unity. How doy you start x11vnc? Provide the command line. Also, make sure you turn of vino the VNC by default used by Ubuntu. –  Terry Wang Jul 24 '13 at 5:14
IS there a way to switch from unity to gnome or kde? –  user176646 Jul 25 '13 at 22:03

When launching the gnome-session and all else fails; as a fallback, use gnome-fallback! :)

"gnome-session --session=gnome-fallback &"

and you would at least get a desktop background to play with.

share|improve this answer

Your Answer


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.