Using VirtualBox on a Machine Running Bhyve

VirtualBox is a popular and easy to use virtual machine manager. So is FreeBSD's native Bhyve.

This issue gets mentioned from time to time on FreeBSD forums, so I figured I'd put up this page rather than writing a response next time I see the issue.

I use Bhyve with vm-byve, a convenient way to manage Bhyve machines. However if I start a VirtualBox machine, it seems to start but its screen stays black.

The reason is that Bhyve's vmm module interfere with VirtualBox. To run VirtualBox, I first have to stop any Bhyve machines. You can use vm stop <machine-name>, or shut down the virtual operating system. Once it's stopped, unload the vmm module.
sudo kldunload vmm

If Bhyve gives a message that the module's in use, it means you forgot to shut down your Bhyve machine.

Once the module is unloaded, you can run VirtualBox without a problem. In my experience, I don't have to deliberately reload the vmm module, if I run vm start <machine-name>, the vmm module automatically loads.

So, if you're trying to run VirtualBox on a FreeBSD machine with Bhyve, the method above shouild fix the problem.