this is obsolete doc -- see http://doc.nethence.com/ instead

Installing a NetBSD/XEN paravirtualized guest 

 

Preparing the guest skeleton 

Prepare the installation and system kernels e.g., 

mkdir -p /data/guests/bsd64/
cd /data/guests/bsd64/
wget ftp://ftp.fr.netbsd.org/pub/NetBSD/NetBSD-6.0.1/amd64/binary/kernel/netbsd-INSTALL_XEN3_DOMU.gz
wget ftp://ftp.fr.netbsd.org/pub/NetBSD/NetBSD-6.0.1/amd64/binary/kernel/netbsd-XEN3_DOMU.gz

 

Create NetBSD guest's harddrive (assuming a linux dom0, which is sparse file capable with ext2/3/4), 

dd if=/dev/zero of=bsd64.disk bs=1024k count=1 seek=10000

 

Create guest's configuration, 

vi bsd64

like, 

name = "bsd64"
memory = "512"
kernel = "/data/guests/bsd64/netbsd-INSTALL_XEN3_DOMU.gz"
#kernel = "/data/guests/bsd64/netbsd-XEN3_DOMU.gz"
disk = [ 'file:/data/guests/bsd64/bsd64.disk,xvda,w' ]
vif = [ 'vifname=vbsd64.0' ]
vcpus = "2"

Note. for routing instead of bridging, 

vif = [ 'vifname=vbsd64.0,ip=XX.XX.XX.XX' ]

Note. if you have to define the mac address for restricted bridging, for example, 

vif = [ 'vifname=vbsd64.0,mac=00:16:3e:00:00:fd' ]

 

Note. tap:aio: doesn't always work and is not recommended anyways 

 

Note. if you want ISO image as installation media, 

#disk = ['file:/data/guests/bsd64/bsd64.disk,xvda,w',\
#        'file:/data/guests/bsd64/amd64cd.iso,ioemu:hdc:cdrom,r']

and use 'xbd1a' as cdrom device within the installer. 

 

Ready to go 

Start the guest for 'sysinst', 

cd /data/guests/bsd64/
xm create bsd64 -c

 

I had some network issue with previous versions of NetBSD on a Linux dom0 (even with NetBSD 5) but now with NetBSD 6 it's ok. Network works great (no tcp offloading enabled on the dom0, should try with it). 

 

Note. You can always configure network manually first and then start sysinst, 

^C
ifconfig -a
ifconfig xennet0 inet XX.XX.XX.XX netmask 255.255.255.0 up
mount_nfs NFSSRV:/data/shared/netbsdx64/ /mnt2
sysinst

 

During installation, 

check all sets but kernel, kernel modules (unless you want pygrub from pkgsrc) and X sets

 

Note. Eventually disable journaling (-o log) from the mount options if running a Linux dom0. Linux and NetBSD do not seem to share the same cash flush methods. 

Note. harddrive will appear as 'xbd0' 

Note. cdrom will eventually appear as 'xbd1' (use 'xbd1a') 

Note. recent installer ramdisks are readonly, I can't mkdir anymore. vmstat is gone too. 

 

When installation has finished, 

exit install system
halt -p

 

Switch to the normal kernel (and eventually remove the ISO image), 

cd /data/guests/bsd64/
vi bsd64

change to, 

kernel = "/data/guests/bsd64/netbsd-XEN3_DOMU.gz"

 

You can now start the guest normally, 

xm cr bsd64 -c

 

Disable offloading (optional) 

On the dom0 (here Linux), 

ethtool -K vbsd0 rx off
ethtool -K vbsd0 tx off
ethtool -K vbsd0 sg off
ethtool -K vbsd0 tso off
ethtool -K vbsd0 ufo off
ethtool -K vbsd0 gso off
ethtool -K vbsd0 gro off
ethtool -K vbsd0 lro off

 

Post-installation 

Fixing minor errors 

Beside your usual NetBSD post-installation procedure, the following prevents minors errors from showing up at startup. Disable wscons system drivers, 

cd /etc/
vi rc.conf

change, 

wscons=no

 

Disable virtual terminals, 

vi ttys

change, 

ttyE1   "/usr/libexec/getty Pc"         vt220   off secure
ttyE2   "/usr/libexec/getty Pc"         vt220   off secure
ttyE3   "/usr/libexec/getty Pc"         vt220   off secure

 

 

PyGRUB (optional) 

PyGRUB is also available from pkgsrc. To apply, 

cd /data/guests/bsdc/
vi bsdc

change, 

#kernel=...
bootloader = "/usr/pkg/bin/pygrub"

 

References 

http://wiki.xensource.com/xenwiki/XenNetworking 

http://wiki.xensource.com/xenwiki/XenNetRoutingWithPrivateNetwork