Educational ICT Virtualisation Specialist

Twitter LinkedIn E-mail
Precedence Technologies Ltd
Technology House, 36a Union Lane
Cambridge, CB4 1QB, United Kingdom
T: +44 (0)1223 359900
E: sales@precedence.co.uk
XenServer

Jump To: Support > KB > NetBSD > XenServer

NetBSD on XenServer

XenServer 8.4 and later do not support Paravirtualised (PV) guests so the regular XEN3_DOMU kernels that were used on earlier versions cannot be used. In NetBSD 10, PVH mode was added where the Xen device drivers are in the GENERIC kernel:
#Xen PV support for PVH and HVM guests
options         XENPVHVM
options         XEN
hypervisor*     at mainbus?             # Xen hypervisor
xenbus*         at hypervisor?          # Xen virtual bus
xencons*        at hypervisor?          # Xen virtual console
xennet*         at xenbus?              # Xen virtual network interface
xbd*            at xenbus?              # Xen virtual block device

i.e. You must use NetBSD 10 or later if you want to run on XenServer 8.4 or later

The kernel will be loaded with machine emulation (BIOS/uEFI) rather than by pygrub in the XenServer dom0. This means that the disk partitioning must support this, i.e. for BIOS it needs to have a MBR or GPT partition table (so you cannot have your NetBSD partition begin at sector 0), for uEFI it must have GPT with a small MS-DOS boot partition

On a non-xapi Xen installation (e.g. NetBSD dom0), you can boot a GENERIC kernel in PVH mode which does not require machine emulation, so you don't need to change boot partitioning as there is no BIOS/uEFI involved. With XenServer, you should be able to boot PV or PVH with the pv-in-pvh domain-type, but it doesn't seem to work.

Mailing list discussions and documentation

Installation notes

This patch fixes viridian=true

All the xe commands are to be run at the XenServer command prompt. XXXX represents your Virtual Machine's UUID value. You can get this from XenCenter or by using xe vm-list.

Basic VM from Other Media, BIOS mode - viridian=true

When creating in BIOS mode, platform:viridian is true and device model is qemu-upstream-compat:
# xe vm-param-get uuid=XXXX param-name=platform param-key=viridian
true
# xe vm-param-get uuid=XXXX param-name=platform param-key=device-model
qemu-upstream-compat
  • Thinks is running on Hyper-V as first hypervisor found is a Hyper-V stub, so everything is emulated
  • HDD is wd0 on emulated ATA controller (piixide)
  • NIC is emulated 100Mb RealTek 8139C+ (re)
  • CDROM is cd0 on emulated ATA controller (piixide)
  • dmesg?
Can convert to uEFI boot mode:
xe vm-param-set uuid=XXXX HVM-boot-params:firmware=uefi
uEFI mode behaves the same as BIOS except that has framebuffer:
genfb0 at pci0 dev 2 function 0: Cirrus Logic CL-GD5446 (rev. 0x00)

Basic VM from Other Media, uEFI mode - viridian=true

When creating in uEFI mode, platform:viridian is true and device model is qemu-upstream-uefi:
# xe vm-param-get uuid=XXXX param-name=platform param-key=viridian
true
# xe vm-param-get uuid=XXXX param-name=platform param-key=device-model
qemu-upstream-uefi
  • Thinks is running on Hyper-V
  • HDD is ld0 on emulated NVME controller (nvme)
  • NIC is emulated 1000Mb Intel i82540EM (wm)
  • Emulated ATA controller (piixide)
  • CDROM is cd0 on emulated ATA controller (piixide0:1:1)
  • dmesg?

Basic VM from Other Media, BIOS mode - viridian=false

Set viridian to be false:
xe vm-param-set uuid=XXXX platform:viridian=false
  • Is aware that is running as Xen guest in HVM mode
  • Emulated ATA controller (piixide) is automatically disabled
  • Network is xennet0 (paravirtualised, so fast)
  • HDD is xbd0 (paravirtualised, so fast)
  • No working CDROM (so cannot install), appears as broken wd0 because piixide being disabled so falls back to wdc0. To fix this, set CD device so that it is device xvdc, not xvdd by altering the vbd corresponding to the CD device to userdevice=2 (see port-xen/59350)
  • dmesg?

