This is a Vagrant plugin which enable FreeBSD's hypervisor bhyve as its backend.
- Known Issues
|Check bhyve support||Working|
|Cloning||Working(needs gcp package to copy image)|
|Network||Working(needs pf and dnsmasq to provider NAT and DHCP)|
|SSH/SSH run||Working(SSH run may needs bash)|
|File sharing||Working(NFS and vagrant-sshfs, maybe switch to VirtFS in the future)|
|Port forwarding||Not working|
|Suspend||Not supported by bhyve yet|
|Resume||Not supported by bhyve yet|
$ git clone https://github.com/jesa7955/vagrant-bhyve.git $ cd vagrant-bhyve $ bundle install --path vendor/bundle --binstubs
Note we will need package coreutils and dnsmasq(and of course we will need grub-bhyve to boot Linux box), vagrant-bhyve will try to install them with pkg.
Create a box
Run the box
After a box is created, you should create another Vagrantfile.
Vagrant.configure("2") do |config| config.vm.box = "boxname" end
then execute this command to start the box with bhyve
$ /path/to/vagrant-bhyve/bin/vagrant up --provider=bhyve
SSH into the box
After the box is booted(uped), you can ssh into by executing this command. Note that you will have to use password to authorize for now.
$ /path/to/vagrant-bhyve/bin/vagrant ssh
Shutdown the box and cleanup
This command will shutdown the booted VM and clean up environment
$ /path/to/vagrant-bhyve/bin/vagrant halt
Destroy the box
$ /path/to/vagrant-bhyve/vagrant destroy
FreeBSD can't be shutdown gracefully
This issue seems like a bug of Vagrant core. It even appears when I test with virtualbox provider. The are two know solutions:
config.vm.guest = :freebsdto Vagrantfile
config.ssh.shell = "sh"to Vagrantfile
Synced folder is not working correctlly
I met this issue when I try to use vagrant-bhyve to boot
Vagrant uses NFS as default synced folder type. When it fails on your
machine and box, you can:
config.vm.synced_folder ".", "/vagrant", type: "rsync"to your Vagrantfile to ensure that rsync type is used. Vagrant core will raise an error to inform you when there is not rsync find in PATH
vagrant plugin install vagrant-sshfsto enable vagrant-sshfs
Now this gem has been published on rubygems.org. You can install it through
vagrant plugin install vagrant-bhyve
to install it in a normal Vagrant environment
Bug reports and pull requests are welcome on GitHub at https://github.com/jesa7955/vagrant-bhyve.