Fix “Cannot Start VM or Console Due to TASK ERROR: Can’t Lock File ‘/var/lock/qemu-server/lock-#.conf’ – Got Timeout”

Purpose

This document will delineate the steps necessary to correct an issue where you cannot start, stop, or open the console of a VM due to the following error:

TASK ERROR: can't lock file '/var/lock/qemu-server/lock-#.conf' - got timeout

Assumptions

This document assumes you have administrative access to the shell of the problem node, and that the problem node is available on the network.

Cause

This is often caused by a console session not closing out correctly or a hangup when moving between tabs of console sessions.

Solution

qm unlock ###

where ### is the unique VM ID of the virtual machine or container. If this does not work alone, safely reboot the host following use of this command.