Supported Guest Examples - churchers/vm-bhyve GitHub Wiki

This file lists guests that have been tested and shows the configuration options used to allow the installer and guest to boot. The goal is to build up a list of configurations that people can use in their own templates. In the majority of cases, guests have been tested using their default install options.

If you have successfully used a guest operating system not already listed here, please let me know so the list can be updated.

Please note I have left the network & disk settings out of these examples as the format is identical for all guests. See the network or disk examples pages for various configurations that can be used.

All guests require cpu and memory options, which are very simple -

cpu=1
memory=512M

If you are running vm-bhyve-0.11 or newer, the grub guests no longer need the boot command, so that option can be removed from the guest configuration file for both install & run.

In vm-bhyve-0.12.5, the grub_run_partition option is not needed for any grub-bhyve guests if partition 1 (msdos1/openbsd1) is correct.

For a full list of the available configuration options, along with a description of each, please see the man page or config.sample in the sample-templates directory.

FreeBSD / pfSense / MidnightBSD

This configuration file should support all verions of FreeBSD and MidnightBSD. For pfSense I used the embedded kernel option which seems to work perfectly.

guest="freebsd"
loader="bhyveload"

Windows

I would recommand using at least 1G memory for Windows, and the disk emulation needs to be ahci-hd.

guest="windows"
uefi="yes"
disk0_type="ahci-hd"
# if windows < 10, set sectorsize
disk0_opts="sectorsize=512"

NetBSD

guest="generic"
loader="grub"
grub_install0="knetbsd -h -r cd0a /netbsd"
grub_install1="boot"
grub_run0="knetbsd -h -r ld0a (hd0,msdos1)/netbsd"
grub_run1="boot"

OpenBSD

The example below is for OpenBSD 6.2 amd64, as the install command contains the version number and architecture. I have run 5.2 successfully and other versions should work fine as long as the version number in the install command is updated. i386 guests are also reported to work, again provided the install command is updated as required.

loader="grub"
cpu=1
memory=256M
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0.img"
grub_install0="kopenbsd -h com0 /6.2/amd64/bsd.rd"
grub_run0="kopenbsd -h com0 -r sd0a /bsd"
bhyve_options="-w"

resflash

resflash is a resilient OpenBSD image for USB flash memory. I is also great as virtual networking appliance. The example below is for resflash 20171202_1952 amd64.

loader="grub"
cpu=1
memory=256M
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0.img"
grub_run_partition="openbsd4"
grub_run0="kopenbsd -h com0 -r sd0d /bsd"
bhyve_options="-w"

To get up and running run the following commands:

vm create -t resflash resflash-vm
vm configure resflash-vm
cd /my/vm/resflash-vm
fetch https://stable.rcesoftware.com/pub/resflash/6.2/amd64/install/resflash-amd64-com0-115200-20171202_1952.img.gz
gunzip resflash-amd64-com0-115200-20171202_1952.img.gz
mv resflash-amd64-com0-115200-20171202_1952.img disk0.img
vm -f start resflash-vm

OpenBSD (UEFI)

Template to install OpenBSD in UEFI mode and VNC.

loader="uefi"
uefi_vars="yes"
cpu=4
memory=8G
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0.img"
bhyve_options="-w"
graphics="yes"
xhci_mouse="yes"
graphics_res="1920x1080"

Notes on OpenBSD UEFI:

  • Installer will select the wrong root disk by default. Make sure you select the correct one (sd1).
  • After installation completes vm poweroff openbsd-vm otherwise VM reboots into install disk.
  • Install disk needs to be install74.img and not an .iso disk.
  • sudo vm iso https://cdn.openbsd.org/pub/OpenBSD/7.4/amd64/install74.img

Alpine Linux

A tricky thing about Alpine is that the files on the install CD are named with a different suffix for each Alpine flavor. The base names are vmlinuz-[suffix] and initramfs-[suffix]. Adjust your vm .conf file accordingly:

Alpine flavor suffix
standard vanilla
virtual virt

Template for Alpine Virtual:

loader="grub"
cpu=1
memory=512M
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0.img"
grub_install0="linux /boot/vmlinuz-virt initrd=/boot/initramfs-virt alpine_dev=cdrom:iso9660 modules=loop,squashfs,sd-mod,usb-storage,sr-mod"
grub_install1="initrd /boot/initramfs-virt"
grub_run0="linux /boot/vmlinuz-virt root=/dev/vda3 modules=ext4"
grub_run1="initrd /boot/initramfs-virt"

Legacy template:

guest="linux"
loader="grub"
grub_install0="linux /boot/grsec initrd=/boot/initramfs-grsec alpine_dev=cdrom:iso9660 modules=loop,squashfs,sd-mod,usb-storage,sr-mod"
grub_install1="initrd /boot/initramfs-grsec"
grub_install2="boot"
grub_run_partition="msdos1"
grub_run0="linux /boot/vmlinuz-grsec root=/dev/vda3 modules=ext4"
grub_run1="initrd /boot/initramfs-grsec"
grub_run2="boot"

