Ubuntu 9.04 remote desktop using vncserver without monitor

Only few more days for Ubuntu team to release 9.04 but I couldn’t wait so I downloaded RC version and installed on torrent download server πŸ˜‰ . The task is to install the ubuntu 9.04 RC and to completely manage the server remotely. The installation was completely smooth and there was no issues. The installation completely detected all the hardware and everything worked perfectly like a dream come true.

Next step is to install secure shell ssh.

#sudo apt-get install ssh

Ubuntu comes with remote desktop manager. I tested the same and it would not work when there is no monitor connected to the system. I tried different methods and nothing worked out for me. So I decided to ditch the built in remote desktop and installed vncserver.

#sudo apt-get install vnc4server

After it is installed you should be logged as normal user and not root.

#vncserver :1 -geometry 1024x768 -depth 16

Once you issue the above command it will prompt for password. This password will be used for connecting to the server. Once it is complete we can change the setting for the server. Before we do that we have to kill the server.

#vncserver -kill :1

The configuration is kept in the file /home/userxx/.vnc/xstartup I edited this file so that I can start the server with gnome. My file looks exactly like below.

#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

gnome-session &

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

Now everything is done. All you have to do is to restart the system which is good for the setting to work properly. One you have restarted please start the vnc server.

#vncserver

I used chicken of the vnc to connect from mac.
chicken-of-the-vnc-connection-setup
After connecting you get gnome session which you can keep it alive even if the chicken vnc is closed.
gnome-session-using-remote-desktop
Now all set and I don’t want my server to start gnome session during boot. To avoid that I have to disable gdm server.
gnome-service-manager
That’s all folks have a nice day πŸ˜‰

Update: Amy Rinehart from remotedesktopmac.com has done a great comparison chart for remote desktop softwares.

By Imthiaz

Programmer, SAAS, CMS & CRM framework designer, Love Linux & Apple products, Currently addicted to mobile development & working @bluebeetle

