bhyve How do I forcibly stop a VM under vm-bhyve?

I am using a VM with `Void Linux+Docker+Gitlab` managed by vm-bhyve. I have had this configuration running for three months. I am using FreeBSD 13.1-STABLE because it supports the Intel Ethernet Controller I226-V (13.1-RELEASE only supports I225-V). In the meantime my VM has twice froze. I was not able to connect via SSH and the console did not work either. I was also unable to stop the virtual machine using the vm stop gitlab command. The only way to stop it was to reboot the system, and after that I had to delete `run.lock` file manually, otherwise, the VM was locked and wouldn't start.

I don't know why the VM hangs. The `vm-bhyve.log` has no entries on this, and vm-bhyve shows my VM as just running. Previously I had the same `Void Linux+Docker+Gitlab` configuration working fine just on bare metal, without FreeBSD. Also I have another virtual machine running fine with Debian, but on a different server under FreeBSD 13.1-RELEASE. Perhaps there is some problem with 13.1-STABLE. After 13.2-RELEASE comes out I will try to upgrade to it and check there how my `Void Linux+Docker+Gitlab` setup works. After all, if the hanging problem persists, I will switch to Alpine instead of Void.

But that's not my question right now. I haven't found a way to forcibly stop a virtual machine under vm-bhyve in case it hangs. What to do in this situation? Rebooting the server completely is not too convenient. Maybe try just killing `bhyve process: gitlab (bhyve)`?
 
Check whether it's running (ps(1)). If not, just remove the lock-file, something bad happened and it was left over. You'll find it in your VM directory. If it IS running, try to kill the process instead (although vm poweroff should do exactly that).
 
That's happened to me a few times, and as zirias@ said, look in your bhyve/<vm> directory. You should see a lock file which you should remove. Sometimes I had that, tried poweroff -f and it failed, until I removed the lockfile.
 
Back
Top