Keymap Problems with Virt-Manager

So here's the problem:

I'm trying to use an Ubuntu 8.04.3 (Hardy) machine as a host for some KVM virtual machines. The Ubuntu server is headless and my management client is an Apple MacBook with Mac OS X 10.5.8 and the X11 server installed.

The basic steps I use to manage the virtual machines are (executed on the Macintosh):

Up to this step everything works and I get a virt-manager window on my OS X machine.

virt-manager on OS X via X11-Forwarding

The real pain begins after connecting to the graphical console of a virtual machine: Every key on my keyboard (an apple keyboard with german layout) results in something completely wrong in the VM. For example pressing Return on my keyboard results in a lowercase j in the VM, t maps to w, 9 maps to - and so on. After some time I discovered that the number 8 is interpreted as Return ...

Addtionally it is not possible to press CRTL+ALT to leave the graphical console. This can be easily fixed on your Mac by creating a file in your Home directory (~) called .Xmodmap with the following content:

clear Mod1
keycode 66 = Alt_L
keycode 69 = Alt_R
add Mod1 = Alt_L
add Mod1 = Alt_R

Luckily I found this snippet in peter's blog.

But this doesn't solved the original problem with the completely b0rked keyboard layout in the VNC session opened by virt-manager. After some time I was able to resolve it with the following method (Everything done on the Ubuntu machine - the KVM host):

The small wrapper, in this example saved as /usr/local/bin/kvm appends the option -k de to kvm (which is basically just qemu) and therefore instructs qemu to start the VNC server for the virtual machine with the keymap de. You still have to configure the correct keyboard layout in the Operating System of the VM, but at least my keyboard now sends the correct keys to the VM through SSH+X11+VNC ...

virt-manager console with grml 2009.05

Kommentare