bhyve/OpenBSD

OpenBSD-UEFI Guests

As of FreeBSD 11.1-RELEASE, OpenBSD 5.9 amd64 and above can boot, install and run under bhyve’s native UEFI support (UEFI-GOP).

Note: All OpenBSD i386 releases must use grub2-bhyve as booting with i386 using UEFI is not supported.

The addition of the fbuf vga=vgaconf flag in bhyve(8) and setting it to off, allows the OpenBSD kernel to boot after being invoked by the OpenBSD UEFI boot loader.

Extending from the example provided on the bhyve/UEFI page:

Storage Preparation

truncate -s 9G disk.img

A minimum sparse disk image of 9GB is recommended so that all file sets can be installed, especially if packages or ports are to be used within the OpenBSD guest.

Boot the OpenBSD-UEFI Virtual Machine

bhyve -c 2 -m 4G –w -u -H \
        -s 0,amd_hostbridge \
        -s 3,ahci-hd,/path/to/install62.fs \
        -s 4,virtio-blk,disk.img \
        -s 5,virtio-net,tap0 \
        -s 29,fbuf,tcp=0.0.0.0:5900,w=800,h=600,vga=off,wait \
        -s 30,xhci,tablet \
        -s 31,lpc -l com1,stdio \
        -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
        openbsd-uefi

This will create a virtual machine with 4GB of RAM with a display resolution of 800 by 600 that can be accessed via VNC at: 0.0.0.0:5900

The fbuf wait parameter instructs bhyve to only boot upon the initiation of a VNC connection, simplifying the installation of operating systems that require immediate keyboard input. This can be removed for post-installation use.

Replace install62.fs with the current supported version of OpenBSD that you will be using as the guest. ISO images of the OpenBSD installer (install62.iso) will not boot in a UEFI environment as they do not contain the required UEFI components of the OpenBSD boot loader.

As the installer is not in an ISO format, ahci-cd cannot be used in this instance. Specifying ahci-hd is required to allow the installXX.fs to be read by UEFI bootrom.

When booting, depending on your VNC client, your VNC session may be disconnected (usually between switching from the boot loader to the kernel). Simply reconnect your VNC session and your console session will resume.

After installation, remove -s 3,ahci-hd,/path/to/install62.fs and move the first disk from -s 4,virtio-blk,disk.img to -s 3,virtio-blk,disk.img. This allows OpenBSD to boot normally after install.

Slot 0 should use amd_hostbridge for all OpenBSD instances, even on Intel based hardware as MSI/MSI-x interrupts which are used by the xhci/tablet for accurate mouse control are not available in OpenBSD unless the hostbridge is advertised as AMD.

sysutils/grub2-bhyve is not required for OpenBSD-UEFI.

OpenBSD-UEFI installations have been tested with OpenBSD versions with UEFI support on FreeBSD 11.1-RELEASE hosts.


CategoryVirtualization

bhyve/OpenBSD (last edited 2020-01-10T00:20:33+0000 by JasonTubnor)