Xen graphical console and foreign keyboards

Xen graphical console and foreign keyboards

For those people using CentOS 5.1 or later (Or RHEL for that matter) and that do not have a standard US qwerty keyboard layout. Which is a large part of Europe I guess, will probably have noticed that with 5.0 the keyboard mapping in the graphical console using the Virtual Machine Manager (virt-manager) do not really match.

Luckily since 5.1 this has been solved. The newer version of Xen and libvirt allow you to specifiy the keyboard mapping to use in the graphical console. Unfortunately there is no way to configure this in virt-manager itself, so you need to resort to some text editing. Open the Xen configfile or your domU with your favorite text editor, they should be located in /etc/xen. You should see something like this

name = “test2”
uuid = “a7296544-864c-4bf6-401d-d87e02306ba1”
maxmem = 500
memory = 500
vcpus = 1
bootloader = “/usr/bin/pygrub”
on_poweroff = “destroy”
on_reboot = “restart”
on_crash = “restart”
vfb = [ “type=vnc,vncunused=1,keymap=en-us” ]
disk = [ “phy:/dev/rootvg/test2,xvda,w” ]
vif = [ “mac=00:16:3e:56:a7:ba,bridge=xenbr0” ]

Now if you change the “keymap=…” setting to your keyboard layout and start the domU again the keyboard mapping should match now.

To know what keyboard mappings are available you can do this :

rpm -ql xen | grep keymap

This shows you a list of available keyboard mappings.

Update : Konrad posted another interresting tip in the comments : “You can also simply set this for all DomUs in the file /etc/xen/xend-config.sxp e.g. for a french keyboard add a line (keymap ‘fr’) and restart xend”. This is very usefull, tx Konrad !

* This article was originally published here

Leave a Reply

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