bhyve Help to spin up a Debian 13 VM with Bhyve

Hi guys,

I am trying to create a Debian virtual machine, I am following the handbook but I continue to fail. As per FreeBSD design, the process is intentionally counter intuitive and very convoluted, and this does not help... 😟

1) Preps:

I installed grub2-bhyve and bhyve-firmware, downloaded "Debian 13" (renamed as deb13.iso), create device.map

Code:
cat device.map
(hd0) ./deb.img
(cd0) ./deb13.iso

2) Steps I followed to install the OS on the vm:
Code:
1) Create working directory
mkdir vm
cd vm

2) Load kernel module
kldstat | grep vmm
doas kldload vmm
kldstat | grep vmm
41    1 0xffffffff84e00000   340438 vmm.ko

3) Create bridge
doas ifconfig tap0 create
doas sysctl net.link.tap.up_on_open=1
net.link.tap.up_on_open: 0 -> 1
doas ifconfig bridge0 create
doas ifconfig bridge0 addm ue0 addm tap0
doas ifconfig bridge0 up

4) Create Disk (and device.map)
truncate -s 10G deb.img

5) Load linux kernel
doas grub-bhyve -m device.map -r cd0 -M 1024M linuxguest

6) Launch installer
doas bhyve -A -H -P -s 0:0,hostbridge -s 1:0,lpc -s 2:0,virtio-net,tap0 -s 3:0,virtio-blk,./deb.img -s 4:0,ahci-cd,./deb13.iso -l com1,stdio -c 4 -m 1024M linuxguest

7) Finish installation and destroy vm
doas bhyvectl --destroy --vm=linuxguest

3. Test and run the VM:
Code:
## Linux kernel not found

grub> ls
(hd0) (hd0,msdos5) (hd0,msdos1) (cd0) (cd0,apple2) (cd0,apple1) (cd0,msdos2) (host)
grub> ls (hd0,msdos5)/
error: unknown filesystem.
grub> ls (hd0,msdos1)/
error: unknown filesystem.

The entries returned errors.

Thus I thought perhaps it must be boot with UEFI, and here I found some inconsistencies that confused even more.

Code:
# bhyve -AHP -s 0:0,hostbridge -s 1:0,lpc \
      -s 2:0,virtio-net,tap1 -s 3:0,virtio-blk,./disk.img \
    -s 4:0,ahci-cd,./install.iso -c 4 -m 1024M \
    -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
    guest

Is this command (and the others in handbook) to run the already created VM or to install a new one?

Why is it referring to tap1 once the only bridge has been created through the previous steps is tap0 ?

Why is it loading install.iso, are the instructions in that section to boot the VM or the create a new one?

It is not clear. 😟

Thanks for you help... 🙏
 
I did a fresh install using the debian 13 iso (on 15.0) but I don't use vm-bhyve, just plain bhyve. I did a graphical install. I chose all the defaults (except added ssh server) and installed everything in one partition. Once it got installed, I removed the iso line (-s 4,...) and rebooted.
Bash:
mkdir debian
cd debian
fetch https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-13.2.0-amd64-netinst.iso
truncate -s 32G debian.img
bhyve -c 1 \
        -s 0,hostbridge \
        -s 4,debian-13.2.0-amd64-netinst.iso \
        -s 5,nvme,debian.img \
        -s 10,virtio-net,tap2,mac=aa:bb:cc:dd:ee:ff \
        -s 20,xhci,tablet \
        -s 31,lpc \
        -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
        -s 11,fbuf,tcp=0.0.0.0:5900,w=1920,h=1080,wait \
        -l com1,/dev/nmdm0B \
        -m 4G -H \
        debian
 
If you use sysutils/vm-bhyve for managing and using bhyve, it has a command-line argument to enter to the shell of the VM. I don't know how could one do that without that port.

# vm console <insert-vm-name-here>
That's not the problem, I know this, I've used it before. The problem is that Debian 13.x installer uses some newer ext4 features/flags that the current bhyve grub2 loader doesn't understand, so you end up at the grub console. Even trying with to use `ext3` on a separate `/boot` partition doesn't seem to work for me.

And using the `uefi` loader doesn't (initially) work either, because it goes to a graphical console, which would need VNC, which I and others don't want because we do all/most of our managing over SSH terminals.

Fortunately, I found https://forums.freebsd.org/threads/...-unable-to-get-grub-working.98915/post-734907 which goes through how to start the installer with serial console, and then configure/update grub in the installed system with the serial console so can just use the standard tmux console.
 
Back
Top