Convert a XenServer PV VM to PVHVM

Must be NetBSD 10

  1. Add a new 16MB virtual disk to the VM. Likely to appear as xbd1 (instructions will assume this)
  2. gpt create xbd1 - create GPT partition table
  3. gpt add -i 1 -b 64 -t efi -l efiboot xbd1 - create EFI boot partition labelled as efiboot
  4. Check partition table:
    # gpt show xbd1
       start    size  index  contents
           0       1         PMBR
           1       1         Pri GPT header
           2      32         Pri GPT table
          34      30         Unused
          64   32671      1  GPT part - EFI System
       32735      32         Sec GPT table
       32767       1         Sec GPT header
    
  5. Get wedges:
    # dkctl xbd1 listwedges
    /dev/rxbd1d: 2 wedges:
    dk0: efiboot, 32671 blocks at 64, type: msdos
    
  6. newfs_msdos dk0 - format EFI partition as FAT
  7. mount NAME=efiboot /mnt - mount EFI partition
  8. mkdir -p /mnt/efi/boot /mnt/efi/NetBSD - create directory structure
  9. cp /usr/mdec/bootx64.efi /mnt/efi/boot - copy x64 EFI boot loader
  10. sed 's/boot netbsd/boot hd1a:netbsd/' /boot.cfg > /mnt/efi/NetBSD/boot.cfg - create boot.cfg
  11. umount /mnt - unmount EFI partition
  12. Copy a GENERIC kernel to /netbsd instead of the XEN3_DOMU kernel
  13. Switch to XenServer command line
  14. Get UUID of VM
  15. xe vm-param-set uuid=XXXX domain-type=hvm - convert to HVM
  16. xe vm-param-set uuid=XXXX platform:viridian=false - set viridian to false
  17. xe vm-param-set uuid=XXXX HVM-boot-params:firmware=uefi - set to UEFI boot
  18. xe vm-param-set uuid=XXXX platform:device-model=qemu-upstream-uefi - (optionally) set device model
  19. xe vbd-list vm-uuid=XXXX type=CD --minimal - get UUID of CD device
  20. xe vbd-param-set uuid=YYYY userdevice=2 - set CD device to be xvdc, not xvdd
  21. VM will now boot in PVHVM mode via UEFI
On one line:
xe vm-param-set uuid=XXXX domain-type=hvm platform:viridian=false HVM-boot-params:firmware=uefi platform:device-model=qemu-upstream-uefi

Graphical display

By default, the VM has an emulated Cirrus Logic CL-GD5446 video card that runs at a resolution of 1024x768 with a 24-bit colour depth:
genfb0 at pci0 dev 2 function 0: Cirrus Logic CL-GD5446 (rev. 0x00)
genfb0: framebuffer at 0xf0000000, size 1024x768, depth 24, stride 3072
genfb0: shadow framebuffer enabled, size 2304 KB

Unfortunately, the wsfb video driver does not support a 24-bit colour depth, so X11 will fail to start with the message wsfb(0): Specified fbbpp (24) is not a permitted value.

If booting with uEFI, at the NetBSD boot prompt, you can type gop to view the screen modes available. Enter gop NUM to pick on. If booting with BIOS, you can use the vesa command instead. Without changing any VM settings you will be limited to:

  • 640x480x32
  • 800x600x32
  • 1024x786x24
You can switch the emulated video card for your VM to be standard VGA with more video RAM. Determine your VM's UUID (represented here as XXXX) and then:
xe vm-param-set uuid=XXXX platform:vga=std platform:videoram=16

With the above settings, the default resolution will be 1024x768x32. The gop command at the boot prompt shows that you can choose up to 2560x1600x32 if you really wish!

© Copyright Precedence Technologies 1999-2026
Page last modified on August 18, 2026, at 03:40 PM by sborrill