podman-container-tools/podman · error
cannot save namespace handles: %m
Error message
cannot save namespace handles: %m
What it means
In the reexec_userns_join child (same block exists in reexec_in_user_namespace), get_and_save_ns_handles_with_lock(state_dir) failed — it creates/locks state_dir/ns_handles, gets nsfs file handles for the user+mount namespaces and saves them atomically — AND errno was NOT one of the tolerated fallback values (EOPNOTSUPP, EPERM, ENOSYS, ENOENT). Because the failure is 'unexpected', podman does not fall back to the pause process and _exit(EXIT_FAILURE)s. Real errnos here: ENOSPC/EIO writing the ns_handles file, EACCES/EROFS on the state dir, ENAMETOOLONG, lock-acquisition failures.
Source
Thrown at pkg/rootless/rootless_linux.c:1249
fprintf (stderr, "cannot chdir to %s: %m\n", cwd);
_exit (EXIT_FAILURE);
}
if (state_dir && state_dir[0] != '\0')
{
/* Try to use namespace file handles instead of a pause process. */
if (get_and_save_ns_handles_with_lock (state_dir) < 0)
{
/* Fall back to pause process only if kernel doesn't support nsfs handles,
if they are blocked (e.g. seccomp), or if the state directory doesn't exist yet. */
if (errno == EOPNOTSUPP || errno == EPERM || errno == ENOSYS || errno == ENOENT)
{
if (create_pause_process (state_dir, argv) < 0)
_exit (EXIT_FAILURE);
}
else
{
fprintf (stderr, "cannot save namespace handles: %m\n");
_exit (EXIT_FAILURE);
}
}
}
if (sigprocmask (SIG_SETMASK, &oldsigset, NULL) < 0)
{
fprintf (stderr, "cannot block signals: %m\n");
_exit (EXIT_FAILURE);
}
execvp ("/proc/self/exe", argv);
fprintf (stderr, "failed to reexec: %m\n");
_exit (EXIT_FAILURE);
}
static void
check_proc_sys_userns_file (const char *path)View on GitHub (pinned to a2409076ef)
Solutions
- Fix the state dir: ls -ld "$HOME/.local/share/containers" (and $XDG_RUNTIME_DIR/containers) — it must be owned by you and writable; df -h to confirm space
- Unset PODMAN_NO_PAUSE_PROCESS (or set it to 0) so rootless podman uses the pause-process fallback instead of ns handles, which does not hit this hard failure
- Shorten the state dir path if it approaches PATH_MAX
- Clear a corrupt ns_handles file: rm "$state_dir/ns_handles" and retry
Example fix
# before: ns-handles path fails hard export PODMAN_NO_PAUSE_PROCESS=1 podman system service # after: fall back to the pause process unset PODMAN_NO_PAUSE_PROCESS # default is the pause process podman system service
Defensive patterns
Strategy: fallback
Validate before calling
d="$HOME/.local/share/containers"
[ -d "$d" ] && [ -w "$d" ] || { echo "state dir missing/not writable: $d"; exit 1; }
df --output=pcent "$d" | tail -1 # leave headroom; ns_handles writes fail hard on ENOSPC Try / catch
# when ns-handle persistence keeps failing, switch to the pause-process mode if ! podman info >/dev/null 2>&1; then unset PODMAN_NO_PAUSE_PROCESS # pause process is the default fallback podman info fi
Prevention
- Keep the rootless state dir owned, writable, and with free space; monitor it like any database volume
- Default to unset PODMAN_NO_PAUSE_PROCESS unless you specifically need nsfs handles
- Keep state dir paths well under PATH_MAX; avoid deeply nested XDG overrides
When it happens
Trigger: PODMAN_NO_PAUSE_PROCESS=1 is set (ns-handles path active) and the state dir is unwritable, full, read-only, or its path exceeds PATH_MAX; corruption on the filesystem holding state_dir/ns_handles; flock contention failure inside acquire_ns_handles_lock.
Common situations: Disk-full or quota-exceeded home directories; state dir owned by another uid after uid changes; state dir on a read-only or failing mount; very long XDG paths.
Related errors
- cannot write to file descriptor: %m
- cannot write to pipe: %m
- cannot set %s namespace
- pause.pid file refers to PID %ld which is not a pause proces
- unable to print to string
AI-assisted analysis of podman-container-tools/podman@a2409076ef (2026-08-15).
Data as JSON: /api/errors/d116ac680269a01b.
Report an issue: GitHub.