Bhyve overview – Episode 1

bhyve is a hypervisor for FreeBSD which uses the capabilities of virtualization of the CPUS (VT – x + EPT at Intel and AMD – V + IVR at AMD) and supplied VirtIO virtual devices to the guest systems. In a sense it is an alternative to Linux-KVM for FreeBSD. This solution comes in addition to the jails which are restricted to turn from FreeBSD. bhyve already supports Linux, FreeBSD, and OpenBSD guest systems. It is not known yet if Windows will be supported, but it is very likely. bhyve does emulate yet bios or VGA card, which means that you will have to work in text mode, exactly as for the jails.

It is interesting to note that bhyve is already supported by libvirt, allowing you to manage and control your VM through this API, locally or through a remote console (virt – manager). I probably will this test in a future article.
The virtual in virtual

I did not free physical machine with the prerequisites for bhyve, IE with a processor sufficiently recent to support both VT – x and EFA. So I used my 2012 with an i5 laptop, running Windows 7 (for work) and on which I install VMware Workstation. Why VMware? Because it provided an interesting feature: support for nested VT – x. Wholesale virtual machine that you’re running can itself turn virtual machines. So I’ll be able to create a FreeBSD virtual machine in VMware, then run bhyve therein to rotate to other VM inside.

Note that VirtualBox does not support nested VT – x, which means that your FreeBSD VM cannot run bhyve because lack of access to the VT – X + EPT of the host CPU instructions.
Let’s go

Bhyve project site provided a link to a text file containing the instructions. So I just follow them for the moment.
Load modules

To load the modules in a volatile manner:

# kldload vmm
# kldload if_tap

Note: If an error in loading the module vmm, it is likely that your CPU is not supported or that it lacks instructions VT – x or EPT.

To load the modules in a persistent manner (to the reboot), edit the file /boot/loader.conf

Clear All
vmm_load = “YES”
if_tap_load = “YES”

Retrieve script that runs

Script that runs should be present in /usr/share/examples/bhyve/ but it is also possible to recover at this address:

# fetch

This script will manage the creation of the VM, the mounting of iso, a storage device and of a network interface. Let it executable:

# chmod + x

Guest FreeBSD

Retrieve a FreeBSD 10 ISO:


Start the VM:

./ vm1

The bootloader of the invited FreeBSD should then appear.

After the kernel is loaded, it gets one magnifies mountpoint root not found error:

I found this thread which explains a workaround solution, but the problem is that I can enter anything on the keyboard, the characters are not supported. Bug? Limitation due to the use of VMware? It would seem rather that this is a problem of console not suitable.

Okay, do a second test. The Bhyve FAQ mentions the existence of images FreeBSD11-CURRENT RAW designed purpose to start in Bhyve. Start by visiting the FTP with the following address: to identify the name of the image. Then get this image with fetch (not detailed command because the URL is too long).

Then delete the file release.iso for not that he be captured by, unpack our RAW image, and let’s start all:

# rm release.iso
# unxz FreeBSD-11.0-CURRENT-amd64-20140714-r268622.raw.xz
#./ FreeBSD-11.0-CURRENT-amd64-20140714-r268622.raw vm1

And this time it works. We arrive at the login, just enter ‘root’ without password, and you can access our virtual system FreeBSD 11:

No access to the network at the moment, but it is normal because tap0 map created by the script is related to nothing (no bridge or routing). It seems not possible at the moment to “get out” of the vm or switch it off with the shutdown command. This last command will stop the guest system, but bhyve will continue to operate. The solution is to switch to a different tty (ALT + F2) and use the following command:

# bhyvectl – destroy – vm = vm1

Bhyve works rather nicely but is extremely Basic, many things are manually and a CDROM emulation seems not really to the point since FreeBSD10 failed to boot. Using a FreeBSD-11 image ready to circumvent the problem, the boot is going well and the keyboard is supported.

I explained my problem of FreeBSD10 that does not boot on irc (#bhyve), it recommended me to use vmrc. Maybe this will be a future article.
Guest Linux

bhyve says support the Linux guest. So do a test with Debian Wheezy.

# fetch

Then start the VM using the script but by specifying this time the location of the ISO:

#./ debian – 7.6.0 – amd64 – netinst.iso vm2

The test will be fast because this does not work:

In the absence of BIOS or UEFI bhyve is not able to boot alone. Bhyve FAQ indicates the need to use sysutils/grub2-bhyve. Let’s stop here and capitalize on vmrc in a next article because it seems that all this is so automated.

The first discovery of bhyve is very interesting. The idea is good, use the hardware virtualization VT – x + EPT and VirtIO for devices, which ensures maximum performance theoretically. Unfortunately its use is really not obvious, you can feel the experimental side of the thing. bhyve is still gross proceeds to be operate with better tools.