Solved Upgrade might have broken vm-bhyve

Today, I went to start a vm-bhyve machine and there was a message that it was starting. When I opened vncviewer, however, there was nothing there. Doing vm list showed all VMs were stopped. The log showed error 4 with and a message that it had failed to find virtual switch public. I've had small issues in the past where I could fix connection issues by destroying and recreating the switch, This time, I got an error that the switch couldn't be destroyed with no other explanation.

I saw that I'd done a vm-bhyve update a couple of days ago, and I don't that that I've started a VM since. So, I tried to just reinstall it using portmaster (which took almost no time, only a bit longer than installing the package.)

So, with bated breath, I started a VM, and it was fine. I'm not sure if the update caused the problem, the version installed with portmaster was, (I think) the same. (I use latest rather than quarterly). I only did a cursory web search and didn't find anything that seemed helpful. I did run the FreeBSD update mentioned a few days ago. So, not quite sure of the cause, but reinstalling fixed the issue. Again, like the last time I ran into an issue solved by an update, I'm just posting this in case someone else has the same issue and my solution helps.
 
It's exactly why I don't use that sort of software. It's really well thought, with a plethora of functionalities.

You're quickly acquainted with that, then you are dependent. And when something broke, you don't know why and you don't know what to do. You are lucky that a simple reinstallation solved the problem.

Instead, when you write your own scripts, you can put your fingers inside and fix what went wrong.
 
Well, I didn't have, too, until I worked on it. It's rather a matter of available time and needs.

One of the VMs in my server brings internet in my local network, the other does the same for wifi. I cannot afford the slightest malfunction. It would be different if I had used VMs only for entertainment.
 
I applied the vm_network addition, but my bhyve vm - which is still working fine on 14.3 - does not start on 15.0.
The debug output is:

bhyve: bootrom_alloc: vm_mmap_mapseg: Invalid argument
Device emulation initialization error: Invalid argument

The log file from vm-bhyve is

ez. 05 21:36:09: initialising
Dez. 05 21:36:09: [loader: uefi]
Dez. 05 21:36:09: [cpu: 2]
Dez. 05 21:36:09: [memory: 4G]
Dez. 05 21:36:09: [hostbridge: standard]
Dez. 05 21:36:09: [com ports: com1]
Dez. 05 21:36:09: [uuid: bf7221c5-01fd-11ee-820f-f439091170d4]
Dez. 05 21:36:09: [debug mode: yes]
Dez. 05 21:36:09: [primary disk: disk0.img]
Dez. 05 21:36:09: [primary disk dev: file]
Dez. 05 21:36:09: initialising network device tap1
Dez. 05 21:36:09: adding tap1 -> vm-public (public addm)
Dez. 05 21:36:09: bring up tap1 -> vm-public (public addm)
Dez. 05 21:36:09: dynamically allocated port 5900 for vnc connections
Dez. 05 21:36:09: booting
Dez. 05 21:36:09: [bhyve options: -c 2 -m 4G -AHPw -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd -U bf7221c5-01fd-11ee-820f-f439091170d4 -u]
Dez. 05 21:36:09: [bhyve devices: -s 0,hostbridge -s 31,lpc -s 4:0,nvme,/zroot/bhyve/9front/disk1.img -s 5:0,nvme,/zroot/bhyve/9front/fossildisk.img -s 6:0,ahci,hd:/zroot/bhyve/9front/disk0.img -s 7:0,virtio-net,tap1,mac=00:a0:98:74:87:65 -s 8:0,fbuf,tcp=0.0.0.0:5900 -s 9:0,xhci,tablet]
Dez. 05 21:36:09: [bhyve console: -l com1,/dev/nmdm-9front.1A]
Dez. 05 21:36:09: starting bhyve (run 1)
Dez. 05 21:36:09: bhyve exited with status 4
Dez. 05 21:36:09: destroying network device tap1
Dez. 05 21:36:09: stopped
#
 
Dez. 05 21:36:09: [bhyve devices: -s 0,hostbridge -s 31,lpc -s 4:0,nvme,/zroot/bhyve/9front/disk1.img -s 5:0,nvme,/zroot/bhyve/9front/fossildisk.img -s 6:0,ahci,hd:/zroot/bhyve/9front/disk0.img -s 7:0,virtio-net,tap1,mac=00:a0:98:74:87:65 -s 8:0,fbuf,tcp=0.0.0.0:5900 -s 9:0,xhci,tablet]
Dez. 05 21:36:09: [bhyve console: -l com1,/dev/nmdm-9front.1A]
9front is known to not work. See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=290098
 
There may be multiple issues. I think the 9front issue is separate from what this thread is about. My netbsd image failed to boot but it was already borked a bit & I haven't pursued it further. Other OS VMs worked fine (free/open bsd, ubuntu, debian).
 
Well I did a fresh install of 15.0 today. vm-bhyve worked at first. I just installed Win11 and FreeBSD-14.3 to try to figure out how to upgrade with pkgbase. But when I went back today, once again it stopped working, saying it couldn't find the switch public, and again, not letting me destroy said switch. I'm sort of agreeing with bakul about possibly being multiple issues. I'm seeing various bhyve issues on these forums, although mine's with vm-bhyve and I don't know if it's an issue with regular bhyve as well.
 
Applying Mark Peeks's patch, as Bakul wrote, solved the problem for me.

Otherwise, I found that I had botched the upgrade process somewhat: my userland was still 14.3. That resulted in different errors than expected.
 
Back
Top