[Solved] Container already locked for OpenVZ VPS

OpenVZ is one of the host virtulization technique using since years ago.. It’s simple and easy to manage from the command line. You can do almost all operations from the host machine command line interface itself.

Operations like, creation of VM, termination, start/stop, log into guest machine [here it’s container], migrating containers [VMs] from one host machine to another, etc.. are very simple to manage via commandline interface.

We already covered the basic operations [commands] in one of the previous article. If you are new to OpenVZ or you want to explore more from the host command line interface, just read the article added below:

15+ Commonly using OpenVZ commands and its usages

OpenVZ is a container based, OS level virtualization technique for Linux. OpenVZ creates multiple secure, isolated Linux containers (otherwise known as VEs or VPSs) on a single physical server. Each container performs and executes exactly like a stand-alone server. Read more…

In this blog post we are discussing about a common error while stopping a container from the host node. It’s because of the lock file existing on the node server. Error details and the solution is added/explained in this article.

If you get the error as “container already locked” for an OpenVZ VPS when you are trying to stop a VPS, then follow the steps mentioned here.

Assuming that your VPS ID or container ID is 111.

Error details:

------------
[root@server ~]# vzctl stop 111
Container already locked
------------

Solution:

1. Remove the lock.

# rm /vz/lock/VE_ID.lck

-------------
[root@server ~]#  rm /vz/lock/111.lck
rm: remove regular file `/vz/lock/111.lck'? y
-------------

2. Kill the checkpoint

# vzctl chkpnt VE_ID –kill

------------
[root@server ~]#  vzctl chkpnt 111 --kill
Killing...
------------

Done! 🙂 🙂

That’s it dude!! Go ahead!

Related links:

Post navigation

Arunlal A

Senior System Developer at Zeta. Linux lover. Traveller. Let's connect! Whether you're a seasoned DevOps pro or just starting your journey, I'm always eager to engage with like-minded individuals. Follow my blog for regular updates, connect on social media, and let's embark on this DevOps adventure together! Happy coding and deploying!

Leave a Reply

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