Setup FreeNX under Ubuntu

Preface

Up until recently I’ve been accessing my laptop, running Intrepid, via the built-in Remote Desktop feature of GNOME over an SSH tunnel. While this works pretty well the mouse pointer feels like it is being dragged through Molasses and screen updates can be painfully slow; so I started to look for an alternative. When I used to run Windows XP I’d connect via Remote Desktop (RDP) which was quite useable. I wasn’t really worried if I got to use my actual desktop or use a virtual desktop just so long as it was fairly responsive. I tried various Howtos involving x11vnc, XRDP and finally FreeNX, but mostly these were out of date i.e. XRDP is now in the repositories. After a bit of hacking and some searching of PPAs I found that FreeNX worked the best.

What is FreeNX?

NX is an exciting new technology for remote display. It provides near local speed application responsiveness over high latency, low bandwidth links. The core libraries for NX are provided by NoMachine under the GPL. FreeNX is a GPL implementation of the NX Server and NX Client Components. NoMachine provides a free server but this is limited to 2 connections and is closed source, FreeNX provides an NX Server with unlimited connections under the GPL.

Configure PPA Repositories

Important The FreeNX PPA is now a signed PPA and so we need to install the correct GPG key in order to install any packages.

From a Terminal window type

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D018A4CE

Now we need to setup access to the FreeNX repository

gksudo gedit /etc/apt/sources.list.d/freenx.ppa.list

Copy the following to the new file (depending on your version of Ubuntu)

# Ubuntu FreeNX Repository for Karmic
deb http://ppa.launchpad.net/freenx-team/ubuntu karmic main
deb-src http://ppa.launchpad.net/freenx-team/ubuntu karmic main
# Ubuntu FreeNX Repository for Jaunty
deb http://ppa.launchpad.net/freenx-team/ubuntu jaunty main
deb-src http://ppa.launchpad.net/freenx-team/ubuntu jaunty main
# Ubuntu FreeNX Repository for Intrepid
deb http://ppa.launchpad.net/freenx-team/ubuntu intrepid main
deb-src http://ppa.launchpad.net/freenx-team/ubuntu intrepid main

Save and then run the following commands

sudo apt-get update
sudo apt-get upgrade

Install FreeNX on your machine

First install the correct version of TCL for your version of Ubuntu.

Jaunty

sudo apt-get install tcl8.5

Intrepid

sudo apt-get install tcl8.4

Run the following command to install FreeNX and its components

sudo apt-get install openssh-server dbus-x11 libxcomp3 libxcompext3 nxlibs nxagent nxproxy freenx-server expect denyhosts xdialog

These files are being installed from a signed PPA so you shouldn’t be asked to confirm the installation of some libraries and the FreeNX binaries.

Install NX Client

Download and install the appropriate client from http://www.nomachine.com/download.php
NOTE: The Open Source Linux Client QTNX should have already been installed.

You should now be able to connect to you machine from any Windows, Mac or Linux client machine.

For best results set the desktop experience to MODEM.

NOTE: The LAN setting disables the compression and caching which means it uses A LOT of bandwidth. MODEM is a much better experience regardless of whether you’re on ADSL, Cable or LAN.

Troubleshooting the Windows Client

Most people, like me, will probably want to connect to their Linux box from Windows so on Windows the NX Client uses cygwin1.dll as part of the client, if you run another application which uses this dll and it is not the same version as the one used by the NX Client you will get a dialog box like this ..

