Skip to content

fix(pod): a rootless pod fails to start with mount_setattr on the injected nvidia-cuda-mps-control #1278

Done

Description

@aitrawog

Category

category:runtime

Type

type:fix

Remedy / files the remedy will touch

the pod deploy's CDI/device injection path (plugin-deploy-pod + the nvidia CDI spec): a rootless container must not attempt mount_setattr on an injected MPS binary, or must drop/replace that injection; document the required host condition

Cited design decision or org-rulebook rule (or none)

R1

Symptom

charly start comfyui-cdi fails at container creation; the unit exits 126:

conmon a978dfbfe9f15aca5c53 <error>: Failed to create container: exit status 1
charly-comfyui-cdi[894731]: Error: crun: mount_setattr `/usr/bin/nvidia-cuda-mps-control`:
  Operation not permitted: OCI permission denied
charly-comfyui-cdi.service: Main process exited, code=exited, status=126/n/a

What this is not

Not the volume: the deployment had just moved from a named volume to a bind
(Volume=/home/atrawog/.local/share/charly/models/comfyui:/home/user/ComfyUI) and the failing call
names the injected NVIDIA MPS binary, not that bind. The same error class would appear with any
volume backing.

Why it matters

The pod is unrecoverable through charly: charly start re-invokes the unit and the unit dies at
container creation, so systemctl --user reset-failed changes nothing. Rootless CDI injection of the
MPS control binary now attempts a mount_setattr the user namespace refuses.

What this issue owns

  1. Establish which host condition changed (driver/CDI spec regeneration injecting the MPS binary into
    the container mount list) — measured, not assumed.
  2. Make the injection work under rootless podman, or exclude the MPS binary with a documented reason.
  3. Fail with a message that names the fix, instead of a 126 and a pointer at systemctl.

Observed concurrently

The same outage window included a bed run that deployed a container under the LIVE name
charly-comfyui-cdi (opencharly/distro-cachyos#251). That is a separate defect; this issue is the
mount_setattr failure that keeps the pod down afterwards.

Filed issues

None separate: this is the finding.

Agent: image-lane-vram · Claude Code session 739c9baf-e4cc-465c-9028-0a77b9ea7617
Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)

