FreeNX arrow keyboard mapping problem

Written by NickWal

Recently when configuring and using xen virtual machines for older versions of Linux distributions, such as Centos 4, I experienced a keyboard mapping problem with FreeNX and the NX Client. The problem didn’t exist when accessing the NX server from Windows, only from newer Linux distributions such as Ubuntu Juanty. A typical symptom of the problem is that the up arrow key is mapped to the print key, and the other arrow keys/cursor keys don’t work. It seems the actual cause of the problem is a difference between newer and older versions of xorg. Newer versions use the evdev driver and evdev mappings, while the older xorg versions use xf86 keyboard mappings. It seems that these two mappings are not compatible.

In fact a patch and a work around exists. It turns out that Nomachine have in fact created a work around for this problem, and its in the released version of NX 3.3. This of course wont be the version you will find in your older distributions, so you will need to scout around a bit for a version for your operating system. However installing the updated version of nx alone wont in fact work. You need to patch your version of freenx. The latest released version of freenx is 0.7.3, so you should try and install that. Then you will need to patch the version of nxnode installed by freenx with the patch below. This will call nx with additional parameters to enable to workaround. These updates and patched need to be installed on the server side (where you are running the older distribution with the older xorg). To install the patch, you can save it to a file called nxnode.patch in the /usr/bin/ directory where the nxnode file is, and then use something like ‘patch -p0 < nxnode.patch’.

Server Versions for Centos 4

    freenx-0.7.3-1.el4.centos  
    nx-3.3.0-35.el4

Patch

    --- nxnode    2009-01-14 04:22:40 +0000  
    +++ nxnode    2009-01-14 04:24:02 +0000  
    @@ -555,7 +555,8 @@  

            # Start the agent  

    -        PATH="$PATH_BIN:$PATH" $PATH_BIN/nxagent $P $R -name "NX - [email protected]$SERVER_NAME:$display - $session (GPL Edition)" -option "$USER_FAKE_HOME/.nx/C-$sess_id/options" $K $G $B $FP $AGENT_EXTRA_OPTIONS_X :$display 2>&3 &  
    +        #PATH="$PATH_BIN:$PATH" $PATH_BIN/nxagent $P $R -name "NX - [email protected]$SERVER_NAME:$display - $session (GPL Edition)" -option "$USER_FAKE_HOME/.nx/C-$sess_id/options" $K $G $B $FP $AGENT_EXTRA_OPTIONS_X :$display 2>&3 &  
    +        PATH="$PATH_BIN:$PATH" $PATH_BIN/nxagent $R -name "NX - [email protected]$SERVER_NAME:$display - $session (GPL Edition)" -option "$USER_FAKE_HOME/.nx/C-$sess_id/options" $B $FP $AGENT_EXTRA_OPTIONS_X :$display 2>&3 &  
        fi  

        #  
    @@ -1094,6 +1095,8 @@  
        # Rootless fix from 2x nxserver 1.5.0  
        realtype=$type  
        [ "$type" = "unix-application" -o "$type" = "unix-default" ] && realtype="unix-desktop"  
    +    [ "$type" = "unix-gnome" ] && realtype="gnome"  
    +    [ "$type" = "unix-kde" ] && realtype="kde"  

        # NX 2.1.0 file-sharing port options  
        client=$(getparam client)  
    @@ -1272,7 +1275,7 @@  
        umask 0077  

    cat << EOF > "$USER_FAKE_HOME/.nx/C-$sess_id/options"  
    -${keyboard:+keyboard=$keyboard,}${kbtype:+kbtype=$kbtype,}${kbload:+kbload=$kbload,}${keymap:+keymap=$keymap,}${resize:+resize=$resize,}${CACHE}${IMAGES}${PACK}link=$link,nodelay=$nodelay,type=$realtype,cleanup=0,${ACCEPT}cookie=$proxy_cookie,id=$sess_id,samba=$samba,media=$media${sync:+,sync=$sync}${cups:+,cups=$cups}${keybd:+,keybd=$keybd}${aux:+,aux=$aux}${http:+,http=$http}${rdpcolors:+,rdpcolors=$rdpcolors}${rdpcache:+,rdpcache=$rdpcache}${fullscreen:+,fullscreen=1}${clipboard:+,clipboard=$clipboard}${menu:+,menu=$menu}:$display  
    +nx/nx,${keyboard:+keyboard=$keyboard,}${kbtype:+kbtype=$kbtype,}${kbload:+kbload=$kbload,}${keymap:+keymap=$keymap,}${geometry:+geometry=$geometry,}${client:+client=$client,}${resize:+resize=$resize,}${CACHE}${IMAGES}${PACK}link=$link,nodelay=$nodelay,type=$realtype${clipboard:+,clipboard=$clipboard}${composite:+composite=$composite},cleanup=0,product=LFE/None/LFEN/None,shmem=1,${backingstore:+backingstore=$backingstore,}shpix=1,${ACCEPT}cookie=$proxy_cookie,id=$sess_id,samba=$samba,media=$media${sync:+,sync=$sync}${cups:+,cups=$cups}${keybd:+,keybd=$keybd}${aux:+,aux=$aux}${http:+,http=$http}${rdpcolors:+,rdpcolors=$rdpcolors}${rdpcache:+,rdpcache=$rdpcache}${fullscreen:+,fullscreen=1}${menu:+,menu=$menu}:$display  
    EOF  
        umask $OLD_UMASK  
            #samba=$samba,

References