NemoClaw icon indicating copy to clipboard operation
NemoClaw copied to clipboard

[WSL2][Onboard] Docker GPU patch fails with CDI device injection error on Docker Desktop WSL

Open hulynn opened this issue 5 months ago • 2 comments

Description

On Docker Desktop + WSL2 with an NVIDIA GPU, nemoclaw onboard step [6/8] fails at the "Docker GPU patch" sub-step. The patch invokes the sandbox container with --device nvidia.com/gpu=all (CDI syntax), but Docker Desktop WSL does not ship a CDI spec, so the create fails with CDI device injection failed: unresolvable CDI devices nvidia.com/gpu=all.

This contradicts preflight, which already announced it would use the --gpus compatibility path instead of CDI. The documented escape hatch NEMOCLAW_DOCKER_GPU_PATCH=0 is explicitly ignored on Docker Desktop WSL, so the only working workaround is NEMOCLAW_SANDBOX_GPU=0 which disables GPU passthrough entirely. Onboard never completes; an orphan <sandbox>-nemoclaw-gpu-backup-<ts> container is left behind on each retry.

Environment

Device:        Custom Windows desktop (hostname 2u1g-b650-0151), NVIDIA GeForce RTX 5090 32 GB
OS:            Windows 11 host + WSL2 Ubuntu 24.04.4 LTS (kernel 6.6.114.1-microsoft-standard-WSL2)
Architecture:  x86_64
Node.js:       v22.22.3
npm:           10.9.8
Docker:        Docker Desktop (WSL2 backend) — docker-desktop runtime
OpenShell CLI: openshell 0.0.44
NemoClaw:      v0.0.65
OpenClaw:      2026.5.27 (built from blueprint during sandbox image build)

Steps to Reproduce

  1. On a Windows 11 host with NVIDIA GPU + Docker Desktop (WSL2 backend) + Ubuntu 24.04 distro, ensure no prior install:

    nemoclaw uninstall --yes || true
    
  2. From the WSL2 shell, run the non-interactive curl install:

    export NVIDIA_INFERENCE_API_KEY=nvapi-...
    NEMOCLAW_NON_INTERACTIVE=1 \
    NEMOCLAW_INSTALL_TAG=v0.0.65 \
    NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE=1 \
    bash -c 'curl -fsSL https://www.nvidia.com/nemoclaw.sh | bash'
    
  3. Watch [1/8] preflight — it logs: Docker Desktop WSL detected; using Docker --gpus compatibility path instead of CDI spec validation.

  4. Wait through [6/8] "Creating sandbox" — sandbox image build (93 steps) completes successfully (~5–6 min).

  5. Onboard then invokes the "Docker GPU patch" sub-step to recreate the sandbox container with GPU access — this is where it fails.

Expected Result

The Docker GPU patch sub-step should use the same --gpus all (Docker --gpus compatibility path) that preflight already committed to, since Docker Desktop WSL does not ship a CDI spec at /var/run/cdi or /etc/cdi. The sandbox container should be recreated with working GPU passthrough and onboard should complete through step [8/8] with my-assistant reaching Ready.

Actual Result

[6/8] Creating sandbox
  Sandbox image build completes (Step 93/93, 346.8s).
  OpenShell Docker container detected; recreating it with NVIDIA GPU access...
  Docker GPU patch failed while OpenShell sandbox create was still waiting.
  Could not start GPU-enabled sandbox container:
    docker: Error response from daemon: CDI device injection failed:
    unresolvable CDI devices nvidia.com/gpu=all
  patched_create_option=--device nvidia.com/gpu=all
  Diagnostics saved: ~/.nemoclaw/onboard-failures/2026-06-16T09-45-44-359Z-my-assistant-docker-gpu-patch
  Escape hatches:
    NEMOCLAW_DOCKER_GPU_PATCH=0  skip this Docker GPU patch
      (Linux native Docker only; ignored on Docker Desktop WSL where the patch is required).
    NEMOCLAW_SANDBOX_GPU=0       skip GPU passthrough entirely (or rerun with --no-gpu).

Onboard aborts. The patch leaves an orphan container <sandbox>-nemoclaw-gpu-backup-<timestamp> (the renamed "backup" of the original non-GPU sandbox) that never gets cleaned up and collides on subsequent retries.

Only working workaround: NEMOCLAW_SANDBOX_GPU=0, which disables GPU passthrough entirely — defeats the purpose on a GPU host.

Logs

[1/8] Preflight checks
  ✓ Docker is running
  ...
  ✓ openshell CLI: openshell 0.0.44
  ✓ Port 8080 available (OpenShell gateway)
  ✓ NVIDIA GPU detected (NVIDIA GeForce RTX 5090, 32607 MB)
  Docker Desktop WSL detected; using Docker --gpus compatibility path instead of CDI spec validation.
  ✓ Sandbox GPU: enabled (auto)
  NVIDIA GPU detected; enabling OpenShell GPU passthrough. Use --no-gpu to opt out.

