{"record":{"id":"c80590cf31f14e9d","repo":"podman-container-tools/podman","slug":"cannot-retrieve-cmd-line","errorCode":null,"errorMessage":"cannot retrieve cmd line","messagePattern":"cannot retrieve cmd line","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"pkg/rootless/rootless_linux.c","lineNumber":782,"sourceCode":"                _exit (EXIT_FAILURE);\n\n              for (i = size; i < new_size; i++)\n                FD_ZERO (&(open_files_set[i]));\n\n              size = new_size;\n            }\n\n          if (fd > open_files_max_fd)\n            open_files_max_fd = fd;\n\n          FD_SET (fd % FD_SETSIZE, &(open_files_set[fd / FD_SETSIZE]));\n        }\n    }\n\n  argv = get_cmd_line_args (&argc);\n  if (argv == NULL)\n    {\n      fprintf(stderr, \"cannot retrieve cmd line\");\n      _exit (EXIT_FAILURE);\n    }\n  // Even if unused, this is needed to ensure we properly free the memory\n  argv0 = argv[0];\n\n  if (geteuid () != 0 || getenv (\"_CONTAINERS_USERNS_CONFIGURED\") == NULL)\n    do_preexec_hooks(argv, argc);\n\n  listen_pid = getenv(\"LISTEN_PID\");\n  listen_fds = getenv(\"LISTEN_FDS\");\n  listen_fdnames = getenv(\"LISTEN_FDNAMES\");\n\n  if (listen_pid != NULL && listen_fds != NULL && strtol(listen_pid, NULL, 10) == getpid())\n    {\n      // save systemd socket environment for rootless child\n      do_socket_activation = true;\n      saved_systemd_listen_pid = strdup(listen_pid);\n      saved_systemd_listen_fds = strdup(listen_fds);","sourceCodeStart":764,"sourceCodeEnd":800,"githubUrl":"https://github.com/podman-container-tools/podman/blob/a2409076ef2fef60ad9ac046375dedc7d9410ef4/pkg/rootless/rootless_linux.c#L764-L800","documentation":"The C-preamble constructor reads its own command line via get_cmd_line_args(), which opens and reads /proc/self/cmdline and splits it into argv (pkg/rootless/rootless_linux.c:538-602, called at 780). This message means the function returned NULL - the open/read of /proc/self/cmdline failed, an allocation failed, or the buffer contained no arguments - and the process _exits before the Go runtime starts. (Note: the message has no trailing newline, so it may concatenate with subsequent shell output.)","triggerScenarios":"Running the podman binary in an environment without procfs mounted or with /proc masked (minimal chroots, some sandboxes); an LSM or seccomp policy denying open/read of /proc/self/cmdline; ENOMEM during the 512-byte-increment buffer growth; a kernel returning an error on the read.","commonSituations":"Executing podman inside a minimal container/chroot where /proc was never mounted or was unmounted; gVisor or other runtimes with /proc quirks; hard seccomp profiles from a nesting orchestrator; severe memory pressure.","solutions":["Ensure procfs is available: 'mount -t proc proc /proc' inside the namespace/chroot, then re-run","Check readability directly: 'cat /proc/self/cmdline' should succeed in the same environment","Relax the seccomp/LSM profile of the enclosing sandbox so /proc/self/cmdline is readable","Check memory limits ('ulimit -v') and raise them if the failure is allocation-related"],"exampleFix":"# before (inside a minimal chroot without /proc)\n$ podman version\ncannot retrieve cmd line\n\n# after\n$ mount -t proc proc /proc\n$ podman version\n","handlingStrategy":"validation","validationCode":"# The C helper reads /proc/self/cmdline; probe the same file first\nif [ ! -r /proc/self/cmdline ]; then\n  echo \"/proc is not available; podman cannot start here\" >&2\n  mount -t proc proc /proc 2>/dev/null || exit 1\nfi\npodman \"$@\"\n","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always mount procfs in chroots/namespaces where podman will run","Test sandbox seccomp profiles against podman before rolling them out","Watch memory limits - the cmdline buffer grows via malloc/realloc"],"tags":["procfs","rootless","environment","c","sandbox"],"backgroundTag":null,"analyzedSha":"a2409076ef2fef60ad9ac046375dedc7d9410ef4","analyzedAt":"2026-08-15T15:57:05.625Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}