Keyboard map is incorrect when using an NX-client

I have a problem with nomachine NX-client in Ubuntu. It seems that the keymapping has a problem. For example, the arrow keys do not work (except for up key which opens printscreen!). I searched online and found several solutions. However none of them worked for me:

solution 1)

On the server, change System->Preferences->Keyboard->Layouts to “Evdev-managed keyboard”

The server that I log into has Centos 5.7 on it and I cannot find “Evdev-managed keyboard” layout in keyboard setting. I tried several other generic keyboard layouts with no success.

solution 2)

add the following lines to /etc/X11/xorg.conf:

Section "ServerFlags"
Option "AutoAddDevices" "false"
EndSection

I did it and my keyboard stopped working completely! I had to use the on-screen keyboard to remove this setting and get back to normal.

solution 3)

Run xmodmap -pke > localxmodmap locally

Copy the file to server as .Xmodmap

Run xmodmap ~/.Xmodmap from terminal.

which gives me a bunch of errors such as:

xmodmap:  /home/fzc23/.Xmodmap:60:  bad keysym name 'XF86Switch_VT_1' in keysym list

and doesn't work.

I do not know what else to do. I would appreciate if somebody could help me out.

BTW, the NX-client on windows connects to the same server with no keymapping problem so I believe this is a problem in Ubuntu and has nothing to do with the server side.


I had the same problem under Gentoo. I can't promise that this will work on a CentOS 5 server, but this worked for me on a Gentoo server.

Inside your nx session, open a terminal window and run:

setxkbmap -model evdev -layout us

Replacing "us" with your desired layout if it isn't the US layout. Your keymap should be correct now. If you start your nx session using an .xsession/.xinitrc style script, you can add the setxkbmap command to the startup script.