Microsoft Windows XP as a Xen domU

From Wiki
Jump to: navigation, search

This information is correct as of OpenBSD 4.6 and Xen 3.2.1.

Does it Work?

Yes, it works in HVM (full virtualisation mode), but it can not be paravirtualised and never will be. You need a processor that supports Hyper-V (intel call it something else). If you have the following, you're fine:

# xm dmesg | grep HVM
(XEN) HVM: SVM enabled
(XEN) HVM: Hardware Assisted Paging detected and enabled.

Do it

  • Create a logical volume. (This also works with an image file, but an LV gives better performance):
# lvcreate -L10G -n xen-vol
  Logical volume "" created
  • Place the .iso that you legally ripped legally from your completely legal and fully licenced original legal copy of Microsoft Windows XP in a convenient location:
# ls /home/xen
  • Create a configuration file for the domU:
# vi /etc/xen/ 
import os, re
arch = os.uname()[4]
kernel = "/usr/lib/xen-default/boot/hvmloader"

memory = 512
shadow_memory = 8
name = ""
# Setting ne2k_pci is essential if you want the virtual NIC to work
vif = [ 'type=ioemu, bridge=eth0, model=ne2k_pci' ]
# for image file instead of LV:
#disk = [ 'file:/home/xen/,xvda,w', 'file:/home/xen/xp.iso,xvdc:cdrom,r' ]
disk = [ 'phy:/dev/xen-vol/,xvda,w', 'file:/home/xen/xp.iso,xvdc:cdrom,r' ]
device_model = '/usr/lib/xen-default/bin/qemu-dm'
# boot on floppy (a), hard disk (c) or CD-ROM (d)
# default: hard disk, cd-rom, floppy

# Enable VNC
# Listen on
# Listen on all IPs (Do not want)

  • Instantiate the VM:
# xm create
Using config file "/etc/xen/".
Started domain
  • Verify that the dom0 has a listening socket for VNC:
# netstat -ntap | grep 5901
tcp        0      0*               LISTEN      9953/qemu-dm
  • ssh to the dom0, forwarding port 5901:
# ssh user@dom0-address -L 5901:
  • You will now be able to VNC to and see the domU console, so just install Microsoft Windows as usual.
  • NOTE: Chicken of the VNC on OS X doesn't like the VNC encoding used by Xen. Vine Viewer works fine but isn't free, I'm looking for something better.