[6/8] Creating sandbox
  Docker-driver GPU patch active; allowing /proc writes required by Docker GPU initialization.
  Creating sandbox 'my-assistant' (this takes a few minutes on first run)...
  Step 92/93 : ENTRYPOINT ["/usr/local/bin/nemoclaw-start"]
  Step 93/93 : CMD ["/bin/bash"]
  Sandbox image build completed in 346.8s
  Creating sandbox in gateway...
  Built image openshell/sandbox-from:1781602794
  OpenShell Docker container detected; recreating it with NVIDIA GPU access before readiness wait...
  openshell-my-assistant-242e9396-e190-448c-a839-8f627ebfc403
  Docker GPU patch failed while OpenShell sandbox create was still waiting.

  Docker GPU patch failed.
  Could not start GPU-enabled sandbox container: docker: Error response from daemon: CDI device injection failed: unresolvable CDI devices nvidia.com/gpu=all

  Docker GPU patch did not complete successfully.
    sandbox_phase=2026-06-16
    sandbox_list_row=my-assistant  2026-06-16 09:45:41  Provisioning
    patched_create_option=--device nvidia.com/gpu=all
  Diagnostics saved: /home/local-qa/.nemoclaw/onboard-failures/2026-06-16T09-45-44-359Z-my-assistant-docker-gpu-patch
  Escape hatches:
    NEMOCLAW_DOCKER_GPU_PATCH=0  skip this Docker GPU patch (Linux native Docker only; ignored on Docker Desktop WSL where the patch is required).
    NEMOCLAW_SANDBOX_GPU=0       skip GPU passthrough entirely (or rerun with --no-gpu).
  The failed sandbox/container has been left in place for inspection.

Orphan container left behind:
  $ docker ps -a --filter "name=openshell-my-assistant"
  CONTAINER ID   IMAGE                            STATUS                  NAMES
  869d0735fbd3   openshell/sandbox-from:...       Exited (137)            openshell-my-assistant-...-nemoclaw-gpu-backup-1781603142955

Found while debugging WSL CI pipeline failure: https://gitlab-master.nvidia.com/cloud-service-qa/nemoclaw/nemoclaw-test/-/jobs/341956917

Related (different layer, not duplicate): NVB#4496790 — generic Docker/WSL CDI spec missing at the NVIDIA Container Toolkit layer. The fix here is in NemoClaw's Docker GPU patch logic: on Docker Desktop WSL it should use --gpus all (the path preflight already commits to), not the CDI syntax --device nvidia.com/gpu=all.


NVB#6331355

hulynn avatar Jun 16 '26 10:06 hulynn

Confirmed reproducible on current main. The preflight detects Docker Desktop WSL and logs that it will use the --gpus compatibility path, but that detection result is never passed to the GPU-patch mode selector. selectDockerGpuPatchMode only receives {image, device, backend}, so it calls dockerReportsNvidiaCdiDevices(), which returns true because Docker Desktop advertises CDI spec directories — and buildDockerGpuModeCandidates then offers CDI (--device nvidia.com/gpu=all) as the first candidate. The create-only probe passes, but the actual recreate fails with the CDI injection error because the WSL distro has no usable nvidia.com/gpu spec.

This is distinct from #5180: PR #5198 (which closed #5180) added the CDI-injection failure classification, the --no-gpu recovery hint, and the warning that NEMOCLAW_DOCKER_GPU_PATCH=0 is ignored on Docker Desktop WSL — but it did not change mode selection. The patch still prefers CDI on this runtime.

Two follow-ons observed while reproducing:

  • On the early failure path, only the newly created container is removed; the original is already renamed to *-nemoclaw-gpu-backup-<timestamp> before that point, so failed/retried runs leave orphan backup containers behind.
  • The escape hatch NEMOCLAW_DOCKER_GPU_PATCH=0 is force-ignored on Docker Desktop WSL, so users currently cannot opt out of the failing patch without disabling GPU entirely.

#5537 threads the existing Docker Desktop WSL detection into the mode selector and skips CDI on that runtime so the patch uses --gpus all (the path preflight already commits to). This step is only reached after the [2/8] gateway-bind issue (#5513 / #5534); the orphan-backup cleanup is a separate follow-up.

abhi-0906 avatar Jun 17 '26 12:06 abhi-0906

Opened #5541 for the orphan-backup symptom: when the GPU recreate fails early (after the original is renamed to *-nemoclaw-gpu-backup-<timestamp>), onboard now restores the pre-patch sandbox — remove the failed new container, rename the backup back, and start it — instead of leaving the backup orphaned and the sandbox without a live original (which collided on retries). #5537 makes the patch succeed on Docker Desktop WSL so this path is no longer hit there; #5541 covers any other early recreate failure.

abhi-0906 avatar Jun 17 '26 12:06 abhi-0906