How unlock a VM in Proxmox

When you can’t shutdown or reboot or even stop a VM in Proxmox it’s quite distressing.

Actually there is a reason for it. To simplify, a VM is a file, and to protect a file from corruption it’s locked. So when some abnormal condition occurs, or when you have a weird OS / virtualized hardware that doesn’t understand shutdown inits, you have a small problem.

Fortunately via Bob Cares and the command line we can now solve this problem.

You’re probably here anyway because you’ve noticed the UI doesn’t respond to any of your halt commands. Let’s tackle this the proper way, i.e., using the command line.

cat /etc/pve/.vmlist

Get the VMID, as per the UI would be good too, and then do this:

qm unlock <VMID>

Now in some circumstances this won’t work. Instead of it working, there will be more frustration and you might see this after a few seconds:

# qm unlock <VMID>
trying to acquire lock...
can't lock file '/var/lock/qemu-server/lock-<VMID>.conf' - got timeout

Do not fret. But first a reality check. Do you run the risk of forcibly closing an open file? If you are unsure, do not continue and phone a friend. For the brave soles who want to continue:

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

You’ll see a ton of text, so look carefully now.

kill -9 process_id


Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top