Activity

  1. added
    category:runtime
    type:fix
    on Nov 24, 2026
  2. aitrawog commented on Nov 24, 2026

    @aitrawog
    ContributorAuthor

    STATUS

    STATUS — root-caused to a host-side CDI regeneration, with the timestamps measured.

    /etc/cdi/nvidia.yaml                  regenerated 2026-11-24T23:59  (grep -c nvidia-cuda-mps-control → 2)
    charly-comfyui-cdi active-enter       2026-11-24T21:38:59          (BEFORE that regeneration)
    nvidia-cdi-refresh.path               active (waiting) — triggers on NVIDIA driver/toolkit events
    nvidia-cdi-refresh.service            ran and wrote the new spec
    

    So: a CDI refresh fired at ~23:59, the regenerated spec injects /usr/bin/nvidia-cuda-mps-control, and
    rootless container creation now fails on mount_setattr for it. The failure is a property of
    the spec plus rootless podman, not of this image or its volume — any rootless GPU pod created
    after 23:59 hits it; a container that already exists (e.g. the ollama pod) keeps running.

    That reframes the fix into two candidate arms, and the choice should be measured, not guessed:

    1. Spec-side: regeneration should not inject an MPS binary that rootless cannot mount (nvidia-ctk
      flag or a filtered generate step), or
    2. podman-side: the deploy must tolerate the injection (cgroup/userns option) — measured against a
      container that starts fine before the refresh.

    Either way, charly start cannot recover today: the unit dies at container creation, so no reset or
    retry helps, and the error text points only at systemctl.

    Next update: on any event, or when the spec/rootless interaction is measured against a control case.

    Agent: image-lane-vram · Claude Code session 739c9baf-e4cc-465c-9028-0a77b9ea7617
    Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)

  3. aitrawog commented on Nov 25, 2026

    @aitrawog
    ContributorAuthor

    STATUS

    STATUS — the generator is ours, found at its call site. This closes the RCA.

    sudo's own audit line, captured during a deploy attempt:

    COMMAND=/usr/bin/bash -c 'set -e
    mkdir -p /etc/cdi
    nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml
    '
    

    and the source of that text:

    charly/box/cachyos/candy/nvidia-driver/charly.yml:47
      ExecStart=/usr/bin/nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml
    

    So the chain is: this candy regenerates /etc/cdi/nvidia.yaml on deploy → the generated spec injects
    /usr/bin/nvidia-cuda-mps-control as a read-only hostPath → rootless crun cannot mount_setattr a
    file mount there → container creation fails with status 126.

    Measured corroboration: I removed the entry by hand at 02:0x; the next charly start rewrote the
    file at 02:11:17 (the same second as the failing create) and the error returned verbatim. A hand patch
    therefore cannot survive — the fix belongs in this candy.

    Candidate fixes, to be decided by measurement:

    1. filter nvidia-cuda-mps*/.mps hostPath entries out of the generated spec (post-process), or
    2. pass the generator's own flag that omits MPS (if the installed nvidia-ctk has one — check its
      cdi generate --help), or
    3. keep the entry and make the deploy tolerate it under rootless (userns/cgroup option) — the option
      that needs a control case.

    Second, separate finding from the same second: the create used
    image=ghcr.io/opencharly/comfyui-cdi:check-cachyos-comfyui-pod-2026.328.2011 — the BED image — for the
    LIVE deployment named charly-comfyui-cdi. That is the opencharly/distro-cachyos#251 collision, and it
    means the live deployment's image may currently be wrong as well; it must be reset before any restart is
    believed.

    Agent: image-lane-vram · Claude Code session 739c9baf-e4cc-465c-9028-0a77b9ea7617
    Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)

  4. aitrawog commented on Nov 25, 2026

    @aitrawog
    ContributorAuthor

    STATUS

    STATUS — fix site located, and the filter is proven against a freshly generated spec.

    Call site: the sudo command I captured is emitted by plugin-gpu/candy/plugin-gpu/switch.go
    (mkdir -p /etc/cdi + nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml). It is the GPU
    capability plugin that regenerates the spec during a deploy/start, which is why a hand-patched spec is
    overwritten in the same second and the pod cannot start again.

    Filter, proven on a real spec (no host state touched):

    $ nvidia-ctk cdi generate --output=/tmp/cdi-test.yaml
    generated: 827 lines, nvidia-cuda-mps-control entries: 2
    $ <drop the device-node items whose hostPath names nvidia-cuda-mps*>
    filter removed: 2 | mps left: 0
    

    So the fix in plugin-gpu is: generate, then drop the nvidia-cuda-mps* hostPath items before
    writing the file — rootless crun cannot mount_setattr a FILE injection and no charly pod uses MPS.
    The generator offers no flag for it (checked nvidia-ctk cdi generate --help, 1.20.1: --disable-hook,
    --mode, --no-all-device exist; none excludes host-file injections).

    State of the pod: still down, and it cannot be recovered host-side — every charly start re-runs
    that generation. It also currently resolves a BED image
    (…:check-cachyos-comfyui-pod-2026.328.2011) for the live deployment, which must be reset to
    2026.328.1642 once this fix lands (distro-cachyos#251).

    Agent: image-lane-vram · Claude Code session 739c9baf-e4cc-465c-9028-0a77b9ea7617
    Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)

  5. aitrawog commented on Nov 25, 2026

    @aitrawog
    ContributorAuthor

    CLAIM

    CLAIM — owned by this session as the comfyui/EPERM leg of the CDI audit (opencharly/opencharly#1287). Close after the measured spike plus a re-created comfyui-cdi under keep-id.

    Agent: cdi-audit · Claude Code session f760307f-53b4-4f48-87da-00f95e5300ed
    Assisted-by: Claude Code deepseek-v4.1-flash:cloud (documentation reviewed)

  6. self-assigned this
    on Nov 25, 2026
  7. aitrawog commented on Nov 27, 2026

    @aitrawog
    ContributorAuthor

    RESOLVED — the failure mode is gone, and it is gone structurally rather than by a friendlier message.

    The mount_setattr EPERM came from a ROOTLESS container being handed the STOCK CDI spec, whose /usr/bin/nvidia-cuda-mps-control entry is a read-only FILE mount:

    $ grep -c nvidia-cuda-mps-control /etc/cdi/nvidia.yaml        → 2   (the stock spec the unit used to get)
    

    A deploy carrying a bind volume now runs under keep-id against the DERIVED devices-only spec, which keeps the device nodes and drops every mount and hook:

    $ grep -c nvidia-cuda-mps-control /home/atrawog/.local/share/charly/cdi/nvidia-devonly.yaml   → 0
    $ grep -cE '^\s+(mounts|hooks):' /home/atrawog/.local/share/charly/cdi/nvidia-devonly.yaml    → 0
    

    so there is no file mount left for mount_setattr to refuse. Measured live on the merged tree, twice in one run (fresh create AND a destroy→regenerate→start rebuild), via charly check run check-pod-cdi-userns (opencharly/plugin-deploy-pod#105): PASS (steps=6), pc-userns-keepid-user … exit=0, with the emitted unit read from disk as UserNS=keep-id:uid=1000,gid=1000 + PodmanArgs=--cdi-spec-dir …/.local/share/charly/cdi, and the bind written from inside the container as uid 1000.

    Item 3 of "What this issue owns" (a message that names the fix) is therefore moot for this class — the 126 is unreachable for a CDI pod, because the spec it is handed no longer carries the offending mount. charly-comfyui-cdi itself is on that shape now: AddDevice=nvidia.com/gpu=all, PodmanArgs=--cdi-spec-dir /home/atrawog/.local/share/charly/cdi, UserNS=keep-id:uid=1000,gid=1000.

    Agent: cdi-audit · Claude Code session f760307f-53b4-4f48-87da-00f95e5300ed
    Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

category:runtimetype:fix

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions