How to install a NetBSD domU on a Linux host (Debian 3.1, Xen 2.0.7, NetBSD 2.1)
This mini-HOWTO describes how to install a NetBSD domU on a Linux host (dom0). Specifically, I used Debian 3.1 on Xen 2.0.7 as the host and put NetBSD 2.1 in a domU (with NetBSD 3.0-current kernel). This has been updated to include details on
Create storage space. I used LVM:
lvcreate -L4G -n netbsd3.0 vol1
Download netbsd-XENU-INSTALL and netbsd-XENU kernels:
wget ftp://ftp.netbsd.org/pub/NetBSD-daily/netbsd-3-0-RC5/200511302123Z/i386/binary/kernel/netbsd-INSTALL_XENU.gz wget ftp://ftp.netbsd.org/pub/NetBSD-daily/netbsd-3-0-RC5/200511302123Z/i386/binary/kernel/netbsd-XENU.gz gunzip netbsd-INSTALL_XENU.gz gunzip netbsd-XENU.gz
For Xen3 hosts, use:
wget ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-3.1/i386/binary/kernel/netbsd-INSTALL_XEN3_DOMU.gz wget ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-3.1/i386/binary/kernel/netbsd-XEN3_DOMU.gz gunzip netbsd-INSTALL_XEN3_DOMU.gz gunzip netbsd-XEN3_DOMU.gz
If the snapshots above are not available at the time you read this, just search for a newer snapshot.
kernel = "/home/garry/kernels/netbsd-INSTALL_XENU" <--- point to where you downloaded the kernels in step #2 memory = 128 name = "netbsd3.0" disk = [ 'phy:/dev/vol1/netbsd3.0,0x3,w' ] # I needed to add this because the installer couldn't find a network card without it vif = ['mac=00:0C:6E:40:59:A3'] # Replace with your IP info ip = "a.b.c.d" netmask = "255.255.x.x" gateway = "a.b.c.d"
xm create -c netbsd.cfg
Your system will boot into the NetBSD installer. Install NetBSD like normal, noting the following:
When you get to the part where it is formatting your filesystems, you may get an error about "invalid disklabel" or something like that. From my experience, it can be ignored.
When it asks for installation method, choose 'FTP', then change the base directory to:
NetBSD 3.1 was the latest version of NetBSD at the time of this writing, you may choose a newer one if you wish.
mount /dev/xbd0a /mnt cd /mnt/dev cp -pR /dev/rxbd* . cp -pR /dev/xbd* . halt -p
For some reason, these devices are not created by Xen when the VM is booted. And yes, I tried every combination of the "disk" and "root" Xen options in "netbsd.cfg" that I could think of, but nothing worked.
The above process is probably not necessary for XEN3 3.1 kernels.
Edit /etc/xen/netbsd.cfg, change the first line to the following:
kernel = "/home/garry/kernels/netbsd-XENU" <--- change /home/garry/kernels to where you downloaded the kernels in step #2
Start VM again
xm create -c netbsd.cfg
You're now booted into your brand new NetBSD VM!
You'll notice some errors during the bootup, such as "wsconscfg: /dev/ttyEcfg: Device not configured".
To turn this off, edit /etc/ttys and turn off all terminals except "console", like so:
console "/usr/libexec/getty Pc" vt100 on secure ttyE0 "/usr/libexec/getty Pc" vt220 off secure ttyE1 "/usr/libexec/getty Pc" vt220 off secure ttyE2 "/usr/libexec/getty Pc" vt220 off secure ttyE3 "/usr/libexec/getty Pc" vt220 off secure ...
Also, comment out all screens in /etc/wscons.conf:
#screen 0 - vt100 #screen 1 - vt100 #screen 2 - vt100 #screen 3 - vt100 #screen 4 - - #screen 4 80x25bf vt100
Finally, so that "xm shutdown" works from your host (dom0), put the following in /etc/rc.conf: