UEFI Graphics (VNC) - churchers/vm-bhyve GitHub Wiki

As of 27th May, bhyve UEFI now supports a frame buffer device which is accessible using VNC.

Update vm-bhyve

Make sure you are running at least vm-bhyve 1.1

Use a supported FreeBSD version

If building from source, graphics support is currently available in 12-CURRENT and 11-STABLE. If you prefer to use a binary release, you can use the 11.0 release candidate.

We do not support running graphics on any version lower than 11.

Get the latest UEFI firmware

You can install the UEFI firmware using the sysutils/uefi-edk2-bhyve port. This has a few big dependencies, so I don't recommend building from ports, but the package should make downloading the firmware easy. (pkg install uefi-edk2-bhyve).

(UPDATE!!! - pkg install sysutils/bhyve-firmware now installs edk2-bhyve and uefi-edk2-bhyve-csm as dependencies. The above sysutils/uefi-edk2-bhyve port has been deleted.)

If you are running vm-bhyve 1.1-p3 or later, just installing the port/package should be enough, as we automatically look in the correct place for the firmware. If you're using a previous version of vm-bhyve, you will still need to copy the firmware from /usr/local/share/uefi-firmware to /my/vm/dir/.config/

Update guest configuration

This has been tested with a Windows virtual machine that was already using the previous UEFI firmware. The following option needs to be added to the configuration file.

graphics="yes"

On starting the guest, an 800x600 frame buffer device should be added to the guest. We try to dynamically assign an available port for the vnc server to listen on. You can see the port assigned in vm list output (or in vm info guest under console-ports).

Additional configuration options

By default a PS2 mouse is created in the guest. This is the only supported mouse for older versions of Windows/FreeBSD. Newer versions support the XHCI mouse which works much better. The improved mouse can be enabled by adding the following config:

xhci_mouse="yes"

To properly use xhci mouse in FreeBSD guests after 13.0 the hms(4) driver should be used, to enable add this to /boot/loader.conf:

hw.usb.usbhid.enable=1
usbhid_load="YES"

On FreeBSD earlier than 13.0 please use https://github.com/wulf7/utouch (port misc/utouch-kmod).

If you want VNC to listen on a specific host IP address, specify the following option:

graphics_listen="1.2.3.4"

You can also choose a port other than 5900. Obviously if you have multiple guests, a different port number will need to be used for each. If not specified we automatically pick a port that is available, starting at 5900.

graphics_port="5901"

By default the screen resolution is set to 800x600. To specify a different resolution, use the following option

graphics_res="1600x900"

Please note, only the following resolutions are supported at the moment:

1920x1200
1920x1080
1600x1200
1600x900
1280x1024
1280x720
1024x768
800x600
640x480

The following option will cause bhyve to pause boot until a client connects to the VNC session. This can be useful for guest installs when a key needs to be pressed early in the boot process. By default this is set to auto, which causes vm-bhyve to wait on the first boot when run in install mode. Setting this to no will cause the guest to never wait, even in install mode.

graphics_wait="yes"