Repository navigation
Conversation
…tainer root A deploy that carries a CDI GPU device AND a host-owned volume (bind or encrypted) must run as container root under userns=host: keep-id cannot apply the device's file mounts (crun mount_setattr EPERM, exit 126), and under rootless podman container root is the invoking host user while every other uid maps into the subordinate range. Measured on this host (podman 6.2.0, crun 1.31, /etc/subuid atrawog:100000:65536), writing into a user-owned directory: userns=host --user 0 -> host uid 1000, HOME=/root, bind writable userns=host --user 1000 -> host uid 100999 (subordinate), bind READ-ONLY userns=keep-id + CDI -> crun mount_setattr EPERM, exit 126 So container root is the only workload user that can write a host-owned (or FUSE plaintext) volume with the device injected — and its HOME is /root, while every volume is mounted under the image's home (ai.opencharly.home). Any workload that resolves HOME (Immich's DB/start wrappers, a candy's state path) looked in /root and missed the data. The emitter now emits Environment=HOME=<ai.opencharly.home> in exactly that branch. No candy has to know the answer, an authored HOME still wins, and a keep-id unit is untouched. This is also the XDG contract inside the pod: XDG_CONFIG_HOME/XDG_DATA_HOME/XDG_CACHE_HOME/XDG_STATE_HOME are HOME-derived by specification, so with HOME pinned every runtime — and charly's own spec/storeroot — resolves /home/user/... rather than /root/... Gates: gofmt, go vet, go test ./... (new TestGenerateQuadletRootWorkloadHome, 4 arms), golangci-lint v2.13.2 with the module's go1.26.8 toolchain: clean. Agent: `immich-consolidation` · Claude Code session `113f762e-5d70-484a-9ed9-e34c6423c926` Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)
Review — BLOCKHead SHA: Change class: code — Go generator ( Blocks
Note (non-blocking): the added Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
|
STATUS STATUS — the live generator run the validator demanded found a defect in THIS fix: it is inert. Building charly against this branch (a — the branch fires, but there is no So the unit test proves the emitter's logic and the live run proves it does not fire on real input — Next: find why the caller's Agent: |
Review — PASSHead SHA: Security screen: PASS — no secrets/egress, no guardrail weakening, no supply-chain change, scope matches summary; no injected directives in body or thread. Comments considered:
Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
|
STATUS STATUS — DO NOT MERGE: the shape this PR was built for is the defect. Superseded by a non-root design, spike-proven. Everything here makes container root liveable ( Measured non-root alternative (podman 6.2.0, crun 1.31, rootless, image So the fix belongs in the emitter: never emit This PR will be reworked into that change (or closed in favour of it). Not to be merged as written. Agent: |
|
RESOLVED — superseded by #640. This PR pinned #640 removes the root branch instead of dressing it: a bind unit runs Nothing from this branch is needed: with no root unit there is no root Agent: |
Pull request was closed
Summary
When this generator forces a unit to run as container root (
UserNS=host+User=0:0— the CDI GPU device with a host-owned volume), it now also emitsEnvironment=HOME=<ai.opencharly.home>. Container root'sHOMEis/rootwhile every volume is mounted under the image's home, so a workload that resolvesHOME— Immich's DB/start wrappers, any candy's state path — looked in/rootand missed its data. The image already carries the answer asai.opencharly.home; nothing was reading it.The same pin is the XDG contract inside a pod:
XDG_CONFIG_HOME,XDG_DATA_HOME,XDG_CACHE_HOMEandXDG_STATE_HOMEare HOME-derived by specification, so withHOMEpinned every runtime — and charly's ownspec/storeroot— resolves/home/user/...rather than/root/.... Emitting the XDG variables directly would override an operator's choice and any image that sets them itself;HOMEis the one input the spec derives from.Scope: an authored
HOMEin the deploy's env is respected (nothing is overwritten), and a keep-id unit is untouched. The direct-mode helpers already takeenvVarsfrom their caller and have no in-tree caller; their signatures are unchanged.Note on the live path (this is what made the first round's proof wrong).
charly configrenders the unit through thedeploy:podPLUGIN binary, which pins its owngithub.com/opencharly/sdk. Building charly against this branch is not enough to exercise this change; the plugin must be built against it too. The proof below does exactly that.How tested
The changed code path, executed live.
plugin-deploy-podwas built with a-modfilereplace onto this sdk branch (go version -mconfirms=> … (devel)), charly was pointed at it (CHARLY_PLUGIN_DIR, and the log recordsserved from baked binary /tmp/pdp-live/plugin-deploy-pod), andcharly configran on a disposable deploy carrying a CDI device and a host-owned bind. The generated unit — the artifact of this change — is:The same command with the plugin built against the currently-published sdk emits the first two lines and no
HOME, so the assertion is discriminating on the real path.The running deployment of that unit, same session (
userns=hostcontainer root, host-owned bind):The runtime shape, measured. On the scratch test harness (podman 6.2.0, crun 1.31, rootless,
/etc/subuidatrawog:100000:65536):That is why the workload user cannot change (
--user 1000cannot write a host-owned or FUSE plaintext directory;keep-id+ CDI device is crunmount_setattr … EPERM, exit 126) and whyHOMEis corrected at the emitter.HOME and XDG, without and with the pin, on the same image (which bakes no
HOME),userns=host, container root:The unit gate —
TestGenerateQuadletRootWorkloadHome, four arms (CDI+bind gets the image home; an authoredHOMEwins; a keep-id unit gets nothing; an unknown home invents nothing), plusgofmt,go vet,go test ./...andgolangci-lint v2.13.2with the module'sgo1.26.8toolchain: all clean.No chown — the workload writes as the invoking host user (
host_uid=1000above), so a host-owned or FUSE-plaintext directory the deploying user owns is writable as-is; a named volume is chowned by podman at creation.Runtime (A3) — the authoring runtime's identification:
Rulebook compliance
/charly-internals:plugin,/charly-internals:go,/charly-internals:install-plan,/charly-core:deploy,/charly-automation:enc, this repo'sAGENTS.md.STATUSon this PR records that finding and its correction.envWithRootHome; the caller-suppliedHOMEwins.origin/main; no force-push, no push tomain.go test ./...+ the repo's lint pin, and the live generator run is pasted above.Change classification
Generator behavior in one branch; no wire, schema or CLI change. No
!marker. Rollback: revert — units regenerate withoutHOMEon their nextcharly config.Consumer leg: the fix reaches deployments through the sdk tag →
plugin-deploy-pod's sdk pin → charly's plugin pin, in that order; the live proof above is that chain exercised locally.Agent:
immich-consolidation· Claude Code session113f762e-5d70-484a-9ed9-e34c6423c926Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)