{"record":{"id":"99cbfa67a585119d","repo":"podman-container-tools/podman","slug":"error-creating-temporary-file-m","errorCode":null,"errorMessage":"error creating temporary file: %m\n","messagePattern":"error creating temporary file: %m\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/rootless/rootless_linux.c","lineNumber":1051,"sourceCode":"\n          if (asprintf (&tmp_file_path, \"%s/pause.pid.XXXXXX\", state_dir) < 0)\n            {\n              fprintf (stderr, \"unable to print to string\\n\");\n              kill (pid, SIGKILL);\n              _exit (EXIT_FAILURE);\n            }\n\n          if (tmp_file_path == NULL)\n            {\n              fprintf (stderr, \"temporary file path is NULL\\n\");\n              kill (pid, SIGKILL);\n              _exit (EXIT_FAILURE);\n            }\n\n          fd = mkstemp (tmp_file_path);\n          if (fd < 0)\n            {\n              fprintf (stderr, \"error creating temporary file: %m\\n\");\n              kill (pid, SIGKILL);\n              _exit (EXIT_FAILURE);\n            }\n\n          r = TEMP_FAILURE_RETRY (write (fd, pid_str, strlen (pid_str)));\n          if (r < 0)\n            {\n              fprintf (stderr, \"cannot write to file descriptor: %m\\n\");\n              kill (pid, SIGKILL);\n              _exit (EXIT_FAILURE);\n            }\n          close (fd);\n\n          /* There can be another process at this point trying to configure the user namespace and the pause\n           process, do not override the pid file if it already exists. */\n          if (rename_noreplace (AT_FDCWD, tmp_file_path, AT_FDCWD, pause_pid_file_path) < 0)\n            {\n              unlink (tmp_file_path);","sourceCodeStart":1033,"sourceCodeEnd":1069,"githubUrl":"https://github.com/podman-container-tools/podman/blob/a2409076ef2fef60ad9ac046375dedc7d9410ef4/pkg/rootless/rootless_linux.c#L1033-L1069","documentation":"During pause-process creation the intermediate parent creates a temp file with mkstemp('<state_dir>/pause.pid.XXXXXX') as staging for the atomic pause.pid write (pkg/rootless/rootless_linux.c:1048-1054). Failure _exits after SIGKILLing the pause child. The errno tells the story: ENOENT when the state dir ($XDG_RUNTIME_DIR/libpod/tmp) is missing, EACCES/EROFS when not writable, ENOSPC/EDQUOT when the runtime tmpfs is full, EMFILE/ENFILE on fd exhaustion.","triggerScenarios":"First rootless podman run after $XDG_RUNTIME_DIR was recreated empty (state dir absent); /run/user/<uid> tmpfs quota exhausted; another actor removed $XDG_RUNTIME_DIR/libpod/tmp mid-run ('podman system clean', manual rm); fd limit reached (EMFILE).","commonSituations":"Disk-full conditions on the runtime tmpfs (default size is a fraction of RAM, easily exhausted by large images in other tmpfs uses); stale or wiped XDG_RUNTIME_DIR after a session hiccup; systems with very low RLIMIT_NOFILE; races with concurrent 'podman system reset' by another terminal.","solutions":["Check space and permissions: 'df -h /run/user/$(id -u)' and 'ls -ld $XDG_RUNTIME_DIR/libpod/tmp'; free space or grow the tmpfs (logind RuntimeDirectorySize) if full","Recreate the state dir if missing: 'mkdir -p $XDG_RUNTIME_DIR/libpod/tmp' with normal perms, then retry","Check 'ulimit -n' and fd usage if errno was 'Too many open files'; raise the limit and retry","Avoid running 'podman system reset/Clean' concurrently with other podman commands","If errno is unexplained, capture 'strace -f -e trace=mkstemp,rename podman <cmd>' and report upstream"],"exampleFix":"# before\n$ df -h /run/user/1000\nFilesystem      Size  Used Avail Use% Mounted on\ntmpfs           1.6G  1.6G     0 100% /run/user/1000\n$ podman ps\nerror creating temporary file: No space left on device\n\n# after\n# free tmpfs space (or raise logind RuntimeDirectoryMaxUSec/RuntimeDirectorySize), then\n$ podman ps\n","handlingStrategy":"retry","validationCode":"# Ensure the pause state dir exists and the runtime tmpfs has room\nrt=\"${XDG_RUNTIME_DIR:-/run/user/$(id -u)}\"\nmkdir -p \"$rt/libpod/tmp\" 2>/dev/null || { echo \"cannot create $rt/libpod/tmp\" >&2; exit 1; }\ntouch \"$rt/libpod/tmp/.writable\" && rm -f \"$rt/libpod/tmp/.writable\" || { echo \"state dir not writable\" >&2; exit 1; }\ndf -Pk \"$rt\" | awk 'NR==2 { if ($4 < 10240) { print \"runtime tmpfs nearly full\" > \"/dev/stderr\"; exit 1 } }'\npodman \"$@\"\n","typeGuard":null,"tryCatchPattern":"if ! podman \"$@\"; then\n  rc=$?\n  # 'error creating temporary file' is often transient (ENOSPC/EMFILE)\n  df -h \"${XDG_RUNTIME_DIR:-/run/user/$(id -u)}\"; ulimit -n\n  sleep 2   # let a concurrent system reset finish, then retry once\n  podman \"$@\" && exit 0\n  exit \"$rc\"\nfi","preventionTips":["Monitor /run/user/<uid> tmpfs usage; grow logind's RuntimeDirectorySize if images/tools share it","Never run 'podman system Reset/Clean' concurrently with other podman commands","Raise RLIMIT_NOFILE on systems where many fds are open","After wiping XDG_RUNTIME_DIR manually, recreate libpod/tmp or log in again"],"tags":["filesystem","disk-full","pause-process","rootless","tmpfs","mkstemp"],"backgroundTag":null,"analyzedSha":"a2409076ef2fef60ad9ac046375dedc7d9410ef4","analyzedAt":"2026-08-15T15:57:05.625Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}