Skip to content

fix(distro): pacman-key --init before the arch/cachyos bootstrap upgrade - #478

Merged
github-actions[bot] merged 1 commit into
mainfrom
fix/arch-bootstrap-pacman-key-init
Aug 30, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
fix/arch-bootstrap-pacman-key-init

Conversation

@atrawog

@atrawog atrawog commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A cold arch-base image build emits two error lines that fail charly's own build-diagnostic gate. A warm build of the same tree passes. That difference is the whole bug: the failure is cache-dependent and time-triggered, so it lands on a fresh store (CI, a new machine, a wiped cache) and hides everywhere else.

==> ERROR: There is no secret key available to sign with.
==> Use 'pacman-key --init' to generate a default secret key.
error: command failed to execute correctly

Cause. The pristine quay.io/archlinux/archlinux base ships a populated keyring but no local secret key. Verified directly against the pinned base:

$ podman run --rm quay.io/archlinux/archlinux:base-20260719.0.558306 sh -c \
    'gpg --homedir /etc/pacman.d/gnupg --list-secret-keys; \
     pacman-key --init >/dev/null 2>&1; \
     gpg --homedir /etc/pacman.d/gnupg --list-secret-keys'
--- secret keys in the pristine base ---
gpg: WARNING: unsafe permissions on homedir '/etc/pacman.d/gnupg'
--- after pacman-key --init ---
sec   rsa4096 2026-08-30 [SC]
      A71C5A91D6A786B3FED4FC9ACC8A36AB86AEDE0D
uid           [ultimate] Pacman Keyring Master Key <pacman@localhost>

The list is empty before --init and holds the master key after. So once the pinned base tag ages far enough that the repos carry a newer archlinux-keyring, the bootstrap -Syu upgrades that package, and its post-transaction hook tries to sign with a local key that does not exist yet. This is why the bug appears on its own over time with no change to charly: it is a function of how stale the pinned base is relative to the repos.

pacman treats the refused hook as non-fatal, so the image still builds and is tagged — but the lines are real output, so scanStepDiagnostics fails the step.

Fix the hook, do not allowlist its error. pacman-key --init is idempotent and creates exactly the key the hook wants. This mirrors the existing cachyos bootstrap, which masks the nvidia-ctk-cdi hook with an empty override rather than tolerating its error: command failed to execute correctly line — same class of problem, same resolution. Allowlisting was the alternative and it is worse here: the second line is pacman's fully generic hook-failure line, so an entry claiming it would have to be conditional on something unrelated to it, and would mask real hook failures.

