Tag Archives: Virtuozzo – cannot lock container error

Virtuozzo – Not able to start/stop a mounted VPS ?

There are many situations in which you may find a VPS in its mounted state. Usually a # vzctl start VEID, would attempt to start the container back. But there are situations in which this task would be hung in the system memory.

You may get something an error similar to this when attempting to start/stop the VE :

# vzctl stop VEID

Cannot lock container.

If you encounter this issue, check for the VE lock file, you can view the file and note the process which is being run :

# cat /vz/lock/VEID.lck

You can find a process id and the task name from the above command.  You can check what the process is by initiating :

# ps ax | grep PID

If this is some hung process waiting infinitely, try to kill the process, remove the lock file and attempt to start/stop the VE.

If the process is related to quota calculation, run the following command :

# veid=VE_ID; vzctl stop $veid; vzctl quotaoff $veid; vzctl quotainit $veid; vzctl start $veid; vzctl enter $veid

( just specify the VEID in the field VE_ID and run the above )

– Still, if you face this error, do the following on the mounted VE :

# vzctl --skiplock umount VEID

Now once the VE is unmounted, restart it.