bhyve VM suddenly stopped working (bhyve exited with status 4)

As the title says, my virtual machine (openbsd 7.9) suddenly stopped working and I have no clue why. I didn't change configuration I didn't change nothing, but after a random reboot it stopped starting and I was never able to get it running again no matter how many times I rebooted. If it helps somehow I was compiling some software from ports before I rebooted (and the VM stopped starting), but how could it possibly interfere the VM's wellbeing if everything is installed under /usr/local, and my VM is in /vm? I can't figure it out with just bhyve exited with status 4 - it doesn't help at all.

The first code block is openbsd79.conf, the second is vm-bhyve.log.

Code:
loader="uefi"
uuid="0e545f58-56cc-11f1-8e1d-002b670a7ff9"

cpu=1
memory=512M

network0_type="virtio-net"
network0_switch="public"
network0_mac="58:9c:fc:09:4d:c3"

disk0_type="virtio-blk"
disk0_name="openbsd.img"

bhyve_options="-w"

passthru0="0/20/3"

This is a working configuration and I always used to launch the VM with it.

Code:
2026-05-31T07:23:51+03:00: initialising
2026-05-31T07:23:51+03:00:  [loader: uefi]
2026-05-31T07:23:51+03:00:  [cpu: 1]
2026-05-31T07:23:51+03:00:  [memory: 512M]
2026-05-31T07:23:51+03:00:  [hostbridge: standard]
2026-05-31T07:23:51+03:00:  [com ports: com1]
2026-05-31T07:23:51+03:00:  [uuid: 0e545f58-56cc-11f1-8e1d-002b670a7ff9]
2026-05-31T07:23:51+03:00:  [debug mode: no]
2026-05-31T07:23:51+03:00:  [primary disk: openbsd.img]
2026-05-31T07:23:51+03:00:  [primary disk dev: file]
2026-05-31T07:23:51+03:00: initialising network device tap0
2026-05-31T07:23:51+03:00: adding tap0 -> bridge0 (public addm)
2026-05-31T07:23:51+03:00: bring up tap0 -> bridge0 (public addm)
2026-05-31T07:23:51+03:00: booting
2026-05-31T07:23:51+03:00:  [bhyve options: -c 1 -m 512M -AHPw -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd -w -U 0e545f58-56cc-11f1-8e1d-002b670a7ff9 -u -S]
2026-05-31T07:23:51+03:00:  [bhyve devices: -s 0,hostbridge -s 31,lpc -s 0:4:0,virtio-blk,/vm/openbsd79/openbsd.img -s 0:5:0,virtio-net,tap0,mac=58:9c:fc:09:4d:c3 -s 0:6:0,passthru,0/20/3]
2026-05-31T07:23:51+03:00:  [bhyve console: -l com1,/dev/nmdm-openbsd79.1A]
2026-05-31T07:23:51+03:00: starting bhyve (run 1)
2026-05-31T07:24:10+03:00: bhyve exited with status 4
2026-05-31T07:24:10+03:00: destroying network device tap0
2026-05-31T07:24:10+03:00: stopped

I am very new to bhyve and I have little experience in resolving such errors. Thank you in advance for your time.
 
I've also added debug="YES" to openbsd79.conf. The contents of a generated bhyve.log are:
Code:
vm_run error -1, errno 22

The error code of 22 translates as "Invalid argument". It doesn't seem to be much useful either, it's jut a low-level response without much context. But an invalid argument to what exactly, anyway? And what is the exact argument that is invalid? Is there a way to make it more verbose? How do I troubleshoot further?
 
There's one more thing I noticed: after each reboot, the VM tries to perform an automatic filesystem repair. I tried to boot off the install79.img disk and perform the fix myself. I rebooted one more time – the filesystem was clean already (I investigated that using vm console command) but the VM crashes with errno 22 anyways. I rebooted my PC - booted into the VM again, and it performs an automatic filesystem repair again.

And yes, I forgot to mention: it doesn't happen on other OpenBSD's VMs, only on this one. Honestly, I don't know what's going on here.
 
This one should be removed. The -w option is now given twice.
Why twice, I'm sorry?

Upd: I see it now, but deleting this option didn't solve the issue unfortunately, no impact

The thing is that, during the VM init I constantly see WARNING: / filesystem was not properly unmounted each time I reboot or do a manual filesystem repair. Something is corrupting my virtual disk?
 
Do you need to have that passthru0="0/20/3" in there? Also openbsd 7.9 just got released (6 days ago) so maybe something else to consider.
 
Do you need to have that passthru0="0/20/3" in there?
Yes I do, OpenBSD acts as a router in my setup. So keeping it running is of utmost importance...

Also, I want to investigate this further, because if it happened once it can happen any time in the future.

There should be some troubleshooting route, I just can't figure it out
 
Verify that your passtrhu device hasn't shifted its pci numbers and its driver is well ppt.

You can also test your VM without passthu, just to see if it launches or not.

You can try to upgrade the edk2 uefi software.
 
Back
Top