I needed to do some testing with jails in FreeBSD and rather than enable nested jails I decided to use a FreeBSD VM. FreeBSD hosts VM images but their root disk is 30 GB when I only needed something in the 10 GB range. The official docs start with installing FreeBSD so I decided to replicate it with libvirt.

Overall it was straightforward except for getting the ISO to boot. The libvirt docs state to put the ISO first to boot from it. That did not work. The key part was discovering <boot dev='cdrom'/> in <os> to select the boot device.

After libvirt start freebsd-11 finished, running virsh console freebsd-11 brought up the boot sequence and then installer.

Working domain XML. The disk image was created using truncate.

<domain type='bhyve'>
       <boot dev='cdrom'/>
    <clock offset='utc'/>
      <disk type='file'>
        <driver name='file' type='raw'/>
        <source file='/vm/freebsd-11/freebsd-11.raw'/>
        <target dev='vda' bus='virtio'/>
      <disk type='file' device='cdrom'>
        <driver name='file' type='raw'/>
        <source file='/vm/freebsd-11/FreeBSD-11.2-RELEASE-amd64-bootonly.iso'/>
        <target dev='hda' bus='sata'/>
      <interface type='bridge'>
        <model type='virtio'/>
        <source bridge="bridge0"/>
      <serial type="nmdm">
        <source master="/dev/nmdm2A" slave="/dev/nmdm2B"/>