Error: allocating lock for new container: allocation failed; exceeded num_locks (2048)

Error: allocating lock for new container: allocation failed; exceeded num_locks (2048)

am getting this error when installing a module whats the issue

2025-01-14T23:46:11+03:00 [1:kobotoolbox7:systemd] Starting Podman kobotoolbox.service...
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] Created slice cgroup user-libpod_pod_786a8f3786c4d1642e5bb1593a807a04ee8aa91da470cecb924d15efe3a0d51a.slice.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] Removed slice cgroup user-libpod_pod_786a8f3786c4d1642e5bb1593a807a04ee8aa91da470cecb924d15efe3a0d51a.slice.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:podman] Error: allocating lock for new container: allocation failed; exceeded num_locks (2048)
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] kobotoolbox.service: Control process exited, code=exited, status=125/n/a
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:podman] Error: reading pod ID file: open /run/user/1009/kobotoolbox.pod-id: no such file or directory
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] kobotoolbox.service: Control process exited, code=exited, status=125/n/a
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] kobotoolbox.service: Failed with result 'exit-code'.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] Failed to start Podman kobotoolbox.service.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  postgres-app.service.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] postgres-app.service: Job postgres-app.service/start failed with result 'dependency'.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  redis-app.service.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] redis-app.service: Job redis-app.service/start failed with result 'dependency'.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  kpi-app.service.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] kpi-app.service: Job kpi-app.service/start failed with result 'dependency'.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  nginx-app.service.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] nginx-app.service: Job nginx-app.service/start failed with result 'dependency'.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  enketo_express-app.service.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] enketo_express-app.service: Job enketo_express-app.service/start failed with result 'dependency'.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  kpi_worker-app.service.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] kpi_worker-app.service: Job kpi_worker-app.service/start failed with result 'dependency'.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  mongo-app.service.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] mongo-app.service: Job mongo-app.service/start failed with result 'dependency'.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:agent@kobotoolbox7] See "systemctl --user status kobotoolbox.service" and "journalctl --user -xeu kobotoolbox.service" for details.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:agent@kobotoolbox7] Job for kobotoolbox.service failed because the control process exited with error code.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:agent@kobotoolbox7] task/module/kobotoolbox7/f5a7a8ac-5283-4c8a-9083-b502454a708a: action "configure-module" status is "aborted" (1) at step 80start_services
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] kobotoolbox.service: Scheduled restart job, restart counter is at 1.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] Stopped Podman kobotoolbox.service.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] Starting Podman kobotoolbox.service...
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] Created slice cgroup user-libpod_pod_c74e3efda835b143eb9c93d31a2de1645d502f1672a2907bc2edf94e357561d5.slice.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] Removed slice cgroup user-libpod_pod_c74e3efda835b143eb9c93d31a2de1645d502f1672a2907bc2edf94e357561d5.slice.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:podman] Error: allocating lock for new container: allocation failed; exceeded num_locks (2048)
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] kobotoolbox.service: Control process exited, code=exited, status=125/n/a
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:podman] Error: reading pod ID file: open /run/user/1009/kobotoolbox.pod-id: no such file or directory
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] kobotoolbox.service: Control process exited, code=exited, status=125/n/a
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] kobotoolbox.service: Failed with result 'exit-code'.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] Failed to start Podman kobotoolbox.service.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  postgres-app.service.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] postgres-app.service: Job postgres-app.service/start failed with result 'dependency'.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  redis-app.service.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] redis-app.service: Job redis-app.service/start failed with result 'dependency'.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  kpi-app.service.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] kpi-app.service: Job kpi-app.service/start failed with result 'dependency'.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  nginx-app.service.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] nginx-app.service: Job nginx-app.service/start failed with result 'dependency'.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  enketo_express-app.service.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] enketo_express-app.service: Job enketo_express-app.service/start failed with result 'dependency'.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  kpi_worker-app.service.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] kpi_worker-app.service: Job kpi_worker-app.service/start failed with result 'dependency'.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  mongo-app.service.
2025-01-14T23:46:12+03:00 [1:kobotoolbox7:systemd] mongo-app.service: Job mongo-app.service/start failed with result 'dependency'.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] kobotoolbox.service: Scheduled restart job, restart counter is at 2.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] Stopped Podman kobotoolbox.service.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] Starting Podman kobotoolbox.service...
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] Created slice cgroup user-libpod_pod_3f308d3aabd39e425edf0fdd9ddd01552071ac36fa818c18af04e886b8f1476b.slice.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] Removed slice cgroup user-libpod_pod_3f308d3aabd39e425edf0fdd9ddd01552071ac36fa818c18af04e886b8f1476b.slice.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:podman] Error: allocating lock for new container: allocation failed; exceeded num_locks (2048)
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] kobotoolbox.service: Control process exited, code=exited, status=125/n/a
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:podman] Error: reading pod ID file: open /run/user/1009/kobotoolbox.pod-id: no such file or directory
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] kobotoolbox.service: Control process exited, code=exited, status=125/n/a
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] kobotoolbox.service: Failed with result 'exit-code'.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] Failed to start Podman kobotoolbox.service.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  postgres-app.service.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] postgres-app.service: Job postgres-app.service/start failed with result 'dependency'.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  redis-app.service.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] redis-app.service: Job redis-app.service/start failed with result 'dependency'.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  kpi-app.service.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] kpi-app.service: Job kpi-app.service/start failed with result 'dependency'.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  nginx-app.service.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] nginx-app.service: Job nginx-app.service/start failed with result 'dependency'.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  enketo_express-app.service.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] enketo_express-app.service: Job enketo_express-app.service/start failed with result 'dependency'.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  kpi_worker-app.service.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] kpi_worker-app.service: Job kpi_worker-app.service/start failed with result 'dependency'.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  mongo-app.service.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] mongo-app.service: Job mongo-app.service/start failed with result 'dependency'.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] kobotoolbox.service: Start request repeated too quickly.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] kobotoolbox.service: Failed with result 'exit-code'.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] Failed to start Podman kobotoolbox.service.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  postgres-app.service.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] postgres-app.service: Job postgres-app.service/start failed with result 'dependency'.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  redis-app.service.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] redis-app.service: Job redis-app.service/start failed with result 'dependency'.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  kpi-app.service.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] kpi-app.service: Job kpi-app.service/start failed with result 'dependency'.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  nginx-app.service.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] nginx-app.service: Job nginx-app.service/start failed with result 'dependency'.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  enketo_express-app.service.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] enketo_express-app.service: Job enketo_express-app.service/start failed with result 'dependency'.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  kpi_worker-app.service.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] kpi_worker-app.service: Job kpi_worker-app.service/start failed with result 'dependency'.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] Dependency failed for Podman  mongo-app.service.
2025-01-14T23:46:13+03:00 [1:kobotoolbox7:systemd] mongo-app.service: Job mongo-app.service/start failed with result 'dependency'.

