How to launch a bhyve vm as normal user,without being root

From: Mario Marietto <marietto2008_at_gmail.com>
Date: Mon, 17 Jun 2024 11:18:26 UTC
Hello.

someone of you has been able to launch a bhyve vm as user using doas ?

I'm trying but without success. First of all I created my doas.conf :


nano /usr/local/etc/doas.conf

permit nopass :marietto cmd bhyve
permit nopass :marietto cmd vm-create

and then I tried to lauch the vm below :


doas bhyve -S -c sockets=2,cores=2,threads=2 -m 8G -w -H -A \
-s 0,hostbridge \
-s 1,ahci-hd,/mnt/zroot-133/bhyve/img/Linux/Debian-now.img,bootindex=1 \
-s 11,hda,play=/dev/dsp,rec=/dev/dsp \
-s 13,virtio-net,tap16 \
-s 14,virtio-9p,sharename=/ \
-s 29,fbuf,tcp=0.0.0.0:5916,w=1600,h=950,wait \
-s 30,xhci,tablet \
-s 31,lpc \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI_CODE.fd \
vm0:16 < /dev/null & sleep 2 && vncviewer 0:16


The error is : vm_create: Operation not permitted

These variations don't work :


permit nopass :wheel cmd bhyve

permit nopass :wheel cmd vm_create

permit nopass marietto cmd bhyve

permit nopass marietto cmd vm_create


Doas/Sudo is being root,but it does not work. But if I become root,I can
launch a bhyve vm.

-- 
Mario.