ERRO[0000] Refreshing container : error acquiring lock for container : file exists

Solution In Progress - Updated -

Environment

  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 9
  • podman

Issue

  • Whenever the host running podman is rebooted, podman ends up with the below error,
$ podman ps
ERRO[0000] Refreshing container <container-id>: error acquiring lock 0 for container <container-id>: file exists
ERRO[0000] Refreshing container <container-id>: error acquiring lock 1 for container <container-id>: file exists
ERRO[0000] Refreshing container <container-id>: error acquiring lock 2 for container <container-id>: file exists
CONTAINER ID  IMAGE       COMMAND     CREATED     STATUS      PORTS       NAMES

Resolution

  • Enable lingering for the user to avoid this error
  • To check lingering status for a user,
  $ loginctl user-status | grep -m1 Linger
  • To enable lingering for a user,
  $ loginctl enable-linger
  • Reconfirm if lingering is enabled by running $ loginctl user-status | grep -m1 Linger
  • Reboot the node and this error should be gone

Root Cause

  • User needs to have persistent login shell in order for podman to keep track of its container
  • Every time the host is rebooted, a new file is generated for every tootless user under /dev/shm for the user in the name of libpod_rootless_lock_$(id -u). When this file still exists after the host is rebooted, it may end up with this error

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments