Let’s look at how to shut down or reboot a frozen virtual machine on a Proxmox host if it doesn’t respond to the Reboot
, Stop
or Reset
commands in the web interface.
In my case, when trying to power off the Proxmox virtual machine, an error appeared:
trying to acquire lock... TASK ERROR: can't lock file '/var/lock/qemu-server/lock-152.conf' - got timeout
This error can also be found in the log file /var/log/pve/tasks/active
In my case, the VM doesn’t respond to the reset or forced shutdown commands from the Proxmox web interface.
Error: VM is locked (backup)
VM is locked (snapshot)
VM is locked (clone)
There are two commands available in the Proxmox host console to stop a running VM.
# qm shutdown <vmid>
This command is similar to briefly pressing the computer’s physical power button. This sends an ACPI signal to the operating system, initiating a graceful shutdown process. This is a safe way to gracefully shutdown a virtual machine, but it requires the QEMU guest agent to be installed and running in the guest OS.
# qm reboot <vmid>
A forced shutdown command for a VM is similar to powering off a physical computer:
# qm stop <vmid>
When you run this command, you will receive an error containing the name of the file that cannot be unlocked:
# qm stop 152
trying to acquire lock... can't lock file '/var/lock/qemu-server/lock-152.conf' - got timeout
Let’s try to remove all VM locks:
# qm unlock 152
trying to acquire lock... can't lock file '/var/lock/qemu-server/lock-102.conf' - got timeout
If the lock is not removed, you will need to delete the referenced lock file.
# rm -f /var/lock/qemu-server/lock-103.conf
Stop the VM:
# qm stop 103
If nothing else helps, you can forcefully kill the VM process. To get the process ID (PID) of a running virtual machine, list VMs on the host:
# qm list
As you can see here, the VM is running (STATUS = Running
) in the process with PID = 23549.
Or get the PID by filtering processes using the VMID of the unresponsive virtual machine:
# ps aux | grep "/usr/bin/kvm -id 152"
# kill -9 VM_PID
Check that the VM is stopped:
qm stop
and qm shutdown
commands only work when QEMU Guest Tools are installed on the guest operating system. You can check whether the QEMU agent is available in a VM by entering its ID:# qm agent 152 ping
QEMU guest agent is not running