Wednesday, June 13, 2007

Making vncserver work on Ubuntu

The VNC server on Ubuntu Edgy and Feisty is busted and that has been true for some time. However, the VNC server from Debian Etch works just fine on Ubuntu, with one simple work-around for font directory location. Here is how to get it working in Ubuntu Feisty:

  1. Download the latest vnc4-common package to your home directory via packages.debian.org.
  2. Download the latest vnc4-server package to your home directory via packages.debian.org
  3. Type the following at a command prompt:
    • cd /usr/X11R6/lib/X11
    • mkdir fonts note - don't worry if it says the directory already exists, that's okay.
    • cd fonts
    • mv encodings encodings- again, don't worry if it says encodings doesn't exist, that's okay.
    • ln -s /usr/share/fonts/X11/* .
    • cd
    • dpkg -i vnc4-common*.deb
    • dpkg -i vnc4server*.deb
    • apt-get install xvnc4viewer
  4. Run vnc4server the first time:
    • vnc4server -depth 16 -geometry 1024x768 :1
  5. If all went well, you should have been prompted for a new password to use for connecting to the vnc server, then it should have started. Connect to the vncserver to make sure it started up correctly:
    • xvnc4viewer localhost:1
  6. You should have gotten a window with a rather sparse twm configuration. (If not, check the log file that the vnc4server command created to see why not!). This probably isn't what you want. So edit the file ~/.vnc/xstartup to look something like this (make a copy of the file to another name first!):
    • #!/bin/sh

      export KDEHOME="${HOME}/.vnckde"
      xrdb $HOME/.Xresources
      vncconfig &
      startkde &

      # gnome-session vncsession &

  7. If you don't want a separate eyecandy-less KDE configuration for your VNC sessions (I have lots of memory and CPU thus I run my regular KDE with lotsa eye candy but that really doesn't travel well over the Internet), remove the KDEHOME line. If you want gnome rather than kde, comment out the startkde line and uncomment the gnome-session line. I also specify a vnc-specific session for the gnome-session line so that it will (hopefully) co-exist with a desktop gnome session.
  8. Now you're ready to test your new startup:
    • vnc4server -kill :1
    • vnc4server -depth 16 -geometry 1024x768 :1
    • xvnc4viewer localhost:1
You should now have a vnc viewer window with your choice of desktops. As long as you keep a VNC server running on your computer, you can now connect to your home computer from work (or vice versa) by setting up your firewall or gateway to forward port 5901 to the computer you wish to connect to, then running the xvnc4viewer or the Windows VNCviewer icon on the computer you're connecting from. This also makes a dandy way of accessing a real Linux desktop from a Windows computer in another room. The only real issue here is that neither Firefox nor Thunderbird much like the notion of you being logged in twice, and thus you can't leave a Firefox or Thunderbird open on the VNC desktop. No biggie, just use Konqueror or Epiphany as your web browser (depending on whether you're on Gnome or KDE) and use Evolution or kmail for your email.

Another issue: what to put for -geometry. I put 1024x768 but if you have a big screen on your client computer, you'll want to put something bigger (something smaller really doesn't work for a number of reasons to do with KDE and Gnome UI design). -depth 8 would be faster, but a number of programs will not work with that, thus -depth 16.

-- Badtux the Linux Penguin

14 comments:

  1. Really?

    Interesting.

    But I have no fucking idea what you are talking about.

    And frankly my dear, I don't give a damn because it will all change tomorrow.

    God, the I don't give a fuck computer user as long as what I have does what I want it to.

    ReplyDelete
  2. I hate hassles like you just described.

    This is probably the main reason I'm staying away from linux. I actually tried to set up a media server not long ago, but the capture cards I had weren't supported (one might have been if I followed an instruction set as in-depth as what you just laid out.) I threw a windows MCE AIO on it instead.

    If I did need a lightweight machine just to run openoffice and firefox, or if I had a machine where everything worked, I'd definitely look at XUbuntu or Puppy.

    ReplyDelete
  3. Thanks for your efforts, it looks lots of people having problems on ubuntu / kubuntu with VNC. I tried to fallow your instruction, I've deinstaled ubuntus own vnc4-common and vnc4server packages and instaled debain packages as you sugested. I got warning that there is newer version, which I ignored. Install went ok. Problem occured when I executed
    dpkg -i vnc4server*.deb

    igot errors:
    dpkg: error processing vnc4server*.deb (--install):
    cannot access archive: No such file or directory
    Errors were encountered while processing:
    vnc4server*.deb

    any ideas

    thanks

    Darko

    ReplyDelete
  4. Just make sure you're in the same directory as the vncserver deb! (i.e., make sure 'ls' shows the vncserver deb).

    -BT

    ReplyDelete
  5. Thanks, so for future pinguiners who may read this helpful howto:

    after you do
    # ln -s /usr/share/fonts/X11/*
    than find location of your package files
    sloacte -u
    slocate vnc4server

    on my computer it was in

    /var/cache/apt/archives

    so next step is

    cd /var/cache/apt/archives

    than continue

    # dpkg -i vnc4-common*.deb

    etc...

    ReplyDelete
  6. ok, it works!

    one problem, some aps dont'run, I tried Eclipse but I starts to load but than it just doesnt, no messages. Same with gimp. Could it be because they are gnome apps ( I am accessing KDE from my windows laptop)

    Any ideas

    Thanks for help so far

    Darko

    ReplyDelete
  7. Sorry, Darko, what that means is that you managed to track down where apt-install had stashed the original Ubuntu vncserver dkpg's and re-install them :-). Download the Debian dpkg's again, REMEMBER WHERE YOU DOWNLOADED THEM TO, un-install the Ubuntu packages again, then install the Debian packages.

    As far as I know, the only program that just absolutely refuses to work with the Debian packages is Opera. No big loss, IMHO.

    -BT

    ReplyDelete
  8. douhg, yes I reinstalled Ubuntu packages, that is why it didn't completely work.

    Now I deinstaled them and installed Debian packages, and it all works

    so OS community rocks

    thanks again

    darko

    ReplyDelete
  9. Why does Ubuntu ship a broken vncserver package for already a few months now? According to the RealVNC guys there's also a severe security risk! Do the Ubuntu package/release managers just don't care, or is there nobody competent enough to fix this problem?

    ReplyDelete
  10. It's unclear whether the current Ubuntu vnc packages pose a security risk. They've been heavily patched. It is clear that they just plain don't work with any GTK+ program or with many other programs due to bugs. As to why it doesn't get fixed, beats me. But I'm running the Debian packages now, so other than Synaptic whining about how it has two updates to apply (the broken Ubuntu packages), I'm good to go.

    - BT

    ReplyDelete
  11. The current feisty vnc4server package seems to work fine if you start it with:

    -extension XFIXES

    as noted in https://bugs.launchpad.net/ubuntu/edgy/+source/vnc4/+bug/78282/comments/57

    ReplyDelete
  12. Thanks Badtux,

    Your instructions worked perfectly and saved me a lot of time in getting it up and running!

    ReplyDelete
  13. "edit ~/.vnc/xstartup " :D

    you saved my day!

    ReplyDelete

Ground rules: Comments that consist solely of insults, fact-free talking points, are off-topic, or simply spam the same argument over and over will be deleted. The penguin is the only one allowed to be an ass here. All viewpoints, however, are welcomed, even if I disagree vehemently with you.

WARNING: You are entitled to create your own arguments, but you are NOT entitled to create your own facts. If you spew scientific denialism, or insist that the sky is purple, or otherwise insist that your made-up universe of pink unicorns and cotton candy trees is "real", well -- expect the banhammer.

Note: Only a member of this blog may post a comment.