{"record":{"id":"0fc63b6ae13a4490","repo":"podman-container-tools/podman","slug":"stat-s-m","errorCode":null,"errorMessage":"stat %s: %m\n","messagePattern":"stat (.+?): %m\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/rootless/rootless_linux.c","lineNumber":475,"sourceCode":"      char path[PATH_MAX];\n      struct stat st;\n      int ret;\n\n      ret = snprintf (path, PATH_MAX, \"%s/%s\", dir, fname);\n      if (ret == PATH_MAX)\n        {\n          fprintf (stderr, \"internal error: path too long\\n\");\n          exit (EXIT_FAILURE);\n        }\n\n      ret = stat (path, &st);\n      if (ret < 0)\n        {\n          /* Ignore the failure if the file was deleted.  */\n          if (errno == ENOENT)\n            continue;\n\n          fprintf (stderr, \"stat %s: %m\\n\", path);\n          exit (EXIT_FAILURE);\n        }\n\n      /* Not an executable.  */\n      if ((st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) == 0)\n        continue;\n\n      exec_binary (path, argv, argc);\n      errno = 0;\n    }\n\n  if (errno)\n    {\n      fprintf (stderr, \"readdir %s: %m\\n\", dir);\n      exit (EXIT_FAILURE);\n    }\n}\n","sourceCodeStart":457,"sourceCodeEnd":493,"githubUrl":"https://github.com/podman-container-tools/podman/blob/a2409076ef2fef60ad9ac046375dedc7d9410ef4/pkg/rootless/rootless_linux.c#L457-L493","documentation":"Before executing a candidate hook, do_preexec_hooks_dir() stats '<dir>/<file>' (pkg/rootless/rootless_linux.c:468). Files deleted between readdir and stat (ENOENT) are skipped, so this fatal message means stat failed with another errno - typically EACCES (search permission denied on a path component), ELOOP (symlink loop), ESTALE (NFS stale handle), or EIO.","triggerScenarios":"A hook entry is a symlink chain forming a loop; the hooks dir sits on NFS and the file handle went stale; a parent directory of the hook lacks execute permission for the invoking user; concurrent repackaging of the hooks dir changes permissions mid-scan.","commonSituations":"Hooks on NFS with root_squash; SELinux denials on hook files; hook RPM updated while podman was starting; broken symlinks left by an uninstall script.","solutions":["Reproduce manually: 'stat <path-from-message>' to see the errno","Fix permissions on the file and every parent ('chmod a+rx' on dirs, 'chmod a+r' on the file) or relabel with restorecon","Remove dangling/looping symlinks from the hooks dir","If on NFS, move the hooks to local storage or remount with appropriate options"],"exampleFix":"# before\n$ stat /etc/containers/pre-exec-hooks/broken-link\nstat: cannot statx '/etc/containers/pre-exec-hooks/broken-link': Too many levels of symbolic links\n\n# after\n$ rm /etc/containers/pre-exec-hooks/broken-link\n$ podman version\n","handlingStrategy":"validation","validationCode":"# Pre-stat every hook exactly like the C helper will\nfor d in /etc/containers/pre-exec-hooks \"${PODMAN_PREEXEC_HOOKS_DIR:-}\"; do\n  [ -z \"$d\" ] || [ ! -d \"$d\" ] && continue\n  for f in \"$d\"/*; do\n    [ -e \"$f\" ] || continue\n    stat \"$f\" >/dev/null || { echo \"hook not stat-able: $f\" >&2; exit 1; }\n  done\ndone\n","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid symlinks in hooks directories; install real files","Keep hooks on local filesystems, not NFS with root squashing","Do not repackage hooks concurrently with podman startups"],"tags":["preexec-hooks","filesystem","permissions","nfs","symlink"],"backgroundTag":null,"analyzedSha":"a2409076ef2fef60ad9ac046375dedc7d9410ef4","analyzedAt":"2026-08-15T15:57:05.625Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}