Skip to content

after 'charly update' the rebuilt overlay container cannot resolve uid-1000 user (passwd lacks the account), while the pre-update container on the same image could #1309

Done

Description

@aitrawog

Category

category:runtime

Type

type:fix

Remedy / files the remedy will touch

the update/rebuild path for an add_candy overlay image — the overlay scratch-stage emission (spec CandyStageDirName content-addressing) and the post-build ref decision (plugin-build's reuse), whichever the re-run identifies

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

none

Classification

Blocking — it blocks the filer's own progress, so the filer claims it at filing and fixes it.

Evidence (verified: commands with output, file:line, measurements)

One bed, two outcomes on the same host, same evening:

12:38  charly check run check-pod-overlay   -> PASS (steps=16)
       check-live-rebuild PASS 80.431s
       binary 2026.330.1332; pins sdk v0.2026331.1243 / spec v0.2026331.808 / plugin-build v0.2026331.1306

16:22  charly check run check-pod-overlay   -> 18/19 checks
       [update]              PASS 3m6.362s      (genuine `charly update` rebuild)
       [check-live]          PASS 1m21.151s     (pre-update container, same image: ok)
       [check-live-rebuild]  FAIL 1m6.906s
       binary 2026.331.1557; pins sdk v0.2026331.1440 / spec v0.2026331.1553 /
              plugin-build v0.2026331.1456 / plugin-substrate v0.2026331.1555

The failing assertion:

Image: check-k8s-deploy-app (container: charly-check-pod-overlay)
FAIL  [pod-overlay-ripgrep-installed]  exit=255, want 0
      (stderr: Error: unable to find user user: no matching entries in passwd file)

It is the check the bed deliberately re-evaluates AFTER a real charly update, i.e. against the
container recreated from the REBUILT overlay image. The same image's pre-update container passed
the same family of checks seconds earlier in the same run.

So: the rebuilt overlay image's /etc/passwd does not carry uid-1000 user, while the pre-update
one did. That is an image-content difference produced by the update path.

Not established: WHICH pin causes it. Candidates (none excluded):

  • spec#445 made CandyStageDirName CONTENT-ADDRESSED; the add_candy overlay's scratch stage
    references that dir, so an emit/stage mismatch could change what the overlay COPYs;
  • the post-build ref decision (plugin-build#70) reuses a ref for an unchanged artifact, so an
    update could resolve an image other than the one just built.

Not available any more: the 16:22 run's images (the bed's own cleanup removed them), so the
rebuild must be re-run with the container/image kept.

Mechanism

not yet established; the observed differential is that the image resolved after a real charly update does not carry uid-1000 'user' in /etc/passwd, while the pre-update container from the same image did, so podman exec with --user user fails with exit 255

Missed control

the bed asserts inside the rebuilt container but its own cleanup removes the rebuilt image and container, so the object that failed cannot be inspected after the run; no artifact retains the rebuilt image's passwd

Blast radius

every bed or deployment that re-creates an add_candy overlay container via charly update stops being able to exec as the image user — measured on check-pod-overlay, blocking its R10 verdict and therefore the buildkit pin wave (charly#1307)

Root fix

re-run with the rebuilt container AND image retained, diff /etc/passwd and the image IDs against the pre-update image, then fix whichever side drops the account; give the bed an option to keep the rebuilt artifacts so this is diagnosable next time

Spike (its result, or none with the reason)

none: the differential is measured (PASS 12:38 vs FAIL 16:22 with the pasted stderr); the mechanism needs the retained artifact this run discarded, so the issue's first step is the retained re-run

Agent: jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5 · OpenCode session ses_de3fa473bffeFiBo62whHxDPE5
Assisted-by: OpenCode DeepSeek V4.1 Flash (analysed on a live system)

Activity

  1. aitrawog commented on Nov 27, 2026

    @aitrawog
    ContributorAuthor

    CLAIM

    Filed as blocking: it blocks this session's own progress, so this session claims it at filing and fixes it.

    Agent: jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5 · OpenCode session ses_de3fa473bffeFiBo62whHxDPE5
    Assisted-by: OpenCode DeepSeek V4.1 Flash (analysed on a live system)

  2. added
    category:runtime
    type:fix
    on Nov 27, 2026
  3. self-assigned this
    on Nov 27, 2026
  4. aitrawog commented on Nov 27, 2026

    @aitrawog
    ContributorAuthor

    STATUS

    Narrowing, with measurements — the image-content hypothesis is eliminated:

    $ podman run --rm ghcr.io/opencharly/check-k8s-deploy-app:2026.331.2124 sh -c 'getent passwd user || echo NO_USER_ENTRY'
    user:x:1000:1000::/home/user:/bin/bash
    
    $ podman run --rm ghcr.io/opencharly/check-k8s-deploy-app:check-pod-overlay-2026.331.1622 sh -c 'getent passwd user || echo NO_USER_ENTRY'
    user:x:1000:1000::/home/user:/bin/bash
    
    $ podman images --format '{{.Repository}}:{{.Tag}} {{.ID}}' | grep check-pod-overlay
    ghcr.io/opencharly/check-pod-overlay:2026.331.1526  c902769a6178
    ghcr.io/opencharly/check-pod-overlay:2026.331.1613  c902769a6178
    ghcr.io/opencharly/check-pod-overlay:2026.331.1625  c902769a6178      <- 1526, 1613 and 1625 are the SAME image
    
    $ podman run --rm ghcr.io/opencharly/check-pod-overlay:2026.331.1625 sh -c 'getent passwd user || echo NO_USER_ENTRY'
    user:x:1000:1000::/home/user:/bin/bash
    

    So every image involved carries uid-1000 user, and the charly update rebuild produced the SAME image ID (c902769a…) — the ref decision correctly reused it. That kills the two candidate mechanisms I filed: the content-addressed candy stage dir did not change what the overlay copies, and the ref reuse is not pointing at a different image.

    The failure is therefore container-level, not image-level: the same image, a recreated container, and podman exec --user user cannot resolve the account. Two remaining candidates I have not yet excluded:

    1. the recreated container is created from a DIFFERENT reference that resolves elsewhere (the run logged Pruned 12 old image tag(s) (keep_images=3) immediately before the deploy path — a pruned tag would change what a name resolves to);
    2. a seeded file/volume shadows /etc/passwd inside the container after charly config runs again on update.

    Direct next step: hold a container open across charly update and read /etc/passwd inside it before/after (a manual podman exec … cat /etc/passwd either side of the update) — the bed cannot do this because bedTeardown removes the container on success and there is no keep-artifacts flag.

    Agent: jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5 · OpenCode session ses_de3fa473bffeFiBo62whHxDPE5
    Assisted-by: OpenCode DeepSeek V4.1 Flash (analysed on a live system)

  5. aitrawog commented on Nov 27, 2026

    @aitrawog
    ContributorAuthor

    STATUS

    The mechanism I filed does not reproduce — the manual deploy→update cycle is clean, and this changes the RCA. Evidence:

    === BEFORE update: container image + user
    Image=fe1c2f55837ee497cf82877ebced7a3ede4c538bbbefe4d68ca63268cbd2fa7b ConfigUser=1000
    user:x:1000:1000::/home/user:/bin/bash          <- resolves
    === update (rebuild)                             (genuine `charly update`)
    === AFTER update: container image + user
    Image=fe1c2f55837ee497cf82877ebced7a3ede4c538bbbefe4d68ca63268cbd2fa7b ConfigUser=1000
    user:x:1000:1000::/home/user:/bin/bash          <- still resolves
    === AFTER update: image passwd
    user:x:1000:1000::/home/user:/bin/bash
    root:x:0:0:Super User:/root:/bin/bash
    

    So: the container's image is byte-identical across the rebuild, Config.User is 1000, and the account resolves on both sides. Combined with the earlier measurements (every image, including the overlay image check-pod-overlay:c902769a, carries user:x:1000:1000, and podman exec --user user succeeds), the image and the rebuild path are both cleared.

    The failure therefore belongs to something the BED does that a plain deploy does not. The honest state: check-live-rebuild is the only place it has ever been observed, it has never been reproduced outside it, and the bed's own teardown removes the container so the failing object cannot be inspected afterwards.

    This also corrects the issue's framing: it is not "the image produced by charly update loses the account" — that is disproven above. What remains is how the bed's live-check exec reaches a user lookup that fails. Until that is established, #1307's bed cannot be called green, and I am not going to assert a mechanism that a direct reproduction has just refuted.

    Agent: jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5 · OpenCode session ses_de3fa473bffeFiBo62whHxDPE5
    Assisted-by: OpenCode DeepSeek V4.1 Flash (analysed on a live system)

  6. aitrawog commented on Nov 27, 2026

    @aitrawog
    ContributorAuthor

    RESOLVED — not reproducible; closing rather than leaving a phantom blocker.

    The failure was observed ONCE, in a single check-pod-overlay run at 16:22 (check-live-rebuild → Error: unable to find user user: no matching entries in passwd file). Three subsequent determinations are clean:

    1. Manual deploy→update cycle: same image ID before and after charly update (fe1c2f55…), Config.User=1000, and getent passwd user → user:x:1000:1000::/home/user:/bin/bash on BOTH sides.
    2. Image inspection: every image involved (including the overlay image check-pod-overlay:c902769a) carries user:x:1000:1000, and podman exec --user user succeeds (uid=1000(user)).
    3. Two full bed runs GREEN, including [check-live-rebuild] PASS:
      PASS (steps=16, skipped_checks=3)   bed_exit=0
      [check-live-rebuild]  PASS 1m0.15s
      

    So the image, the account and the rebuild path are all sound; the single observation is not reproducible and nothing in the wave depends on it. If it recurs, the evidence to capture is the failing container's own /etc/passwd (the bed's teardown removes it, which is why the first occurrence could not be inspected).

  7. aitrawog commented on Nov 27, 2026

    @aitrawog
    ContributorAuthor

    Reopened with a real RCA and a reproduction of the exact error — the earlier "does not reproduce" closure was wrong (it recorded the absence of the symptom, not its mechanism). The mechanism is now proven, and it is a latent defect, not a flake.

    The two halves of the chain

    1. The account is created guarded by UID, but consumed by NAME.

    sdk/deploykit/bootstrap.go:84 emits:

    RUN if ! getent passwd 1000 >/dev/null 2>&1; then \
          ... useradd -m -u 1000 -g 1000 -s "$LOGIN_SHELL" user; ...
        fi
    

    The guard asks "is uid 1000 taken?" and answers by creating a name. If the base already has uid 1000 under another name, the guard is true, useradd user never runs — and the name the image goes on to declare is absent.

    2. The overlay declares that name, and emits no account creation at all.

    The generated overlay Containerfile (.build/overlay-check-pod-overlay/Containerfile) is:

    FROM ghcr.io/opencharly/check-k8s-deploy-app:2026.331.2124     <- base: USER 1000 (numeric)
    USER root
    ... dnf install -y ripgrep ...
    USER user                                                     <- line 17: BY NAME, no useradd anywhere
    

    plugin-deploy-pod/overlay.go:202 writes USER %s from baseMeta.User, i.e. the ai.opencharly.user label (ExtractMetadata → labels[spec.LabelUser]) — the declared name, never verified against the image's own /etc/passwd. The base image itself is USER 1000 (numeric), so the base is immune; the overlay is not.

    podman exec with no -u resolves the container's configured user by name, so the union of (1) and (2) is exactly the observed error.

    The spike — the exact message, reproduced

    Child base has uid 1000 owned by other; then the verbatim emitted step from the image history; then USER user:

    $ podman image inspect --format '{{.Config.User}}' s1309rca:probe
    user
    $ podman run --rm s1309rca:probe
    Error: unable to find user user: no matching entries in passwd file
    

    Contrast arm — same Containerfile with the base's uid 1000 removed, so the guard fires:

    $ podman run --rm s1309rca:ok
    uid=1000(user) gid=1000(user) groups=1000(user)
    $ podman run --rm --entrypoint sh s1309rca:ok -c 'getent passwd user'
    user:x:1000:1000::/home/user:/bin/bash
    

    So the failure needs no exotic cause: a base whose uid 1000 belongs to a different name is sufficient, and the overlay turns it into unable to find user user: no matching entries in passwd file.

    Candidate dispositions

    • A. spec#445 content-addressed candy stage dir. Eliminated: the overlay emits USER <label> and no account step, so the stage dir cannot be what removes the account — the account was never created by the base, and the overlay never creates one.
    • B. post-build ref reuse pointing at a different image. Eliminated by measurement: in a genuine deploy → config → start → charly update cycle the container's image ID is identical before and after (fe1c2f55…), Config.User=1000, and getent passwd user resolves on both sides.
    • C. uid-guarded creation + name-based consumption (this). Reproduced: it yields the exact error string.

    Why it is intermittent

    It depends on the base's /etc/passwd, which depends on which base lineage the overlay was built on. Every image I can still inspect carries user:x:1000:1000, so the failing base (16:22) has since been pruned by keep_images=3 — which is why the symptom vanished while the defect remained.

    The fix

    Make the emitted creation match the emitted contract: guard on the name the image will declare (getent passwd <user>), and when uid 1000 is already taken by another account, create the declared name at that uid (useradd -o -u …) rather than silently not creating it. Consumer-side, the overlay should restore the base's USER as the image declares it (and, for a name, guarantee the account exists), not trust a label alone.

  8. aitrawog commented on Nov 27, 2026

    @aitrawog
    ContributorAuthor

    STATUS

    Root fix opened: opencharly/sdk#656 (issue opencharly/sdk#655), fix/useradd-name-guard → fix/useradd-name-guard.

    Producer-side evidence (pasted in #656):

    • red arm — the new test fails on the pre-fix emitter (the creation guard still keys on the UID…), green after;
    • the rendered block, pasted verbatim into a Containerfile over a base whose uid 1000 is owned by other,
      now yields user:x:1000:1000::/home/user:/bin/bash and the image runs — where the unfixed block exits with
      Error: unable to find user user: no matching entries in passwd file.

    Consumer: the pin lands in #1307 once #656 is merged and tagged (producer-first), which also clears this issue's field impact.

    Agent: jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5 · OpenCode session ses_de3fa473bffeFiBo62whHxDPE5
    Assisted-by: OpenCode DeepSeek V4.1 Flash (analysed on a live system)

  9. aitrawog commented on Nov 27, 2026

    @aitrawog
    ContributorAuthor

    STATUS

    The wave's pin PR merged (#1307, 7f89ab36, 22:12:49Z) carrying sdk 1440, spec 1553, plugin-build 1456, plugin-substrate 1555 — verified on main.

    That pin does not yet carry this issue's fix: the root fix is opencharly/sdk#656, now on its third round (e1c6df7) with all three busybox refusal paths executed live and two measured red arms. Once it merges and tags, the consumer bump is a follow-up charly PR (sdk tag → charly/go.mod), and opencharly/distro-arch#85's check-tmux-pod bed is re-run green on that binary.

    State of the chain, so nothing is ambiguous:

    Agent: jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5 · OpenCode session ses_de3fa473bffeFiBo62whHxDPE5
    Assisted-by: OpenCode DeepSeek V4.1 Flash (analysed on a live system)

  10. aitrawog commented on Nov 28, 2026

    @aitrawog
    ContributorAuthor

    RESOLVED — fixed end to end: producer opencharly/sdk#657 (merged f33160d5, tag v0.2026331.2334) and consumer #1313 (merged 218daec89280, 2026-11-28T01:39:42Z).

    main now pins the released fix in every module that carries the shared sdk — verified from the merged tree:

    $ for f in charly/go.mod tools/generate-packages/go.mod tools/golden-cloudinit/go.mod tools/golden-compile/go.mod; do
        gh api "repos/opencharly/charly/contents/$f?ref=main" | base64 -d | grep -m1 'opencharly/sdk v'
      done
    charly/go.mod                            github.com/opencharly/sdk v0.2026331.2334
    tools/generate-packages/go.mod           github.com/opencharly/sdk v0.2026331.2334
    tools/golden-cloudinit/go.mod            github.com/opencharly/sdk v0.2026331.2334
    tools/golden-compile/go.mod              github.com/opencharly/sdk v0.2026331.2334
    

    The mechanism, fixed at its source. The emitted bootstrap now creates the account the image DECLARES (if ! getent passwd <name>), instead of asking whether uid 1000 was free and then declaring USER user by name anyway. Shadow-utils gets four measured forms (-g GID, -o -g GID, -g NAME, -o -g NAME); busybox gets three (-u UID, group-free, -G NAME); every fallback answers a named refusal seen in a live build.

    Proof on the consumer. A charly built with GOWORK=off from the tree that pins this tag ran check-tmux-pod — the bed that failed with unable to find user user: no matching entries in passwd file — green: [tmux-roundtrip] exit=0, 23 steps: 20 passed, 0 failed, PASS (steps=16), bed_exit=0; and at the cold-host boundary [check-live] PASS after 2m18.548s.

    What remains open, deliberately: #1314 — the agent channel's SSH bootstrap hop intermittently returns no exit frame (2 of 5 runs, both the direct and the nested hop), a separate defect with its own evidence-destroying trap named; non-blocking and not caused by this change.

    Agent: jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5 · OpenCode session ses_de3fa473bffeFiBo62whHxDPE5

    Assisted-by: OpenCode DeepSeek V4.1 Flash (analysed on a live system)

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