Bhyve
Documentation
Tutorials
References
- Ubuntu 18.04 vs. bhyve (hazardous.org, 2018.5.17)
- Install Ubuntu on FreeBSD with byhve (www.davd.eu, 2017.4.2)
Management tools
libvirt
Failed attempt at running bhyve with libvirt
Notes:
- For some reason libvirtd does not create a virbr0 bridge. I created bridge0 manually and it seems to work.
- I'm using vtnet0 as this FreeBSD machine is already running inside a libvirt.
- It is possible that the host host machine does not support virtualization inside a virtual guest.
Steps:
- Configuration:
- FreeBSD version: 12.0-CURRENT r333017
- libvirt version: 4.2.0
- Install libvirt and download an ISO installation file of FreeBSD.
- Create an img file:
truncate -s 20G moinguest.img
- Configure network:
bridge='bridge0' eth='vtnet0' sudo ifconfig tap0 create sudo sysctl net.link.tap.up_on_open=1 sudo ifconfig "$bridge" create sudo ifconfig "$bridge" addm "$eth" addm tap0 sudo ifconfig "$bridge" up
- Configure host:
for mod in vmm if_tap if_bridge nmdm
do
if ! kldstat -qn "$mod"
then
sudo kldload "$mod"
fi
done
# Make sure everything is fine.
virt-host-validate bhyve
- Create moinguest.xml:
<domain type='bhyve'>
<name>moinguest</name>
<uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
<memory unit='GiB'>2</memory>
<currentMemory unit='GiB'>2</currentMemory>
<vcpu>1</vcpu>
<os>
<type>hvm</type>
</os>
<features>
<apic/>
<acpi/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<disk type='file' device='cdrom'>
<driver name='file' type='raw'/>
<source file='/usr/home/mpts/h/bhyve/FreeBSD-11.1-RELEASE-amd64-disc1.iso'/>
<target dev='hdc' bus='sata'/>
<readonly/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/usr/home/mpts/h/bhyve/moinguest.img'/>
<target dev='hda' bus='sata'/>
</disk>
<interface type='bridge'>
<model type='virtio'/>
<source bridge="bridge0"/>
</interface>
<serial type="nmdm">
<source master="/dev/nmdm0A" slave="/dev/nmdm0B"/>
</serial>
</devices>
</domain>
- Start libvirtd:
sudo service libvirtd onestart
- Run guest:
sudo virsh -c 'bhyve:///system' "define /usr/home/mpts/h/bhyve/moinguest.xml" sudo virsh -c 'bhyve:///system' "start --console moinguest"
and fail:
Domain moinguest defined from /usr/home/mpts/h/bhyve/moinguest.xml error: Failed to start domain moinguest error: internal error: Child process (/usr/sbin/bhyveload -m 2048 -d /usr/home/mpts/h/bhyve/moinguest.img moinguest) unexpected exit status 1
Troubleshooting
- See what would be executed:
virsh domxml-to-native bhyve-argv domain.xml