podman - pull

potentially insufficient UIDs or GIDs available in user namespace

December 12, 2024



The error

$ podman pull docker.io/library/postgres:14
Error: writing blob: adding layer with blob "sha256:2d429b9e73a6cf90a5bb85105c8118b30a1b2deedeae3ea9587055ffcb80eb45": Error processing tar file(exit status 1):
potentially insufficient UIDs or GIDs available in user namespace (requested 0:42 for /etc/gshadow):
Check /etc/subuid and /etc/subgid: lchown /etc/gshadow: invalid argument

The podman configuration (shortened - only relevant parts):

$ podman info

idMappings:
    gidmap:
    - container_id: 0
      host_id: 1691400513
      size: 1
    uidmap:
    - container_id: 0
      host_id: 1691408836
      size: 1

About remapping and subordinate user and group IDs:

$ cat /etc/subuid
linuxadministrator:100000:65536
$ cat /etc/subgid
linuxadministrator:100000:65536

This is a corporate laptop and it came pre-configured that way.

The point is, user is missing in /etc/subuid and /etc/subgid.

The solution

$ sudo usermod --add-subuids 200000-265536 --add-subgids 200000-265536 $(whoami)

$ cat /etc/subuid
linuxadministrator:100000:65536
user:200000:65537
$ cat /etc/subgid
linuxadministrator:100000:65536
user:200000:65537

Make podman aware of the changes:

$ podman system reset
$ podman info

idMappings:
    gidmap:
    - container_id: 0
      host_id: 1691400513
      size: 1
    - container_id: 1
      host_id: 200000
      size: 65537
    uidmap:
    - container_id: 0
      host_id: 1691408836
      size: 1
    - container_id: 1
      host_id: 200000
      size: 65537

Now the podman command works:

$ podman pull docker.io/library/postgres:14