{"record":{"id":"77848d2b9398f046","repo":"abhigyanpatwari/GitNexus","slug":"bubblewrap-namespace-preflight-failed-result-det","errorCode":null,"errorMessage":"Bubblewrap namespace preflight failed: {result.detail or result.stderr_tail[-1000:]}","messagePattern":"Bubblewrap namespace preflight failed: (.+?)","errorType":"exception","errorClass":"SandboxError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/proposer_sandbox.py","lineNumber":498,"sourceCode":"    command = [\n        str(bwrap),\n        \"--unshare-user\",\n        \"--unshare-pid\",\n        \"--unshare-ipc\",\n        \"--unshare-uts\",\n        \"--die-with-parent\",\n        \"--new-session\",\n        *_runtime_mount_args(),\n        \"--proc\",\n        \"/proc\",\n        \"--dev\",\n        \"/dev\",\n        \"--\",\n        \"/usr/bin/true\",\n    ]\n    result = run_managed(command, timeout=10, require_pid_namespace=True)\n    if not result.ok:\n        raise SandboxError(f\"Bubblewrap namespace preflight failed: {result.detail or result.stderr_tail[-1000:]}\")\n    return bwrap\n\n\ndef pid_namespace_command(\n    command: Sequence[str],\n    *,\n    bwrap_bin: Path,\n) -> list[str]:\n    \"\"\"Wrap a trusted host command in an owned PID namespace.\n\n    This boundary deliberately preserves the host filesystem and network; its\n    sole purpose is making every descendant visible to the outer driver even\n    when a nested command creates a new session or process group.\n    \"\"\"\n\n    if not command:\n        raise ValueError(\"PID-namespace command must not be empty\")\n    return [","sourceCodeStart":480,"sourceCodeEnd":516,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/proposer_sandbox.py#L480-L516","documentation":"Raised by preflight_bubblewrap after the bwrap namespace self-test (/usr/bin/true inside a user/pid/ipc/uts-unsharing bwrap) fails. run_managed runs the probe with a 10s timeout and require_pid_namespace=True; if result.ok is false the sandbox treats containment as unavailable and surfaces result.detail or the last 1000 chars of stderr.","triggerScenarios":"bwrap is installed and executable but cannot establish the required namespaces: unprivileged user namespaces disabled (kernel.unprivileged_userns_clone=0), seccomp/AppArmor/SELinux blocking clone, a parent already in a restricted container (Docker without --privileged, systemd-nspawn), or the preflight timed out (>10s).","commonSituations":"Default Docker container without --security-opt or CAP_SYS_ADMIN; unprivileged userns disabled on Debian/older RHEL; AppArmor profile denies bwrap; running inside another bwrap/podman; glibc/bubblewrap version mismatch; /proc not properly mounted; CI runner hardened to disable unprivileged userns; corporate hardened laptop image; a podman/k8s pod that blocks clone3.","solutions":["Enable unprivileged user namespaces if your distro allows it: 'sudo sysctl -w kernel.unprivileged_userns_clone=1' (Debian/Ubuntu) and ensure bwrap is setuid if userns is unavailable.","Run the driver in a context that permits the needed namespaces: a privileged container, a VM, or bare-metal Linux.","Re-run the failing bwrap command manually (the one in preflight_bubblewrap) to read the full stderr and address the specific denial.","Update bubblewrap and glibc to versions known to work together; verify /proc is mounted and the kernel is recent enough."],"exampleFix":"// before\n# inside a default Docker container -> preflight fails\nbwrap = preflight_bubblewrap()\n// after\n# run the container with namespace caps, e.g.:\n# docker run --privileged --cap-add=SYS_ADMIN --security-opt apparmor=unconfined ...\nbwrap = preflight_bubblewrap()","handlingStrategy":"validation","validationCode":"import subprocess, shutil\n\ndef bwrap_works() -> bool:\n    bwrap = shutil.which('bwrap')\n    if not bwrap:\n        return False\n    cmd = [bwrap,'--unshare-user','--unshare-pid','--unshare-ipc','--unshare-uts',\n           '--die-with-parent','--new-session','--proc','/proc','--dev','/dev','--','/usr/bin/true']\n    return subprocess.run(cmd, timeout=15, capture_output=True).returncode == 0\n\nif not bwrap_works():\n    raise EnvironmentError('bwrap namespace preflight failed; enable unprivileged userns / use a privileged container')","typeGuard":"null","tryCatchPattern":"try:\n    bwrap = preflight_bubblewrap()\nexcept SandboxError as exc:\n    if 'preflight failed' in str(exc):\n        raise SystemExit(f'bwrap unavailable on this host: {exc}')\n    raise","preventionTips":["Run in a host/VM/privileged container that permits user namespaces.","Enable kernel.unprivileged_userns_clone=1 where allowed.","Avoid nested containers without --privileged.","Manually run the bwrap probe to read full stderr when it fails."],"tags":["bubblewrap","namespace","environment","security","sandbox"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}