QEMU, XEN, and Windows
Monday, March 10th, 2008Mozilla 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:
- I’m running Fedora Core 8.
- 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.
- I tried creating a new VM in the Virtual Machine Manager GUI. I chose two virtual processors.
- 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.
- 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.
- 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.
- 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.
- I give up and disable Xen, starting the same process with KVM.
- 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.
- 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.
- I try allocating only one processor to the VM. This causes Windows to hang on bootup. Going back to 2 CPUs keeps the hang.
- I’m frustrated, so I re-install Windows from scratch with one CPU. This makes performance somewhat better.
- I discover that I’m not using a bridged network, but an emulated private network with NAT.
- 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.
- 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.
- I discover that an SDL window in the host is a lot more reliable than VNC.
- 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?