Roger Whittaker

View Roger Whittaker's profile on LinkedIn

Valid XHTML 1.0 Transitional

NetBSD as Xen domU on SUSE 10.1 HOWTO

Saturday 20th May 2006

I struggled a bit to get this working, so here's what I did for anyone who would like to do the same.

The fact that Xen works with disk images created under Qemu is very useful, as doing the main install is easier that way.

Get the NetBSD 3.0 iso image i386cd-3.0.iso from a NetBSD mirror site.

Create a Qemu disk image:

$ qemu-img create netbsd.dsk 2G

Run Qemu to install NetBSD to it:

$ qemu -hda netbsd.dsk -cdrom i386-3.0.iso -monitor stdio -boot d -m 256

Do the installation within Qemu. When the installation finishes, halt the virtual machine.

Make a copy of netbsd.dsk (just in case).

Now check that you can start it again:

$ qemu -hda netbsd.dsk -monitor stdio -boot c -m 256

In the NetBSD virtual machine under Qemu, edit /etc/fstab and replace the reference to /dev/wd0a by /dev/xbd0a, and similarly for /dev/wd0b and so on. (This was the part that held me up: the VM was coming up in single user mode under Xen and saying that its disk devices were not configured.

Download the Xen-capable NetBSD kernel from e.g.

Uncompress it:

$ gzip -d netbsd-XEN3_U.gz

Check that we are running on Xen:
$ uname -r

Create a Xen configuration file netbsd.vm.conf

disk = [ 'file:/home/roger/netbsd/netbsd.dsk,hda,w']
memory = 256
vcpus = 1
builder = 'linux'
kernel = '/home/roger/netbsd/netbsd-XEN3_U'
name = 'netbsd'
vif = [ 'mac=00:16:3e:ff:f6:80' ]
dhcp = "dhcp"

Now we can run (as root) the VM under Xen:

# xm create -c netbsd.vm.conf