Tuesday, December 11, 2012

virt-manager and xquartz

'ssh -X'ing to a Linux KVM machine, running virt-manager, and getting a VNC display to an OS X/xquartz box was problematic until I found http://blog.loftninjas.org/2010/11/17/virt-manager-keymaps-on-os-x/  Turns out, the keymap isn't set and falls back to the OS X mapping, which I guess isn't compatible.  On OS X:
$setxkbmap -print
xkb_keymap {
        xkb_keycodes  { include "empty+aliases(qwerty)" };
        xkb_types     { include "complete"      };
        xkb_compat    { include "complete"      };
        xkb_symbols   { include "empty(basic)"  };
        xkb_geometry  { include "pc(pc104)"     };
};
On an Ubuntu machine that worked:
~$ setxkbmap -print
xkb_keymap {
    xkb_keycodes  { include "evdev+aliases(qwerty)"    };
    xkb_types     { include "complete"    };
    xkb_compat    { include "complete"    };
    xkb_symbols   { include "pc+us+inet(evdev)+ctrl(nocaps)"    };
    xkb_geometry  { include "pc(pc105)"    };
};
I didn't take the time to figure out which differences are important.  Instead, I did the suggested "virsh edit IMAGEID" and add "keymap='en-us'" to the "graphics" line.  This edits the "/var/run/libvirt/qemu/IMAGEID.xml" file.  Once this was done, I did have to destroy to the running instance and then start it; rebooting the guest didn't work.  I had also downloaded the newest xquartz from http://xquartz.macosforge.org/ so the alt key remapping can be done via the preferences.

OpenBSD on KVM

Previous versions of OpenBSD didn't work and play well with some hypervisors, Xen and KVM included.  One had to worry about using the right virtual NIC, fixing some MP BIOS settings, etc., and even then it often wouldn't work.  With 5.3, things seem to have evened out.  One still has to set the NIC to be a e1000, but that's it.  Here are two screen shots from virt-manager.  Set things up as desired, but on the last screen, tick "Customize configuration before install" before clicking Finish.  Then, specify the NIC, and click Apply.

Some hypervisors like having "Virtio" set for disks:
 


And while you're at it, change the keyboard from the default so it will work with xquartz: