QEMU, XEN, and Windows

Monday, March 10th, 2008

Mozilla got me a new computer recently: one that can build Mozilla clobber in 7 minutes, or do a full XPCOMGC rewriting pass in 90 minutes. I wanted to be able to run Windows in a VM on this machine, but I’ve had a really unpleasant time setting up virtualization. This is a tale of what I’ve tried:

  1. I’m running Fedora Core 8.
  2. I told it to install the virtualization group on install, which means I got both the Xen and KVM stacks. Installing the Xen stack automatically sets up grub to boot into a Xen hypervisor.
  3. I tried creating a new VM in the Virtual Machine Manager GUI. I chose two virtual processors.
  4. I tried to install Windows XP by hooking that virtual machine up to /dev/cdrom directly. But the host automount factility kept causing conflicts between the guest and the host. So I copied the Windows CD to a local .iso file and told Xen to use that instead. So far so good, Windows XP tries to install.
  5. Every time Windows tries to restart (which is a lot, when you’re trying to install Windows, updates, and developer tools) the VM hangs. You can’t even shut down the VM from the host GUI: it’s stuck, and you have to reboot the host.
  6. Connecting to the VM from VNC is… difficult. If you use the default option of PS/2 mouse emulation, the guest mouse cursor doesn’t track the host cursor correctly. Configuring the USB tablet emulation fixes this problem. But frequently when typing quickly the keyboard will have doubled keys, missed keys, or the modifiers (shift and control) will simply stop functioning.
  7. Trying to connect from another machine (my mac laptop) is an exercise in disappointment. My old standby “Chicken of the VNC” won’t display anything other than black. A newer client, JollysFastVNC, connects, but I can’t make the “control” key work.
  8. I give up and disable Xen, starting the same process with KVM.
  9. I get a lot closer. The virtual machine can start and reboot successfully. But 2 CPUs run at 100% the entire time, even when the guest VM isn’t doing anything. I read bug reports and see that this is supposedly a problem with very old versions of KVM, but was fixed long before my current version (version 60). Virtual machine performance is terrible.
  10. I try a workaround I found via Google, installing the “Standard PC” driver instead of the “ACPI Multiprocessor PC” driver in Windows. This doesn’t help.
  11. I try allocating only one processor to the VM. This causes Windows to hang on bootup. Going back to 2 CPUs keeps the hang.
  12. I’m frustrated, so I re-install Windows from scratch with one CPU. This makes performance somewhat better.
  13. I discover that I’m not using a bridged network, but an emulated private network with NAT.
  14. I start to read docs about how to set up a bridged network with KVM/QEMU. They all involve launching KVM from a commandline, not from the GUI. And when I try to follow the directions, my local network goes down.
  15. I finally give up using the Virtual Machine Manager GUI. I switch to using the qemu-kvm command line, and get a virtual machine running using that. I can get a bridge network, maybe, but it doesn’t actually work in the guest VM.
  16. I discover that an SDL window in the host is a lot more reliable than VNC.
  17. I discover that the Windows CD I have is an OEM version and isn’t legal on this machine.

    I’m still frustrated. I now have a Windows Vista license that is legal on this machine, but I haven’t installed it yet: I really want a bridged network, and preferably one that comes up automatically every time the host machine starts. I don’t really know much about Linux networking, or even what “a network” means in Linux… I just want a simple option like I used to have in VMWare: “Use bridged network” and it all works… but with better performance because KVM and Xen can both use fully virtualized I/O and multiple CPUs.

    Does anyone know of a good guide to getting this working in a permanent sort of way?