Bhyve

Documentation

Tutorials

References

Management tools

libvirt

Failed attempt at running bhyve with libvirt

Notes:

Steps:

  1. Configuration:
    • FreeBSD version: 12.0-CURRENT r333017
    • libvirt version: 4.2.0
  2. Install libvirt and download an ISO installation file of FreeBSD.
  3. Create an img file:
    truncate -s 20G moinguest.img
  4. 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
  5. 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
  6. 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>
  7. Start libvirtd:
    sudo service libvirtd onestart
  8. 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


CategoryHowTo CategoryVirtualization

MateuszPiotrowski/Bhyve (last edited 2020-10-18T23:35:15+0000 by SashaVigole)