Clicking either “Replace system DLL” or “Use system DLL” will let the client load however you then may receive an error that you “Cannot initialize the display service” like this (see http://www.nomachine.com/ar/view.php?ar_id=AR03E00449 for more details)

The best idea is to copy the NX Client’s cygwin1.dll into the other application’s directory to ensure it still runs; if it doesn’t then you’re going to have to run NX on it’s own.

Caveats

I’ve tried to leave the settings alone as much as possible to ensure the simplicity of installing and configuring this service, however the default keys used are well known and should be changed using the following command

sudo dpkg-reconfigure freenx-server

Choose “Generate Custom Keys” then “SSH

Copy the new key from /var/lib/nxserver/home/custom_keys/client.id_dsa.key into the client by clicking the “Configure …” button and then the “Key …” button. Copy the new custom key into this dialog and Save.

Please note that the FreeNX server won’t work if “PasswordAuthentication no” is set in /etc/ssh/sshd_config, this cost me a lot of time because I generally run my OpenSSH servers with this option and use Private Keys to access them securely. And remember to connect to the SSH server over the Internet port 22 will need to be forwarded to the machine hosting FreeNX. See http://portforward.com for information on how to setup port-forwarding on various routers.

Updates

5th Dec 2009 – Added Karmic details. Thank you again Alex Saavedra.
12th May 2009 – Added Jaunty details. Thank you Alex Saavedra.
25th Jan 2009 – Updated article to include information about Signed PPA support.

19 thoughts on “Setup FreeNX under Ubuntu”

  1. I was able to setup password-less logging by adding the following two statements to /etc/nxserver/node.conf

    ENABLE_USERMODE_AUTHENTICATION=”1″
    ENABLE_SSH_AUTHENTICATION=”0″

    I did not need to touch /etc/ssh/sshd_config where “PasswordAuthentication no” remains. Sweet!

  2. I installed freeNX on ubuntu 9.10 successfully, and installed NX Client in my Windows 7 PC. Installation was very smooth, and I can also access my Ubuntu system very easily, there was no problem at all.

    I have an application running on Ubuntu, I want to get the prints on to my windows PC. I have followed instructions given in different posts given in the net, but nothing gave a good solution.

    If anybody can help me in this, it will be of great healp.

    Thanks

  3. Any advise or small clue as to how to print remotely to a windows xp client? The server is Karmic 9.10 Ubuntu and want to print to remote windows xp client.
     
    Tks

  4. I just upgraded a server from 9.04 Jaunty to 9.10 Karmic Koala and FreeNX stopped working. So I uncommented 2 lines from /etc/apt/sources.list.d/freenx.ppa.list, which was appropriately changed by do-release-upgrade command:
    # Ubuntu FreeNX Repository fro Karmic Koala
    deb http://ppa.launchpad.net/freenx-team/ubuntu karmic main
    deb-src http://ppa.launchpad.net/freenx-team/ubuntu karmic main
    Then I  upgraded packages. Then FreeNX started working as usual.
    A. Saavedra

  5. I got the file sharing to work from windows XP which only works for cifs and not smb. But printing does not work at all. If I use it from a ubuntu client printing and files sharing works. Have any ideas how to solve the windows xp printing?

  6. Would be really greatful if you can do a tutorial on how to get printing and file sharing from windows xp to work with freenx server and ubuntu.

  7. Hi Alan,
    Thanks for advise. But hmm… it still doesn’t work.
    aptitude search libxcompext3
    and
    aptitude search libxcompshad3
    don’t show any results in a terminal window.
    libxcompext3 still can’t be found. PS3 is a PowerPC architecture. Does this cause the problem?
    Regards, Stefan.

    1. Hi Stefan,

      Have been scouring the ‘net and I can’t find any useful references to FreeNX as a server on PowerPC architecture. Sorry. The FreeNX PPA only covers x86 architectures. Much as I hate to say it I don’t know where to take this from here.

      Ta,
      Al.

  8. Stefan/Jorge – I’ve just completed a fresh install of Jaunty and reinstalled FreeNX as above. The 2 problem packages are libxcompext3 and libxcompshad3. These are provided by nxcompext – 1:3.3.0-4-0ubuntu1 and nxcompshad – 3.3.0-3-0freenxteam1 both of which are only found in the FreeNX PPA.

    Please try the following lines to see if it helps.

    Make sure the key is installed
    sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys D018A4CE

    Make sure the PPA is setup correctly
    sudo cat /etc/apt/sources.list.d/freenx.ppa.list

    Make sure APT can use the FreeNX PPA
    sudo apt-get update

    Search for libxcompext3
    aptitude search libxcompext3

    Search for libxcompshad3
    aptitude search libxcompshad3

    Install the packages
    sudo apt-get install libxcompext3 libxcompshad3

    Hope this helps,
    Alan.

  9. Hi, sorry. When I pressed submit, I knew you would ask… thanks for your quick response.
    I am using Ubuntu 9.04 for PS3.
    I have installed FreeNX some time ago on my PS3 and got it working through my WinXP desktop. But now I seem to forget one step of the installation procedure. I have reinstalled Ubuntu the day before yesterday after trying Fedora.
    Maybe I have to activate the universe repositories. Do you know a command line string to do that?
    Maybe there is something wrong with the key to ppa.launchpad.net?

  10. Hi,
    I have been trying to install this on a PS3, but the libxcompext3 package can not be found. What am I forgetting?
    Here is the message:
    [email protected]:~$ sudo apt-get install openssh-server dbus-x11 libxcomp3 libxcompext3 nxlibs nxagent nxproxy freenx-server expect denyhosts xdialog
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    openssh-server is already the newest version.
    dbus-x11 is already the newest version.
    dbus-x11 set to manually installed.
    E: Couldn’t find package libxcompext3
    [email protected]:~$

  11. Jorge – Hi, I’ve only tested this so far on a default install of Ubuntu (GNOME Desktop) I’ll try to setup an Xubuntu PC and see if I can work out the issue . Are you using Intrepid or Jaunty?

    Al.

  12. Hello:

    I Did all that you describe here, and I googled a lot (and try for three days with tightvnc -the only one successful- with NX form no machine and XRDP the most was see the Xsession for almost one minute). I wanna do with FreeNX because hasn’t session limits and performance, tightVNC needs a tightvncserver process for each client (and I need at least 5) and the machine isn’t so good.

    I’ve try your tutorial but when I do the last step, the system shows this message

    sudo apt-get install openssh-server dbus-x11 libxcomp3 libxcompext3 nxlibs nxagent nxproxy freenx-server expect denyhosts xdialog
    Leyendo lista de paquetes… Hecho
    Creando árbol de dependencias       
    Leyendo la información de estado… Hecho
    openssh-server ya está en su versión más reciente.
    dbus-x11 ya está en su versión más reciente.
    fijado dbus-x11 como instalado manualmente.
    No se pudieron instalar algunos paquetes. Esto puede significar que
    usted pidió una situación imposible o, si está usando la distribución
    inestable, que algunos paquetes necesarios no han sido creados o han
    sido movidos fuera de Incoming.
    La siguiente información puede ayudar a resolver la situación:

    Los siguientes paquetes tienen dependencias incumplidas:
    nxagent: Depende: libxcompshad3 pero no va a instalarse
    Depende: libxrandr2 (>= 2:1.2.99.2) pero 2:1.2.3-1 va a ser instalado

    E: Paquetes rotos

    the message is because nxagent depends of libxrandr2 and libxcompshad3 this one doesn’t be installed, so the package is broken and I cannot install freeXN server. I tried to do it over Xubuntu Jaunty.

    thanks in advance

Leave a Reply

Your email address will not be published. Required fields are marked *