# I need help to start a FreeBSD guest in bhyve.



## errandonea (Jul 26, 2018)

Hello,

I'm trying to virtualize a FreeBSD 11 guest on a FreeBSD 11 host using bhyve.

My FreeBSD host itself is in a virtual machine (virtualbox), with 2 amd CPU, VT-x enabled and 2800M RAM.

I checked processor support for bhyve :
% grep Features2 /var/run/dmesg.boot

It gives me two Features2 lines and the first one includes the POPCNT flag.

So, I downloaded FreeBSD-11.2-RELEASE-amd64-bootonly.iso in folder /home/brice/bhyve and followed instructions from the handbook :
https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/virtualization-host-bhyve.html

# cd /home/brice/bhyve
# cp /usr/share/examples/bhyve/vmrun.sh .
# kldload vmm
# ifconfig tap0 create
# sysctl net.link.tap.up_on_open=1
# ifconfig bridge0 create
# ifconfig bridge0 addm em0 addm tap0
# ifconfig bridge0 up
# truncate -s 16G guest.img

Up to this point, all was fine.

Then, I tried :

# sh vmrun.sh -c 1 -m 1024M -t tap0 -d guest.img -i -I FreeBSD-11.2-RELEASE-amd64-bootonly.iso guestFreeBSD

Which gave me this output :

Launching vitual machine "guestFreeBSD" ...
vm_create: Device not configured

Which is not a very explicit error message.

Adding a few echo lines in /home/brice/bhyve/vmrun.sh, I figured out the error occurs when this script executes :

bhyveload -c stdio -m 1024M -d FreeBSD-11.2-RELEASE-amd64-bootonly.iso -d guest.img guestFreeBSD

I went on my investigation looking at the code for bhyveload here : 
https://github.com/freebsd/freebsd/blob/master/usr.sbin/bhyveload/bhyveload.c

I found this :

error = vm_create(vmname);      
    if (error) {      
        if (errno != EEXIST) {      
            perror("vm_create");      
            exit(1);      
        }      
        need_reinit = 1;      
    }      

function vm_create isn't defined in this file so I looked at the inclusions, which led me here :
https://github.com/lattera/bhyveng/blob/master/lib/libvmmapi/vmmapi.c

#define    CREATE(x)  sysctlbyname("hw.vmm.create", NULL, NULL, (x), strlen((x))) 
...
int vm_create(const char *name)      
{      
     return (CREATE((char *)name));      
}      

Hence, the "unconfigured device" the error message talks about seems to be some kernel parameter called "hw.vmm.create".

# sysctl hw.vmm.create

results in this output :

hw.vmm.create: beavis

I've no idea what it means.

Looking for "hw.vmm.create" on google, I found this page : https://lists.freebsd.org/pipermail/freebsd-virtualization/2013-April/001165.html

where I didn't understand anything. But it gave me the idea to try :

# sysctl hw.vmm.create=

hw.vmm.create: beavis
sysctl: hw.vmm.create=: Device not configured

So, here is the source from the error message. But I still don't know how I can "configure" this "device".

According to the handbook, the VM should start : I fulfill the requirements and followed the given instructions.

Can someone help me, please ?


----------



## SirDice (Jul 26, 2018)

errandonea said:


> I'm trying to virtualize a FreeBSD 11 guest on a FreeBSD 11 host using bhyve.
> 
> My FreeBSD host itself is in a virtual machine (virtualbox), with 2 amd CPU, VT-x enabled and 2800M RAM.


Not possible.

https://wiki.freebsd.org/bhyve#Q:_Do_VirtualBox_or_Hyper-V_support_nested_VT-x_EPT.3F


----------



## usdmatt (Jul 26, 2018)

> vm_create: Device not configured



This error is usually related to the feature not being supported by the system.
While Virtualbox is reporting features such as POPCNT to the guest, It's highly likely that bhyve is unable to actually access the vt-x functions in the processor.


----------



## errandonea (Jul 26, 2018)

OK, so that's not possible. Thank you for the quick answer.


----------

