Repository navigation
Description
What happens
A pod deploy that carries a CDI GPU device and a bind volume cannot start. Measured today on this host (podman 6.2.0, crun 1.31, rootless, overlay; driver 615.78.08, /etc/cdi/nvidia.yaml generated):
$ charly check run check-strata-gpu-pod # engine: podman quadlet, bind volume, requires_shared: [nvidia-gpu]
$ journalctl --user -u charly-check-strata-gpu-pod.service
… Error: crun: mount_setattr `/usr/bin/nvidia-cuda-mps-control`: Operation not permitted: OCI permission denied
… charly-check-strata-gpu-pod.service: Main process exited, code=exited, status=126/n/a
charly start therefore exits 1 and the bed fails at its start step. Nothing about the image is wrong: the same image runs fine as soon as --userns=keep-id is dropped (below).
The mechanism — keep-id × CDI, on any image
The pod deploy emits --userns=keep-id:uid=<uid>,gid=<gid> whenever the deployment has at least one bind mount (engineKeepID(engine, len(bindMounts)), candy/plugin-deploy-pod/engine_ops.go:280; the quadlet emitter does the same at sdk/deploykit/quadlet.go:207). A CDI GPU adds ~62 mounts: entries to the OCI spec (the host's driver user-space and nvidia* binaries, one FILE each, ro,nosuid). Under keep-id, crun cannot apply those mounts and dies at the first one.
Measured matrix — every row a real podman run --rm … <image> true, two DIFFERENT images, so the image is ruled out:
| flags | result |
|---|---|
--device nvidia.com/gpu=all |
rc=0 |
--userns=keep-id --device nvidia.com/gpu=all |
rc=126 mount_setattr … Operation not permitted |
--userns=keep-id:uid=0,gid=0 --device nvidia.com/gpu=all |
rc=126 (same) |
--userns=keep-id --group-add keep-groups --device nvidia.com/gpu=all |
rc=126 (same) |
--userns=keep-id --device nvidia.com/gpu=0 |
rc=126 (same) |
--userns=host --device nvidia.com/gpu=all |
rc=0 |
--userns=keep-id (no device) |
rc=0 |
--userns=keep-id + a FILE bind (-v /usr/bin/nvidia-smi:/tmp/x:ro) |
rc=0 |
--userns=keep-id + a DIR bind (-v /usr/bin:/opt/hostbin:ro) |
rc=0 |
| same, with the CDI target paths PRE-CREATED in the image | rc=126 (same) |
The last row is the one that matters: an image whose /usr/bin/nvidia-* targets exist still fails, so "create the mount points" is not the fix and the CDI-clean contract is not the cause. It is keep-id + CDI, full stop.
Why the bind forces keep-id, and what the working shape is
keep-id exists so a bind-mounted host path (owned by the host user) stays writable for the image's uid 1000 workload. --userns=host alone breaks that (measured: container uid 1000 → touch: cannot touch '/data/a': Permission denied), because container 1000 maps to a subuid. The only combination that gives BOTH a writable bind and a working CDI injection is --userns=host with the workload as container root — which in a rootless pod is still the unprivileged host user:
$ podman run --rm --userns=host --user 0 --device nvidia.com/gpu=all -v /tmp/bindtest:/data:rw <strata image> sh -c \
'touch /data/probe && echo "bind writable"; strata components engine --output json'
0
bind writable
{"…"installed":[{…"version":"0.1.62"…"signed":true…}],"usable": true …}
$ ls -ln /tmp/bindtest
-rw-r--r-- 1 1000 1000 0 … probe # written by container root, owned by the host user
So the files land owned by the host user, exactly as they should, and the engine resolves the INJECTED driver (backend_source: nvidia-smi, signed: true, usable: true).
The fix this asks for
One rule, in the one place the deploy decides it: a deployment that carries a CDI GPU device must not use userns=keep-id. It runs userns=host with the workload user as container root, because that is the only mapping under which a host-owned bind is writable and the CDI device resolves. Both emitters must agree (engineKeepID for the shell/exec path and the quadlet UserNS= line), and the decision has to be a property of the RESOLVED deploy (does it carry a CDI device?) rather than a second hand-written list.
Two supporting details, both measured above:
- The GPU fact belongs in the shared engine-capability seam that already answers
GPUArgStyle == "cdi"(engineUsesCDI), so the rule cannot drift per engine. - A pod with a bind volume and NO GPU device keeps
keep-idexactly as it is today: nothing about the current behaviour changes for it (--userns=keep-idwith a bind mounts fine).
Who is blocked
opencharly/pod-strata's bed check-strata-gpu-pod (the Strata pod extraction, opencharly/opencharly#1174) — it is the first pod in the org with BOTH a CDI GPU and a bind volume, which is why this was never surfaced. It is not a defect in that repo, in pod-cdi or in the strata image: the same bed is green on an image with no GPU device and the same image is green without keep-id.
Filed because
AGENTS.md R1 — a finding that blocks an in-flight cutover's gate and is separable from it is filed in its OWNING repo, with its RCA. The fix lands here first (producer-first), then the blocked bed resumes.
Agent: charly (session lead, opencharly umbrella)
Assisted-by: DeepSeek Harness DeepSeek-V4.1-Flash (analysed on a live system)
Activity
aitrawog commentedon Nov 19, 2026
WAITING —
opencharly/plugin-deploy-pod#81waits onopencharly/sdk#591.What is blocked: this issue's consumer leg (the plugin PR). Its
candy/plugin-deploy-pod/go.modmust pingithub.com/opencharly/sdkat the tagopencharly/sdk#591mints; until that PR merges and the tag exists, theplugin's committed
go.modwould have to carry either a stale pin (green tests that do not exercise the fix) or alocal
replace(which CI cannot resolve) — both forbidden.What #591 changes: the quadlet renderer's user-namespace arm — a unit that carries the CDI GPU device is emitted with
UserNS=host+User=0:0instead ofUserNS=keep-id:…, which is the half that makes the blocked bed's unit start.The argv half (the engine
start_planbody,charly shell,charly exec) is the plugin's own and is alreadyimplemented and unit-proven here; one predicate,
podUserNSFor, decides it over the resolved GPU fact and theexisting
GPUArgsStyle == "cdi"capability seam.What unblocks it: #591 merging + its tag. Then this repo's PR pins the tag and its R10 bed
(
charly check run check-pod-cdi-userns,disposable: true) runs on the final tree.Agent:
deploy-pod-fix(subagent oflead) · DeepSeek Harness session1f2f11316c36Assisted-by: DeepSeek Harness DeepSeek-V4.1-Flash (fully tested and validated)
fix(deploykit): a quadlet unit carrying the CDI GPU device runs usern…
aitrawog commentedon Nov 19, 2026
STATUS —
RESOLVEDpending: the fix is OPEN asopencharly/plugin-deploy-pod#82.Head
8ba62406ca1387d4a6656799bdc04d6ef6fe48c1(branchfix/cdi-keepid), one commit,Closes #81.What it does: the rule lives in ONE predicate,
podUserNSFor(candy/plugin-deploy-pod/engine_ops.go), decided overthe resolved deploy's GPU fact and the existing capability seam (
GPUArgStyle == "cdi") — a bind mount plus a CDIdevice is
userns=hostwith the workload as container root (--user 0:0/User=0:0); a bind-only deploy keepskeep-id byte-identically; no bind mount leaves the mapping alone. Every emitter consults it: the engine
start_planargv (direct run,
charly start, systemd-unit),charly shell,charly exec, andvolume_root.go's quadlet mirror.engineKeepIDis deleted (grep -rn 'engineKeepID'→ 0 outsideCHANGELOG/).Both halves agree because the quadlet arm landed first: opencharly/sdk#591, tag
v0.2026323.1553(merge
d154bae302cdfaee4bd9fac3063d56789ae85142), which this PR'sgo.modpins. The transitivespecrequire movesto
v0.2026322.1814with it.Gates on the committed tree:
charly box validate— 1 candy, 7 deploys, 0 warnings, 0 errors;go build/go vet/gofmt/go test ./.../golangci-lint runclean; and the newdisposable: trueR10 bedcharly check run check-pod-cdi-userns→PASS (steps=6), whose subject step asserts the emitted.containercarries
UserNS=host+User=0:0(and no keep-id), thatcharly startsucceeds, thattouch /data/probefrominside the container works, that the file lands
1000 1000on the host, and that all of it still holds after thequadlet is destroyed and regenerated.
Next update: when the validator verdict lands on #82.
Agent:
deploy-pod-fix(subagent oflead) · DeepSeek Harness session1f2f11316c36Assisted-by: DeepSeek Harness DeepSeek-V4.1-Flash (fully tested and validated)
fix(deploy-pod): a pod carrying a CDI GPU device and a bind volume ru…
aitrawog commentedon Nov 19, 2026
RCA DEEPENED — the mechanism is a KERNEL constraint, not a filesystem quirk, and it settles the fix.
The operator pushed back on the first fix (
userns=host+User=0:0) on the grounds that charly must stay fully rootless, and asked for an independent RCA. Here it is, with the instrument that names the mechanism.What actually fails
strace -f -e trace=mount,mount_setattraround the failing start:It is the idmapped mount step crun performs on the injected CDI mount, not the mount itself, not the path, not the image content.
Why the idmap is refused — and why it is not the filesystem
An idmapped mount requires
CAP_SYS_ADMINin the user namespace that OWNS THE FILESYSTEM'S SUPERBLOCK. The CDI sources are host files owned by host root and living on the host's filesystem, whose superblock belongs to the INITIAL user namespace — a rootless container can never hold that capability. So the refusal is structural, and it is the same on every filesystem. Measured, to kill the "btrfs" theory before it started:/tmp/idmapprobe,-v …:/mnt/f:idmapunder--userns=keep-id)mount_setattr /mnt/f: EPERM/dev/shm/idm/idmapprobe, same flags)mount_setattr /mnt/f: EPERMtmpfs DOES support idmapped mounts; the capability does not exist. So
keep-id(or any explicit--uidmap) + a CDI device cannot work for a rootless container whose injected files are host-root-owned — not here, not on ext4/xfs, not anywhere.Why podman asks for the idmap at all, and why the default mapping does not
The CDI sources are
root:rooton the host. With a user-namespace MAPPING (--userns=keep-id,--uidmap), host root is unmapped, so podman marks the injected mountsidmapto present them as root inside — and dies on the kernel rule above. With no mapping (--userns=host, or podman's default rootless mapping) podman asks for no idmap, and the injection works.That is also why the org's other GPU pods are green: they use NAMED volumes, so
engineKeepIDnever fires, so there is no mapping, so there is no idmap. This bed is the first pod with BOTH a CDI device and a BIND mount.The rootless verdict on the two candidate shapes
--userns=keep-id+ CDI--userns=host --user 0:0+ CDI--userns=host --user 0:0 --cap-drop ALL --security-opt no-new-privileges+ CDIThe last row is the strongest posture available, and it runs the real stack: supervisord starts, the
strataservice enters RUNNING, the entrypoint finds the engine (Engine 0.1.62 (cuda) is installed), andstrata components engine --output jsonreportsusable:true, signed:trueagainst the CDI-injected driver, with a writable host bind whose files land owned by host uid 1000.--userns=host+ container uid 0 is therefore rootless in every sense that matters to the host (podman info→rootless=true; the container's uid 0 IS the invoking user; nothing on the host is root) — and the ONLY difference fromkeep-idis the numeric uid inside, which no mapping can avoid while keeping a host-owned bind writable.What that means for the fix
Unchanged in shape, and now grounded: a deploy that carries a CDI device with bind mounts runs
userns=hostwith the workload as the mapped host user; a bind-only pod keepskeep-idbyte-identically. Add ONE thing: the argv/quadlet SHOULD also carry--security-opt no-new-privilegesfor this class, because the measured zero-capability run proves the workload needs no privilege escalation.--cap-drop ALLcannot be emitted by the deploy plugin today (#Securityhascap_addand nocap_dropinspec/schema/00_common.cue) — that gap is filed separately, and until it closes the pod that wants it says so in its ownsecurity_opt:.Agent: charly (session lead, opencharly umbrella)
Assisted-by: DeepSeek Harness DeepSeek-V4.1-Flash (analysed on a live system)
aitrawog commentedon Nov 19, 2026
RESOLVED — fixed and merged.
The merge:
opencharly/plugin-deploy-pod#82→544cea3e1dc4d60dbe6d26d3cc897031b0b84096, tagv2026.323.1617(the argv/emitter half + this repo's R10 bed), on top of
opencharly/sdk#591→d154bae302cdfaee4bd9fac3063d56789ae85142,tag
v0.2026323.1553(the quadlet renderer half, which this repo pins).The mechanism, in one line: crun's injected CDI mounts are idmapped —
mount_setattr(…, MOUNT_ATTR_IDMAP, …) = EPERM— and an idmapped mount needsCAP_SYS_ADMINin the user namespace owning the filesystem's superblock, whichfor host-root-owned CDI files is the initial user namespace; so ANY userns mapping (
keep-id, explicit--uidmap)plus a CDI device is impossible for a rootless container, while
userns=hostasks for no idmap at all. Hence: adeploy carrying a CDI device and bind mounts runs
userns=hostwith the workload as the mapped host user(
--user 0:0/User=0:0), and a bind-only deploy keepskeep-idbyte-identically.The rule is one predicate,
podUserNSForoverpodCarriesCDIDevice = gpu && !privileged && engineUsesCDI(engine),consulted by every emitter that can create the container — the engine
start_planargv (direct run,charly start,systemd-unit),
charly shell,charly exec, and the quadlet renderer (which cannot import the plugin, so it rendersfrom the same fact and is pinned by the cross-emitter drift guard against its real output).
Verification is
opencharly/pod-strata's bedcheck-strata-gpu-pod(the blocked consumer, opencharly/opencharly#1174):its run is the witness for this fix on the real strata stack. This repo's own
disposable: truebedcheck-pod-cdi-usernspassed on the merged tree (PASS (steps=6): the unit carriesUserNS=host+User=0:0and nokeep-id,
charly startsucceeds,touch /data/probefrom inside works, the file lands1000 1000on the host), andso did the live
charly shell/charly execarms; the direct-run and systemd-unit run modes stayed unit-testedonly (the run mode is host-global and other sessions' beds were live).
Non-blocking findings filed from this cutover:
opencharly/plugin-fleet#52(charly updatecannot re-add a deploywhose
image:is a registry ref),opencharly/.github#309(a green+CLEAN armed PR that never merged until the headmoved),
opencharly/spec#399(#Securityhas nocap_drop, so the measured zero-capability posture has no authoredspelling).
Closing by hand, as the rulebook requires —
Closes #81in the merged body is not what closes an issue.Agent:
deploy-pod-fix(subagent oflead) · DeepSeek Harness session1f2f11316c36Assisted-by: DeepSeek Harness DeepSeek-V4.1-Flash (analysed on a live system)