CentOS 6 (LVM)

Please note that the CentOS kernel and initramfs files contain the kernel version number, so will need changing if your system doesn't contain kernel 2.6.32-573.el6.

If you're comfortable in Linux, you can install grub2 in the guest, and configure vm-bhyve to use the grub configuration file instead. By default vm-bhyve looks for grub configuration files in /boot/grub/grub.cfg, although that can be controlled with the grub_run_dir and grub_run_file configuration settings. (See the CentOS 7 example below which boots using the /grub2/grub.cfg file in the guest)

guest="linux"
loader="grub"
grub_install0="linux /isolinux/vmlinuz"
grub_install1="initrd /isolinux/initrd.img"
grub_install2="boot"
grub_run_partition="msdos1"
grub_run0="linux /vmlinuz-2.6.32-573.el6.x86_64 root=/dev/mapper/VolGroup-lv_root"
grub_run1="initrd /initramfs-2.6.32-573.el6.x86_64.img"
grub_run2="boot"

CentOS 7

guest="linux"
loader="grub"
grub_install0="linux /isolinux/vmlinuz"
grub_install1="initrd /isolinux/initrd.img"
grub_install2="boot"
grub_run_partition="msdos1"
grub_run_dir="/grub2"

RedHat 6.5 (LVM)

This is based on using kernel 2.6.32-431.el6.x86_64 If your version contains a different kernel version, update the configuration below as necessary. If you don't know the kernel version, boot the guest with no grub commands specified. You can then use the vm console command to access the bootloader. From the bootloader browse the guest to find the correct kernel (ls (hd0,1)/).

To exit the bootloader, either enter the correct boot commands manually to boot the guest fully, or type exit to cause the bootloader to exit. As normal, use ~ + Ctrl+D to exit the console.

guest="linux"
loader="grub"
grub_install0="linux /isolinux/vmlinuz"
grub_install1="initrd /isolinux/initrd.img"
grub_install2="boot"
grub_run_partition="msdos1"
grub_run0="linux /vmlinuz-2.6.32-431.el6.x86_64 root=/dev/mapper/VolGroup-lv_root"
grub_run1="initrd /initramfs-2.6.32-431.el6.x86_64.img"
grub_run2="boot"

Debian & Ubuntu (Grub)

guest="linux"
loader="grub"
grub_run_partition="msdos1"

In addition, if you require Ubuntu 14.04, you also need to add the following otherwise it will sit at the grub prompt :

grub_run_dir="/grub"
grub_run_file="grub.cfg"

Debian (UEFI)

loader="uefi"
cpu=2
memory=2G
network0_type="virtio-net"
network0_switch="public"
disk0_type="ahci-hd"
disk0_name="disk0.img"
disk0_size="10G"
graphics="yes"
xhci_mouse="yes"
graphics_res="1024x768"
graphics_wait="yes"
uefi_vars="yes"

VyOS

OPTS of disk sector size is required otherwise installer will printout error message.

loader="grub"
disk0_opts="sectorsize=512"
grub_install0="linux /live/vmlinuz console=ttyS0 console=tty0 quiet initrd=/live/initrd.img boot=live nopersistent noautologin nonetworking nouser hostname=vyos"
grub_install1="initrd /live/initrd.img"
grub_install2="boot"

RouterOS(CHR)

As of this discussion, We can run CHR version of RouterOS 6.x within bhyve.
Below is a config example.

loader="grub"
cpu=2
memory="4G"
network0_type="virtio-net"
network0_switch="wan"
disk0_type="virtio-blk"
disk0_name="chr-6.44.5.img"
grub_run0="linux /boot/vmlinuz-64 crashkernel=16M"
grub_run1="initrd /boot/initrd.rgz"

Through some modifications to be made to the image downloaded from the MikroTik website, it is possible to properly run CHR based on RouterOS 7.x using the instructions provided on this tutorial.

Gentoo

Using /boot instead of /isolinux on this ticket https://github.com/churchers/vm-bhyve/issues/186

loader="grub"
cpu=1
memory=256M
grub_install0="linux /boot/gentoo root=/dev/ram0 init=/linuxrc  dokeymap looptype=squashfs loop=/image.squashfs  cdroot"
grub_install1="initrd /boot/gentoo.igz"
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0.img"

Here is the working config after install.

loader="grub"
cpu=1
memory=1024M
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0.img"
network0_mac="58:9c:fc:0e:4b:da"
grub_run_partition="2"
grub_run_dir="/grub"

OpenWRT

OpenWRT x86/64 can run with uefi-csm firmware.
below is a config example. just download the lastest disk image and put it to vm folder.
after startup vm, you can access console by vm console VM

loader="uefi-csm"
cpu=2
memory=512M
network0_type="e1000"
network0_switch="public"
disk0_type="ahci-hd"
disk0_name="openwrt-19.07.1-x86-64-combined-ext4.img"