We Value Your Time – OpenSource Community
We Value Your Time – OpenSource Community

How to resolve exceeded num_locks in Podman

exceeded num_locks in Podman

The exceeded num_locks in Podman occurs when the number of locks on a container exceeds the limit set in the configuration.

To resolve this issue, We need to either increase the number of locks available to containers by updating the Podman configuration file or clean up the resources consumed by Podman.

Error Statement (allocation failed; exceeded num_locks)

Error: error creating named volume “”: allocating lock for new volume: allocation failed; exceeded num_locks (2048)

[DevOps@DevOpsForU ~]# podman run docker.io/library/nginx:latest
Error: error allocating lock for new container: allocation failed; exceeded num_locks (2048)
[DevOps@DevOpsForU ~]# sudo podman volume ls | wc -l
2046

Solution 1

Can be solved by removing unused volume

[DevOps@DevOpsForU ~]# podman volume rm --all
000b1272a1d55719ccea28dc6003ebc529cce373b7d3d077ac6c8ad039d949b2
0036c6db105d0a085fd8358d7d2599cb97087688920aedb938950b9ad936e75d
00449bb56f24787e0390be0f025a7c7d7a851c8e7d6e93519a1ecc75d73429e9
005286687bbd43b8d33edcc53c67d84cefa4125319e1754614c0f6d3bde9eec6
006d46b57f21457d6c53d76c01c61099624b4a0812c38162d4c4727c041fc709
008aa8bf3d1ccfd8ee38748e871a24ec6f53ce3d0230b38345408d3aad1f9809
00e2a136bff2e284e8f64122c94ccd75f3d4e78ad15e7af1a322f6efe2ebf2eb
0103e4b203b27a1a4e91f98516f7e305a17081607b3d5c983f315d495e49396f

Solution 2

If there is an actual need for resources then this issue can be solved by increasing the number of locks, which can add the following line to the “/etc/containers/containers.conf” file:

[plugins.cri.containerd.default_runtime]
  runtime_root = "/var/run/containerd"
  [plugins.cri.containerd.default_runtime.runtimes.runc.options]
  process_start_timeout = "0s"
  systemd_cgroup = false
  [plugins.cri.containerd.default_runtime.runtimes.runc.mux]
  num_locks = 2046

This will increase the number of locks available to 2048, which should resolve the “exceeded num_locks” error. However, it’s important to note that increasing the number of locks may also increase the system’s resource usage, so it’s important to set a value that is appropriate for your system.

Hope this tutorial was informative and added some value. Please bookmark https://syshunt.com to get preferred results in your google search queries. Like us on Facebook.

You may also like Kubernetes 1.26 Installation with Cilium

Leave a comment

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

One thought on “How to resolve exceeded num_locks in Podman”