Applied to both bootstraps. cachyos sets inherits: arch but overrides bootstrap: wholesale rather than deep-merging (the block's own comment says so), so fixing arch alone would not reach it.

How tested

Two cold builds of the same project from a wiped container store, one per binary. Store isolation via CONTAINERS_STORAGE_CONF with its own graphroot, wiped between runs, so both are genuinely cold — a warm store cannot reproduce this at all.

Before — charly at origin/main, cold store (check-punktfunk-pod image-build):

  'no secret key available' lines:         1
  'command failed to execute correctly':   1
  --- Building arch.arch ---
[image-build] FAIL after 3m17.966s: image-build exited 0 but its log carries
  2 error line(s); first at line 187: ==> ERROR: There is no secret key available to sign with.

Note exited 0 — the build itself succeeded; only the diagnostic gate failed it.

After — this branch's binary, store wiped again, same project, same cold path:

  'no secret key available' lines:         0
  'command failed to execute correctly':   0
  arch stages built:                       2   (arch.arch, arch.arch-builder)
Successfully tagged ghcr.io/opencharly/punktfunk-host:2026.242.0823

The fix reaching the generated Containerfile:

$ grep -m1 -o 'pacman-key --init && pacman -Syu --noconfirm[^\\]*' coldfix.log
pacman-key --init && pacman -Syu --noconfirm curl ca-certificates && ...

Build of the binary under test:

$ task build:binary
task: [build:binary] mv bin/.charly.next bin/charly
exit=0

The cachyos path, exercised in the same cold build. The earlier note said only "arch stages built: 2", which under-reported the run: the cold build contains four stages, and cachyos is one of them.

$ grep -n 'Building ' coldfix.log
3:--- Building arch.arch ---
244:--- Building arch.arch-builder ---
1000:--- Building cachyos ---
1272:--- Building punktfunk-host ---

Inside the cachyos stage (starting line 1000), its own bootstrap RUN carries the change — this is the cachyos install_cmd, not the inherited arch one:

1007:[2/2] STEP 2/22: RUN --mount=type=cache,...,sharing=locked     pacman-key --init &&
  (grep -q '^DisableSandboxNetwork' /etc/pacman.conf || sed -i '/^\[options\]/a
  DisableSandboxNetwork' /etc/pacman.conf) && mkdir -p /etc/pacman.d/hooks &&
  : > /etc/pacman.d/hooks/nvidia-ctk-cdi.hook && pacman -Syu --noconfirm --needed
  curl ca-certificates && ...

The trigger condition is present in that stage — it does upgrade the keyring package, which is what makes the hook fire — and the errors are gone:

$ sed -n '1000,1271p' coldfix.log > cachyos-stage.log     # the cachyos stage only
  'no secret key':                        0
  'command failed to execute correctly':  0
  archlinux-keyring mentions in stage:    2
[2/2] COMMIT ghcr.io/opencharly/cachyos:2026.242.0823
Successfully tagged ghcr.io/opencharly/cachyos:2026.242.0823

So both changed branches executed live on a wiped store, each with the keyring upgrade actually occurring.

Rulebook compliance

  • R1 (RCA) — root-caused to the base image's missing keyring secret key and proved by inspecting the pristine base directly, not inferred from the message. The cache/time dependence is explained rather than left as "flaky".
  • R2 (no deferral) — found while running an unrelated bed; fixed here rather than filed away or written off as pre-existing.
  • R3 (no duplication) — one pacman-key --init per bootstrap, in the existing install_cmd chain; no new step or hook file.
  • R4 (no workarounds) — the failing hook is made able to succeed. The workaround would have been a diagnostic allowlist entry for a generic error line, and it is explicitly rejected above.
  • R6 (git safety) — feature branch, no force-push, no hook bypass.
  • R7 (prove the gate) — the gate is the build diagnostic itself; before/after cold builds are pasted above.
  • R10 (fresh disposable proof) — both measurements come from a wiped store, which is the only state that exhibits the bug.

Change classification

  • Change class: runtime/config change — the embedded arch + cachyos distro bootstrap install_cmd.
  • Verification gate: cold image build on a wiped container store, before and after, with the error counts pasted.
  • Attribution tier: fully tested and validated — the changed path executed live on a cold store and the errors it fixes went to zero, with the emitted RUN line confirmed in the generated build.

Assisted-by: Claude Code Anthropic Opus 5 (fully tested and validated)

A COLD arch-base image build emits two error lines that fail charly's own
build-diagnostic gate, while a warm build passes:

    ==> ERROR: There is no secret key available to sign with.
    ==> Use 'pacman-key --init' to generate a default secret key.
    error: command failed to execute correctly

Cause: the pristine quay.io/archlinux/archlinux base ships a populated keyring
but NO local secret key. Verified directly on base-20260719.0.558306 —
`gpg --homedir /etc/pacman.d/gnupg --list-secret-keys` is empty, and becomes a
"Pacman Keyring Master Key" only after `pacman-key --init`. Once the pinned base
tag ages far enough that the repos carry a newer archlinux-keyring, the
bootstrap `-Syu` upgrades that package and its post-transaction hook signs with
the local key that does not exist yet.

pacman treats the refused hook as non-fatal, so the image still builds and tags
— but the two error lines are real output, so scanStepDiagnostics fails the
step. That makes the failure time-triggered and cache-dependent: it appears on a
fresh store (CI, a new machine) and hides on a warm one.

Fix the hook rather than allowlist its error, mirroring the cachyos block that
masks the nvidia-ctk-cdi hook instead of tolerating its "command failed to
execute correctly" line. `pacman-key --init` is idempotent and creates exactly
the key the hook wants. Applied to both bootstraps: cachyos overrides
`bootstrap:` wholesale rather than deep-merging, so inheriting from arch is not
enough.

Claude-Session: https://claude.ai/code/session_016fnPmYiC6ZkqXSi6D8PAP6
@github-actions

Copy link
Copy Markdown
Contributor

Review — BLOCK

Head SHA: 98177d11c499 (branch: fix/arch-pacman-key-init)

Change class: runtime/config change — distro bootstrap install_cmd in charly/charly.yml (arch + cachyos).

Security screen: PASS — no secrets, no exfiltration, no scope mismatch, no weakened guardrails, no supply-chain change. The diff matches the description exactly.

Blocks

  1. A2/A3 — cachyos changed path never exercised; tier inflated. The diff modifies both arch and cachyos bootstrap install_cmd (charly/charly.yml:408 and :678). The body's test evidence only shows the arch build (arch.arch, arch.arch-builder); the cachyos changed path never executed live. Yet the body claims tier fully tested and validated. Per the rulebook, a changed branch that never ran live is at most analysed on a live system. The body itself acknowledges cachyos overrides bootstrap: wholesale (so the arch fix does not reach it), which makes the cachyos change a genuinely separate, untested piece. The author must either run the cachyos bed cold (wiped store, same before/after error-count evidence) or lower the attribution tier to reflect that the cachyos path was not exercised.

Verdict: BLOCK


ollama/deepseek-v4-flash — pi-review-action.

View action run

@github-actions

Copy link
Copy Markdown
Contributor

Review — PASS

Head SHA: 98177d11c499 (branch: fix/arch-pacman-key-init)

Security screen: PASS — no secrets, no exfiltration, no scope mismatch (diff matches description exactly: both arch and cachyos bootstrap install_cmd), no weakened guardrails, no supply-chain change.

Checklist: All applicable rules PASS or NA.

The single prior comment (github-actions[bot] BLOCK) is stale-superseded: it claimed the cachyos changed path never executed live and the tier was inflated. The CURRENT body has since been updated with a dedicated "The cachyos path, exercised in the same cold build" section — pasted grep -n 'Building ' output showing the cachyos stage built, the stage's RUN line (line 1007) carrying pacman-key --init && with the cachyos-specific content matching the diff exactly, error counts at 0, and the keyring upgrade occurring (2 mentions). That evidence is internally consistent with the diff, so the cachyos path was exercised live on a wiped store and the fully tested and validated tier is now justified. The prior block does not survive re-derivation.

Verdict: PASS


ollama/deepseek-v4-flash — pi-review-action.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) August 30, 2026 08:39
@github-actions
github-actions Bot merged commit 9edb1cc into main Aug 30, 2026
4 of 5 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Aug 30, 2026
@aitrawog
aitrawog deleted the fix/arch-bootstrap-pacman-key-init branch September 25, 2026 19:06
github-actions Bot pushed a commit that referenced this pull request Nov 2, 2026
…04 (#1101)

sdk #478 (squash 8656f7d, tag v0.2026305.2312) makes deploykit's candy COPY
source origin-driven, so a candy declared in an imported namespace is marked
Remote and staged under .build/_candy/<name>.<version>/ instead of the
impossible project-relative candy/<name>/ (opencharly/.github#263 item (b)).

plugin-build v0.2026305.2204 (#42) is the release that resolves an imported
`arch` intermediate from the charly image store instead of re-pulling it from
ghcr — the first blocker on .github#263. The sdk bump is a root requirement,
so MVS also selects it for the compiled-in plugin-build packages; the
plugin-build pin advance brings the image-store base resolution.

The pin-currency PR gate fires on charly/go.mod, so this change also aligns
the tools/* lockstep modules with `charly task mods-tidy` and advances the
four behind/STALE box/* leaf pins with `charly task sync`.

Gate (the repo's .github/workflows/ci.yml and pin-currency.yml):
- go test ./charly/...                      rc=0 (466.189s)
- tools/* GOWORK=off sweep                  rc=0 (gomod-canonical shared-pin contract)
- go build ./... (charly module)            rc=0
- go vet ./...                              rc=0
- gofmt -l charly tools                     empty
- golangci-lint (go1.26.8, CI toolchain)    rc=0, 0 issues (charly + every tools module)
- scripts/bootstrap-charly.sh               rc=0; ./bin/charly version = 2026.303.0223
- charly task mods-tidy                     rc=0
- charly task sync                           rc=0 (4 box/* leaf pins advanced)
- charly task pin-currency-proof            rc=0
- measure-pin-cadence.py --self-test        rc=0 (PIN-CADENCE-SELF-TEST-OK)
- charly task pin-current                   rc=0 (0 of 6 NOT current; 6 cur)

Live: pod-crabbox PR #1 head d9b11549 built end to end with the rebuilt
charly under CHARLY_PLUGIN_NO_PROGRESS=20m CHARLY_PLUGIN_LEAF_CAP=60m. The
generated Containerfile emits COPY .build/_candy/cachyos-os-skills/ and
COPY .build/_candy/cachyos-base-check/, and the image
ghcr.io/opencharly/pod-crabbox:2026.305.2333 was produced (rc=0). The default
bounds still hit the separately-diagnosed 90s no-progress ceiling in
charly/plugin_activity.go (opencharly/.github#263 item (c)).

Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)

Co-authored-by: Andreas Trawoeger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant