bhyve Unable to VNC to bhyve VM - connection refused

I have installed a Debian 13 VM in bhyve, but I get a connection refused when I try to VNC to it. In my debian.conf file that I created, I used these parameters:

graphics="yes"
graphics_res="1600x1200"
graphics_wait="auto"
xhci_mouse="yes"
loader="uefi"
cpu=”2”
memory="8G"
network0_type="virtio-net"
network0_switch="public"
disk0_type="nvme"
disk0_name="disk0.img"

The install went fine, but after rebooting the VM and trying to VNC to the VM, I get a connection refused message. The vm list command shows the State as "Locked" and the VNC header shows: 0.0.0.0:5900.

I know the problem lies with this specific VM because I have created a VM using Windows 10, and it runs fine and I can connect to it without any problem.

What am I doing wrong?

Thank you,
Ed
 
I would try going to your vm Debian directory, and see if there's a file in there with a .lock at the end of it's name. If so, remove that file then I would try running vm poweroff Debian (or whatever you call it) and then run vm start Debian. The config file looks alright.
 
The vm list command shows the State as "Locked" and the VNC header shows: 0.0.0.0:5900.
'locked' means it may have crashed or not shutdown properly. And a connection refused means the port isn't open, in other words there's nothing running on that port, it is closed.
 
Is this on
The install went fine, but after rebooting the VM and trying to VNC to the VM, I get a connection refused message. The vm list command shows the State as "Locked" and the VNC header shows: 0.0.0.0:5900.
Do a "ps ax | grep bhyve" to see if bhyve is actually running.

Are you running 15.0 by any chance? If so revert this commit: https://github.com/freebsd/freebsd-src/commit/fb51ddb20d57a43d666508e600af1bc7ac85c4e8 -- change lines 74 76 & 77 to earlier smaller values and recompile bhyve and see if it fixes your problem.
 
I have installed a Debian 13 VM in bhyve, but I get a connection refused when I try to VNC to it. In my debian.conf file that I created, I used these parameters:

graphics="yes"
graphics_res="1600x1200"
graphics_wait="auto"
xhci_mouse="yes"
loader="uefi"
cpu=”2”
memory="8G"
network0_type="virtio-net"
network0_switch="public"
disk0_type="nvme"
disk0_name="disk0.img"

The install went fine, but after rebooting the VM and trying to VNC to the VM, I get a connection refused message. The vm list command shows the State as "Locked" and the VNC header shows: 0.0.0.0:5900.

I know the problem lies with this specific VM because I have created a VM using Windows 10, and it runs fine and I can connect to it without any problem.

What am I doing wrong?

Thank you,
Ed
Can you ssh into it?
 
'locked' means it may have crashed or not shutdown properly. And a connection refused means the port isn't open, in other words there's nothing running on that port, it is closed.
Since it's a fresh install of Debian 13, should I just try to reinstall it?

Ed
 
Use vm-install. Makes the whole monitoring, and creation streamlined.

Also, make sure you setup ssh on the vm before you reboot post install that way you can still access even if vnc is down
 
Use vm-install. Makes the whole monitoring, and creation streamlined.

Also, make sure you setup ssh on the vm before you reboot post install that way you can still access even if vnc is down
The command I used is: sudo vm install Debian_13 /zroot/bhyve/.iso/debian-13.4.0-amd64-netinst.iso

Is that the same as what you're suggesting?

Ed
 
I installed two weeks ago a debian 13 VM with bhyve (no vm-bhyve, just my scripts), and it works fine.
The story about something to do about efi loader comes from ignorance at the base. It's just the VM needs to have its own efi vars (there is an option in vm-bhyve). I don't want to enter in the details.

Debian is installed without sshd. You need to install and configure it. It's not FreeBSD. So, no ssh connection is possible by default.

It can be some annoying things with vm-bhyve. You always can install another debian VM or follow advice about this lock file.
 
I installed bhyve from package, I didn't compile it. Does that help?

Ed
See if you have /usr/src. If not and you have enough space, "pkg install FreeBSD-src-15" as root. Then you can go into /usr/src/usr.sbin/bhyve, make the necessary changes and do a make (you may have to be super user, not sure). Save a copy of the original /usr/sbin/bhyve and then do a "make install" as root. You can clean up the state of your crashed vm by doing "bhyvectl --vm=debian --destroy" -- if your vm is called something other than debian, use that name as an arg for --vm=. Now you can start the vm again.

Note that this is just for testing as there may also be another issue for recent amd64 machines. You must restore the original bhyve so that pkg upgrades continue working.
 
One thing with Debian, that I found is covered at https://www.davidschlachter.com/misc/freebsd-bhyve-uefi-shell As has been said earlier, it may fail to find the boot loader. Your issue sounds different. but the link I give may apply. In the cases where I ran into this though, the sequence was create the VM, install it with a vnc session, reboot, then again open vncviewer where I'd get the error mentioned in the Schlachter article.
Thank you...I'll check it out.

Ed
 
I have a page, (that has a link to vermaden's better page about vm-bhyve at https://srobb.net/vm-bhyve.html However, lately I've had trouble getting the VMs working after a reboot of the machine hosting the VMs.. Despite that, the general process might be useful, although you did mention that you had a Windows VM running, so it might not have anything of use, save the link to vermaden's page. I might as well give that link here, to save ya a click
 
Back
Top