bhyve Cannot delete locked vm

Please, how to destroy a locked VM using vm-bhyve:

Code:
$ doas vm destroy debian
/usr/local/sbin/vm: WARNING: debian appears to be running on bsd.localdomain (locked)

$ doas vm list
NAME    DATASTORE  LOADER  CPU  MEMORY  VNC  AUTO  STATE
debian  default    grub    4    8G      -    No    Locked (bsd.localdomain)

But no bhyve process is actually running.
 
Same thing happened to me. And I had another solution.
Code:
[root@freebsd /]# vm list
NAME        DATASTORE  LOADER  CPU  MEMORY  VNC           AUTO  STATE
freepbx-17  default    uefi    2    4G      0.0.0.0:5901  No    Running (1910)
truenas     default    uefi    2    4G      0.0.0.0:5902  No    Locked (freebsd)
[root@freebsd /]# vm destroy truenas
/usr/local/sbin/vm: WARNING: truenas appears to be running on freebsd (locked)


Start then Stop VM truenas help me to destroy.
Code:
[root@freebsd /]# vm start truenas
Starting truenas
  * found guest in /zroot/bhyve/truenas
  * booting...
[root@freebsd /]#
[root@freebsd /]# vm stop truenas
Sending ACPI shutdown to truenas
[root@freebsd /]# vm destroy truenas
Are you sure you want to completely remove this virtual machine (y/n)? y
 
Sometimes bhyve process is not running but vm device is still present in /dev/vmm. In that case do:
# destroy running vm
bhyvectl --vm=vm-name --destroy
# remove lock if running with sysutils/vm-bhyve
rm -rf /bhyve/vm-name/run.lock
 
Sometimes bhyve process is not running but vm device is still present in /dev/vmm. In that case do:
# destroy running vm
bhyvectl --vm=vm-name --destroy
# remove lock if running with sysutils/vm-bhyve
rm -rf /bhyve/vm-name/run.lock
^^ good to know that Thank you. This is another workaround way.
 
Back
Top