26 comments

  1. How about that :-
    root@ServerU904:~# uname -a
    Linux ServerU904 2.6.28-11-server #41-Ubuntu SMP Wed Apr 8 05:29:01 UTC 2009 x86_64 GNU/Linux
    root@ServerU904:~# apt-get install vncserver
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Package vncserver is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    E: Package vncserver has no installation candidate

    Command which works:-

    root@ServerU904:~# apt-get install vnc4server
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Suggested packages:
    vnc-java
    The following NEW packages will be installed:
    vnc4server
    0 upgraded, 1 newly installed, 0 to remove and 12 not upgraded.
    Need to get 0B/1131kB of archives.
    After this operation, 2658kB of additional disk space will be used.
    Selecting previously deselected package vnc4server.
    (Reading database … 100387 files and directories currently installed.)
    Unpacking vnc4server (from …/vnc4server_4.1.1+xorg1.0.2-0ubuntu7_amd64.deb) …
    Processing triggers for man-db …
    Setting up vnc4server (4.1.1+xorg1.0.2-0ubuntu7) …

  2. I was also experiencing one more issue:-
    Editing xstartup as usual didn’t help. VNC connection just started only one X-term for me (?) and i had to issue /usr/bin/gnome-session in X-term to get real Gnome Desktop.
    P.S.
    Environment:-
    Ubuntu 0.04 Server (amd64) with Ubuntu Desktop installed via tasksel.

  3. Hi there, I tried to install vncserver, but got the following error with the same command you used, I was wondering if you had a similar issue or if it is new.

    bagside@bagvapp:~$ sudo apt-get install vncserver
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Package vncserver is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    E: Package vncserver has no installation candidate
    bagside@bagvapp:~$

  4. Hey SDRebel,

    have you tried updating?
    “sudo apt-get update”

    After you do that, you should be able to install VNC… *By the way, I used “sudo apt-get install vnc4server” which may also explain your error…

  5. Works like a charm! I have been looking for something like this, thanks!

    Do I need to start the vncserver manually after each reboot? Is there a way to do this automatically?

  6. Great! This worked like a charm. I’ve been trying to get this done for a long time now. The “easy” way (startx && gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled true) won’t work if there is no monitor; today I had to plug one in, so I thought I’ll have a look at the reconfigured xorg.conf and use the settings there when there is no screen plugged in, but that didn’t help either.

    Fortunately I found this post. I’m so happy πŸ˜€

    For those getting only an xterm after login to vncclient, try adding one more line at the end of ~/.vnc/xstartup:
    /usr/bin/gnome-session &

  7. I tried the solution, but my ubuntu system still hangs at the “low graphics error” when I boot headless. There are other options at startup like ” GNOME settings Daemon” , “GNOME Settings Daemon Helper” , “GNOME Keyring Daemon” . Should I disable these services too?
    if I need to boot up with a monitor later would I need to do any changes?

  8. Thanks!!! Worked great. stock ubuntu is a pos. ( plus im a linux noob ) anyway this plus putty tuneling will work great.

  9. Please help. I really tried my best to make this working, i followed all the instructions line by line.
    I also disabled apparmor (you never know…) but no goods.
    Client refuses to connect (error 10061, connection refused).
    The log file reports:
    Couldn’t open RGB_DB ‘/etc/X11/rgb’

    Xvnc Free Edition 4.1.1
    Copyright (C) 2002-2005 RealVNC Ltd.
    See http://www.realvnc.com for information on VNC.
    Underlying X server release 70000000, The X.Org Foundation

    Tue Oct 27 16:53:24 2009
    vncext: VNC extension running!
    vncext: Listening for VNC connections on port 5901
    vncext: created VNC server for screen 0
    error opening security policy file /etc/X11/xserver/SecurityPolicy
    Could not init font path element /usr/share/fonts/X11/TTF/, removing from list!
    Could not init font path element /usr/share/fonts/X11/OTF, removing from list!
    Could not init font path element /usr/share/fonts/X11/CID/, removing from list!
    xsetroot: unknown color “grey”
    /home/user/.vnc/xstartup: 13: twm: not found
    Xlib: extension “RANDR” missing on display “:1.0”.
    Xlib: extension “Generic Event Extension” missing on display “:1.0”.
    Xlib: extension “Generic Event Extension” missing on display “:1.0”.
    Xlib: extension “Generic Event Extension” missing on display “:1.0”.
    gnome-session[4253]: WARNING: Failed to acquire org.gnome.SessionManager

    what am i doing wrong ?

    thanks

  10. Hello!
    after doing above steps and rebooting server, in terminal i wrote vncserver and i can’t connect.
    log file as below, please advise! I am new to linux and need remote GUI, Thanks.
    Starting applications specified in /root/.vnc/xstartup
    Log file is /root/.vnc/d4:1.log

    root@d4:~# tail /root/.vnc/d4:1.log
    ** (gnome-panel:2962): DEBUG: Adding applet 13.
    Xlib: extension “RANDR” missing on display “:1.0”.
    Xlib: extension “Generic Event Extension” missing on display “:1.0”.
    Xlib: extension “Generic Event Extension” missing on display “:1.0”.
    Xlib: extension “Generic Event Extension” missing on display “:1.0”.
    evolution-alarm-notify-Message: Setting timeout for 11478 1256688000 1256676522
    evolution-alarm-notify-Message: Tue Oct 27 20:00:00 2009

    evolution-alarm-notify-Message: Tue Oct 27 16:48:42 2009

  11. after adding /usr/bin/gnome-session & to the end of xstartup, log file is as below
    root@d4:~# tail /root/.vnc/d4:1.log
    evolution-alarm-notify-Message: Setting timeout for 10681 1256688000 1256677319
    evolution-alarm-notify-Message: Setting timeout for 10681 1256688000 1256677319
    evolution-alarm-notify-Message: Tue Oct 27 20:00:00 2009

    evolution-alarm-notify-Message: Tue Oct 27 20:00:00 2009

    evolution-alarm-notify-Message: Tue Oct 27 17:01:59 2009

    evolution-alarm-notify-Message: Tue Oct 27 17:01:59 2009
    i thinks it must be working now , but i still can’t connect, i think it needs a confirmation from server
    i checked it in a near server and had this optoin :
    Ask you for confirmation: Select this
    option if you want remote users to ask you for confirmation when they want
    to share your session. This option enables you to be aware of other users
    who connect to your session. You can also decide what time is suitable for
    the remote user to connect to your session

    what is the code to remove this?

    thanks

  12. SDRebel,
    try this:
    apt-get update
    apt-get install vnc4server

    The above command you tried and didnt work was:
    bagside@bagvapp:~$ sudo apt-get install vncserver
    remmember the “4” between vnc_”AND”_server
    hope it helps

  13. I need help!

    I followed the steps you described and now everytime I log in to my computer all the programs that run on the startup are ran twice! It seems as if something in the steps messed up with the startup of the system! Help!

  14. It worked for me. I wanted my media center(xbmc on ubuntu) to have one more remote desktop. This helped me to create another one, which is different than the console, where TV is connected. Ubuntu’s remote desktop access using vnc provides the main TV screen, which is no use as that will be playing main movie, tv show etc. Access that output from network is useless as my output 1080p and getting that via vnc/network is stupid idea.

    Now only thing I missing her
    —-Rusian mentioned
    I followed the steps you described and now everytime I log in to my computer all the programs that run on the startup are ran twice! It seems as if something in the steps messed up with the startup of the system! Help!

    Also I want this to start automatically.

  15. If you use openvpn to connect to the server from remote, and then use VNC, you can create a very simple but effective secure server access, without using SSH, (which is not always desirable.) You can have several sessions open for several users. Just type vncserver after switching on your root user session to the user you want to grant access.

    So:
    Set up an openVPN access for every user you want to grant access (including yourself:) )
    start your VPN session, so you can acces your server by LAN-IP (192.168.2.5 for example could be your server IP)
    connect VNC to your local server LAN-IP address, (192.168.2.5:5900 or 192.168.2.5:5901, depending you have set the default VNC session to session 0 or session 1)
    in the console, switch to user X (sudo X)
    in the console, type “vncserver”, and it will open a VNC session for window #1 or #x.
    user X can now start a VNC session by connecting to 192.168.2.5:590x

    Done.
    Even several sessions at once for different users are possible now.

    TIP: You can use this technique also for looking with two persons at the same session. Ideal for explaining, tutorials or just working together in one session. Open your skype alongside, and there you go, you’re in one office.

  16. The only way I could possible log to gnome desktop with vnc was running the “vncserver” as root. If I try to use “vncserver” as any other user, it will just show the gray screen.

    Regards.

    JJ

Comments are closed.