num_locks=2048

Number of locks available for containers, pods, and volumes. Each created container, pod, or volume consumes one lock. Locks are recycled and can be reused after the associated container, pod, or volume is removed. The default number available is 2048. If this is changed, a lock renumbering must be performed, using the podman system renumber command.

You can remove unused volumes:

runagent -m kobotoolbox7 podman volume ls |wc -l
runagent -m kobotoolbox7 podman volume rm --all # (possible to use [podman volume rm](https://docs.podman.io/en/v4.4/markdown/podman-volume-rm.1.html), that by default removes unused volumes

maybe some steps can be ran directly outside the container user env… (without runagent…). I have very little experience with it:

podman volume ls |wc -l
podman volume prune

Or increase num_locks in podman’s containers.conf file (on nethserver it appears to be at /usr/share/containers.containers.conf), might come with some performance penalty.

1 Like

i have tried to increase to 4096 but it says out of range

Here’s how to remove unused volumes: (Solution 1)

You may need to also run the podman volume rm -a or podman volume prune commands in the container user environments. (runagent -m app1)

This says

WARNING! This will remove all volumes not used by at least one container. The following volumes will be removed:
No dangling volumes found

Did you try removing volumes in rootless container user environments?

cd /home; for d in * ; do runagent -m "$d" podman volume rm -a; done

am still having issues

Is there a way to increase num_locks without the out of range error

did you run podman system renumber after the change?

1 Like

yeah i get the error below

Error: failed to open 4096 locks in /libpod_lock: numerical result out of range

Not the same error word per word but probably gives a good hint:

Received the following error:

Error: failed to open 16384 locks in /libpod_rootless_lock_1000: numerical result out of range

Describe the results you expected:

I would expect podman system renumber to remove the libpod_rootless_lock_1000 file which is too small and create a new one with the correct size.

It took me a little time to figure out that Podman was referring to a file in /dev/shm, so maybe add full path to the rootless lock file in error message.

Manually workaround:

rm /dev/shm/libpod_rootless_lock_1000

A more generic workaround:

rm "/dev/shm/libpod_rootless_lock_$(id -u)"
// DefaultSHMLockPath is the default path for SHM locks
DefaultSHMLockPath = /libpod_lock
// DefaultRootlessSHMLockPath is the default path for rootless SHM locks
DefaultRootlessSHMLockPath = /libpod_rootless_lock
1 Like
$ podman system renumber 
Error: failed to open 4096 locks in /libpod_lock: numerical result out of range

Resolved using

$ sudo rm /dev/shm/libpod_lock
$ sudo systemctl restart podman
1 Like

Thank you have been able to resolve