VM locked

One of the common reasons for ‘can’t stop a VM’ is that the virtual machine might have been locked. This usually happens when we try to stop a virtual machine when a backup is running.

So the VM locks itself to complete the backup process. Thus, we can wait for the backup process to delete the VM. Else we can unlock the virtual machine and stop the VM.

To unlock the VM we log in to the host node.

Then we find the VMID of the virtual machine using the command

cat /etc/pve/.vmlist

Once we get the VMID, we unlock the VM using the command

qm unlock

After we unlock the virtual machine we can delete the virtual machine from the web interface or using CLI.

Thus, we fix the error.

Timeout error

The timeout error occurs when the virtual machine is locked or the process is still running in the background.

If the virtual machine is locked we unlock the VM and stop the VM.

Else we log in to the Host node.

Then we find the PID of the Machine process using the command.

ps aux | grep "/usr/bin/kvm -id VMID"

Once we find the PID we kill the process using the command.

kill -9 PID

Thus, the VM will stop.