Hello everyone,
After QEMU and NVMM, I'm now looking into Xen on NetBSD. I managed to install Xen and boot into it. I want to create my first VM, but unfortunately, I can't find the right settings in the .cfg file; the VM starts but then hangs. Because of OVMF ??
Here's the complete procedure I followed:
1) Install NetBSD 10 complete version (including X).
2) Install Xen Kernel:
pkgin -y in xenkernel418
cp -p /usr/pkg/xen418-kernel/xen.gz /
3) Install Xen tools:
pkgin -y in xentools418
cd /dev && sh MAKEDEV xen
cp /usr/pkg/share/examples/rc.d/xencommons /etc/rc.d/
echo xencommons=YES >> /etc/rc.conf
4) Install the provided dom0:
cd / && ftp http://ftp.netbsd.org/pub/NetBSD/NetBSD-10.0_RC4/amd64/binary/kernel/netbsd-XEN3_DOM0.gz
5) Modify the /boot.cfg file:
- Check the geometry of /:
less /var/run/dmesg.boot | grep "root on "
(here it's dk1)
- Rewrite the /boot.cfg file:
echo 'menu=Boot normally:rndseed /var/db/entropy-file;boot' > /boot.cfg
echo 'menu=Boot single user:rndseed /var/db/entropy-file;boot -s' >> /boot.cfg
echo 'menu=Drop to boot prompt:prompt' >> /boot.cfg
echo 'menu=Xen:load /netbsd-XEN3_DOM0.gz bootdev=dk1 rndseed=/var/db/entropy-file console=pc;multiboot /xen.gz dom0_mem=1024M' >> /boot.cfg
echo 'menu=Xen single user:load /netbsd-XEN3_DOM0.gz rndseed=/var/db/entropy-file bootdev=dk1 console=pc -s;multiboot /xen.gz dom0_mem=1024M' >> /boot.cfg
echo 'default=4' >> /boot.cfg
echo 'timeout=5' >> /boot.cfg
echo 'clear=1' >> /boot.cfg
6) Install OVMF:
pkgin -y in OVMF
7) Restart into Xen (choose 4 during boot).
8) Install TigerVNC (either on the host or on a client on the same network):
pkgin -y in tigervnc
9) Create the first VM:
Create a folder for the VM:
mkdir -p /var/lib/xen/images/netbsd-vm
Download NetBSD 10 .iso directly into the folder:
cd /var/lib/xen/images/netbsd-vm
ftp https://cdn.netbsd.org/pub/NetBSD/NetBSD-10.0_RC4/images/NetBSD-10.0_RC4-amd64.iso
Create a virtual disk for the VM:
dd if=/dev/zero of=/var/lib/xen/images/netbsd-vm/netbsd-vm-disk.img bs=1g count=10
or (because dd takes a lot of time!... it writes 0 on 10GB!)
truncate -s 10G /var/lib/xen/images/netbsd-vm/netbsd-vm-disk.img
Create a bridge and a tap0 network card:
echo "create" >> /etc/ifconfig.tap0 && echo 'descr "NetBSD VM" up' >> /etc/ifconfig.tap0 && echo "! ifconfig bridge0 create" >> /etc/ifconfig.tap0 && echo '! ifconfig bridge0 descr "LAN VM bridge" up' >> /etc/ifconfig.tap0 && echo "! brconfig bridge0 add tap0 add wm0" >> /etc/ifconfig.tap0
service network restart
Create a file configuration for the VM:
echo 'kernel = "/usr/pkg/libexec/xen/boot/hvmloader"' > /usr/pkg/etc/xen/netbsd-vm.cfg
echo 'builder = "hvm"' >> /usr/pkg/etc/xen/netbsd-vm.cfg
echo 'name = "netbsd-vm"' >> /usr/pkg/etc/xen/netbsd-vm.cfg
echo 'memory = 2048' >> /usr/pkg/etc/xen/netbsd-vm.cfg
echo 'vcpus = 1' >> /usr/pkg/etc/xen/netbsd-vm.cfg
echo 'vif = [ "type=ioemu, bridge=bridge0" ]' >> /usr/pkg/etc/xen/netbsd-vm.cfg
echo 'disk = [ "file:/var/lib/xen/images/netbsd-vm/NetBSD-10.0_RC4-amd64.iso,hdc:cdrom,r", "file:/var/lib/xen/images/netbsd-vm/netbsd-vm-disk.img,xvda,w" ]' >> /usr/pkg/etc/xen/netbsd-vm.cfg
echo 'boot = "d"' >> /usr/pkg/etc/xen/netbsd-vm.cfg
echo 'vnc = 1' >> /usr/pkg/etc/xen/netbsd-vm.cfg
echo 'vnclisten = "0.0.0.0"' >> /usr/pkg/etc/xen/netbsd-vm.cfg
echo 'vncport = 5901' >> /usr/pkg/etc/xen/netbsd-vm.cfg
echo '#vncpasswd = "yourpassword"' >> /usr/pkg/etc/xen/netbsd-vm.cfg
echo 'usb = 1' >> /usr/pkg/etc/xen/netbsd-vm.cfg
echo 'usbdevice = "tablet"' >> /usr/pkg/etc/xen/netbsd-vm.cfg
echo 'bios_override = "/usr/pkg/share/ovmf/OVMFX64.fd"' >> /usr/pkg/etc/xen/netbsd-vm.cfg
Start the VM:
xl create /usr/pkg/etc/xen/netbsd-vm.cfg
Check if the VM has started:
xl list
Open a console:
xl console netbsd-vm
Open a TigerVNC session, pointing to the Xen Server IP address: 5901 (for example: 192.168.10.13:5901)
I tried with bios, bios_path_override, firmware, firmware_override. Nothing is working.
Any idea ?