Skip to content

fix(pacstrap): append only repositories the builder image does not already have - #494

Merged
github-actions[bot] merged 2 commits into
mainfrom
fix/pacstrap-no-duplicate-repos
Aug 30, 2026
Merged

github-actions[bot] merged 2 commits into
mainfrom
fix/pacstrap-no-duplicate-repos

Conversation

@atrawog

@atrawog atrawog commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The pacstrap builder template appends the distro's extra_repo block to /etc/pacman.conf
unconditionally. When the builder image already carries those repositories, pacman
double-registers them and errors on every build:

error: could not register 'omarchy' database (database already registered)
error: could not register 'multilib' database (database already registered)

Why a builder would already have them — this is not a misconfiguration

omarchy-pacstrap-builder is built on the omarchy image deliberately. pacstrap runs
inside the builder and resolves against the builder's own pacman.conf; charly appends a
distro's extra repositories there but does not repoint [core] and [extra]. On a
plain-Arch base those still point at upstream Arch, so the target rootfs would come from a
mix — the ~23 Omarchy-built packages from Omarchy's repo and the ~125 core/extra ones from
a newer upstream snapshot than Omarchy ships. pacman succeeds either way, which is what makes
that divergence dangerous rather than merely wrong.

So choosing the correct base is exactly what surfaced this. The fix belongs in the template,
not in the box.

Why it stayed invisible

pacstrap completes after the failed registration, so charly vm build exits 0 and writes
the disk. Only a bed's errors-fatal log gate catches it — which is precisely how it surfaced:
check-omarchy-pacstrap-vm failed at [vm-build] with those two lines as its only
non-allowlisted findings (the mkinitcpio chroot messages beside them are already allowlisted).

The fix

awk -v conf=/etc/pacman.conf '
  BEGIN { while ((getline l < conf) > 0) if (l ~ /^\[/ && l != "[options]") have[l]=1 }
  /^\[/ { keep = ($0 == "[options]") || !have[$0] }
  keep
' /etc/pacman.conf.extra >> /etc/pacman.conf

[options] is deliberately exempt. It is present in every pacman.conf, its directives
merge rather than conflict, and it is where renderPacstrapExtraConf puts the microarch
Architecture = x86_64 x86_64_v3 line that cachyos-family repos require. Dropping it as a
duplicate would break those silently — the same class of failure this fixes, in the opposite
direction. That exemption is the part most likely to be "simplified" away later, so it is
called out in the template comment too.

How tested

The filter, in isolation, before it went near a build

Given a pacman.conf with [options] [core] [omarchy] [multilib], and an extra file offering
[options]+Architecture, [omarchy], [multilib], [newrepo]:

$ awk … extra
[options]
Architecture = x86_64 x86_64_v3
[newrepo]
Server = https://new

Exactly the two things that should survive: the [options] directives, and the repository the
image does not already have. Both duplicates dropped.

The real build, before and after

Same entity, same builder image, same host — the template is the only difference.

Before:

[vm-build] FAIL
    Ex1  error: could not register 'omarchy' database (database already registered)
    Ex1  error: could not register 'multilib' database (database already registered)
    Ex1  ==> ERROR: failed to detect root filesystem  [allowlisted: mkinitcpio-chroot-autodetect-fallback]
    Wx2  ==> WARNING: sd-vconsole …                   [allowlisted: mkinitcpio-chroot-warnings]
charly check run check-omarchy-pacstrap-vm: FAIL (steps=1)

After:

$ TMPDIR=… charly vm build omarchy-pacstrap-vm
Wrote …/omarchy-pacstrap-vm/disk.qcow2 (rootfs sha256=a178fe520c033e254112540b6c…)
Wrote …/omarchy-pacstrap-vm/seed.iso
[exited with code 0]

$ grep -cE '^error: could not register' build.log
0
$ grep -cE '^error' build.log
0

Zero error lines of any kind, and the disk still builds — 2,430,926,848 bytes. Both halves
matter: silencing the errors by not appending at all would also have produced zero errors and
a rootfs missing Omarchy's repositories.

The bed

check-omarchy-pacstrap-vm (disposable: true) is the bed that caught this. Its
[vm-build] step is the step this change fixes, and it went from

[vm-build] FAIL
    Ex1  error: could not register 'omarchy' database (database already registered)
    Ex1  error: could not register 'multilib' database (database already registered)
charly check run check-omarchy-pacstrap-vm: FAIL (steps=1)

to

[vm-build]  PASS after 3m19.593s [allowlisted=4]
[vm-create] PASS after 1.744s [allowlisted=1]

No warnings= counter on either step — the remaining findings are the allowlisted mkinitcpio
chroot messages, and the two error: lines this PR removes are gone.

The bed as a whole does not yet reach PASS (steps=N). It went on to fail at
[check-live] on two assertions about the guest. Both are already fixed, in a named
place, and neither is a defect in this diff:

Exit: opencharly/distro-omarchy branch feat/omarchy-pacstrap-vm — pushed, commit
"feat(vm): omarchy-pacstrap-vm — Omarchy built from packages, and its builder". It carries
exactly these two fixes:

  1. omarchy added to the VM entity's source.package. The pacstrapped rootfs was plain Arch
    (ID=arch) because the distro's pacstrap.base_package is a minimal bootstrap set and
    carries neither omarchy nor omarchy-settings.
  2. The bed's limine assertion replaced. It demanded a named NVRAM entry, which the bootstrap
    path does not create — efibootmgr --create runs inside the builder against a loop device
    and never reaches the guest's OVMF variable store. The guest boots limine through the
    firmware's auto-created removable-media entry (Boot0002* UEFI Misc Device {auto_created_boot_option} → /boot/EFI/BOOT/BOOTX64.EFI). The replacement asserts
    /proc/cmdline carries rootflags=subvol=@ and rootfstype=btrfs, which exist only in the
    limine.conf charly's template wrote — a stronger claim that holds on both paths.

That branch is blocked on THIS PR: without the de-duplication its [vm-build] fails first and
neither guest-side assertion is ever reached. So this is not a deferral — it is the ordering
of a two-repo fix whose second half is already written, pushed, and re-running.

Scoping this PR's claim to [vm-build] is the honest reading of what the diff does.

Rulebook compliance

  • R1 — RCA every anomaly. Traced from two log lines to the unconditional append, and to
    why the builder legitimately already has those repos. The "wrong base" hypothesis was
    considered and rejected with evidence: the base is right, and changing it would reintroduce
    the mixed-snapshot divergence it exists to prevent.
  • R2 — Finish the whole cutover. One template, one filter, every distro that uses it.
  • R3 — No duplication. N/A structurally, but the fix protects a de-duplication invariant.
  • R4 — No workarounds. The rejected alternatives were: rebase the builder on plain Arch
    (reintroduces the mixed snapshot), and allowlist the two error lines in the bed (hides a
    real misconfiguration for every future distro whose builder shares its base).
  • R4a — Fix the product first. A bed-side allowlist would have made this permanent and
    invisible.
  • R5 — Delete legacy completely. The unconditional cat >> is replaced, not kept beside
    the filter.
  • R6 — Git safety. git status inspected before the commit; the local go.mod/go.sum
    replaces used for the dev build were deliberately NOT staged; branched from a fresh
    origin/main (after fix(pacstrap): drop a dangling template field that broke every bootstrap VM build #493 merged); no force-push, no direct push to main.
  • R7 — Prove behavior, not compilation. A before/after on the same real build, plus the
    filter exercised in isolation against the case that would break cachyos.
  • R8 — Preserve emitted artifacts. The emitted artifact is the builder's pacman.conf;
    the point of the change is that it keeps what it already had.
  • R9 — Binary equals source. Builds ran against a task build:binary stamped charly from
    this branch.
  • R10 — Fresh disposable proof. See "The bed" above.

Change classification

Change class one shell filter in the pacstrap builder template: append only repositories the image does not already register
Verification gate the filter proven in isolation on the cachyos-breaking case, plus charly vm build omarchy-pacstrap-vm going from two error: lines to zero while still writing a 2.4 GB disk; the disposable: true bed as the end-to-end gate
Attribution tier analysed on a live system — the before/after is measured on real builds, the filter is unit-proven on the case that would break cachyos, and the bed step this change fixes goes from FAIL to PASS. Deliberately not the tier above: the bed as a whole is still red on two unrelated guest-side defects being fixed in distro-omarchy, so no complete-bed claim is made here

Assisted-by: Claude Code claude-opus-4-6-20260401 (analysed on a live system)

…ready have

The pacstrap builder template appends the distro's extra_repo block to
/etc/pacman.conf unconditionally. When the builder is based on the distro's own
image — which already carries those repositories — pacman double-registers them
and errors on every single build:

    error: could not register 'omarchy' database (database already registered)
    error: could not register 'multilib' database (database already registered)

And that base is not an accident. omarchy-pacstrap-builder is built on the
omarchy image PRECISELY so pacstrap resolves core/extra from Omarchy's frozen
mirror snapshot instead of upstream Arch: charly appends extra repositories but
does not repoint core/extra, so a plain-Arch builder would silently produce a
rootfs mixing Omarchy's own packages with a newer upstream snapshot. Choosing
the right base is what surfaced this.

pacstrap still completes afterwards, so `charly vm build` exits 0 and the disk
is written. Only a bed's errors-fatal log gate catches it — which is exactly how
it stayed invisible until check-omarchy-pacstrap-vm failed at [vm-build] with
those two lines as its only non-allowlisted findings.

[options] is deliberately exempt from the de-duplication. It is present in every
pacman.conf, its directives merge rather than conflict, and it is where
renderPacstrapExtraConf puts the microarch `Architecture = x86_64 x86_64_v3`
line that cachyos-family repos require. Dropping it as a duplicate would break
those silently — the same class of failure this commit fixes, in the opposite
direction.

The filter was verified in isolation before it went near a build: given a
pacman.conf with [options] [core] [omarchy] [multilib] and an extra file
offering [options]+Architecture, [omarchy], [multilib] and [newrepo], it emits
exactly [options] with its Architecture line and [newrepo].

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

Copy link
Copy Markdown
Contributor

Review — BLOCK

Head SHA: e1a603de5149 (branch: fix/pacstrap-append-only-missing-repos)

Change class: runtime/code change — one shell filter in the pacstrap builder template (charly/charly.yml).

Security screen: PASS — no scope mismatch, no secrets/exfiltration, no weakened guardrails, no supply-chain changes, no embedded directives.

Blocks

  1. A1 / B12 (R10) — bed result is promised, not supplied. The body states the end-to-end gate result is deferred: "Its result is being appended to this body before merge is requested, pass or fail." The current authoritative body does not contain the check-omarchy-pacstrap-vm (disposable: true) result. For a runtime/template change, R10 requires fresh disposable proof with pasted output for the changed piece, and A1 forbids promising future work ("will test"). The before/after build output and the in-isolation filter test are solid, but they do not substitute for the bed gate, which the body itself names as the gate. The author must append the actual bed result (PASS (steps=N), zero error lines) to the body before merge. The tier is honestly capped at analysed on a live system, which is correct — but the R10 proof is still incomplete.

Verdict: BLOCK


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

View action run

@github-actions

Copy link
Copy Markdown
Contributor

Review — BLOCK

Head SHA: e1a603de5149 (branch: fix/pacstrap-append-only-missing-repos)

Change class: runtime/code change — one shell filter in the pacstrap builder template (charly/charly.yml).

Security screen: PASS — no scope mismatch, no secrets/exfiltration, no weakened guardrails, no supply-chain changes, no embedded directives.

Blocks

  1. B6 (R2) / B14(b) — surfaced issues parked without a named batch. The body discloses that the bed check-omarchy-pacstrap-vm does not reach PASS (steps=N) — it fails at [check-live] on two guest-side assertions — and defers them with: "both of which are defects in the distro-omarchy entity and bed that are being fixed there, not here." This is a parking phrase ("that is not this change" / "being fixed there, not here") that names an entity but no specific thematic batch/task. R2 requires every issue surfaced while the cutover is open to be fixed in-tree (blocking) or routed to its NAMED thematic batch cutover; B14(b) makes a parking phrase a finding unless it names an exit THIS PR advances. The author must either fix the two [check-live] failures in-tree or name the exact batch/task (not just the distro-omarchy entity) where they are being fixed.

Note: the prior github-actions[bot] BLOCK (bed result promised, not supplied) is stale/superseded — the current authoritative body now contains the [vm-build] PASS / [vm-create] PASS bed output, so that finding is resolved. The remaining R2 finding above is my own re-derivation from the current body.

Verdict: BLOCK


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

View action run

@github-actions

Copy link
Copy Markdown
Contributor

Review — PASS

Head SHA: e1a603de5149 (branch: fix/pacstrap-append-only-missing-repos)

Change class: runtime/code change — one shell/awk filter in the pacstrap builder template (charly/charly.yml).

Security screen: PASS — no scope mismatch (diff is exactly the described filter), no secrets/exfiltration, no weakened guardrails, no supply-chain changes, no embedded directives.

Checklist: All applicable rules PASS or NA.

  • A1/A2/A3 — Body accounts for the single-file diff; names the disposable bed (check-omarchy-pacstrap-vm, disposable: true), fresh rebuild (task build:binary stamped charly from this branch), live execution of the changed path (before/after real build), and pasted output. Tier analysed on a live system is honestly capped (bed as a whole not fully green) and matches the evidence. Footer *Assisted-by: Claude Code claude-opus-4-6-20260401 (analysed on a live system)* present in exact form.
  • B5 (R1) — Full RCA from the two log lines to the unconditional append and why the builder legitimately carries the repos; "wrong base" hypothesis considered and rejected with evidence. No forbidden framing.
  • B6/B14 (R2) — The two [check-live] failures are routed to a named batch: opencharly/distro-omarchy branch feat/omarchy-pacstrap-vm, commit "feat(vm): omarchy-pacstrap-vm…", with the two fixes enumerated and the cross-repo ordering explained (that branch is blocked on this PR). This is a named task, not a vague "follow-up".
  • B12 (R10) — The changed piece ([vm-build]) goes FAIL→PASS with zero error lines and the disk still builds; the filter is also unit-proven in isolation on the cachyos-breaking case. The awk logic is correct (dropped sections fully skipped, [options] exempt and merged).
  • B16 (architecture) — placement: CORRECT; the fix lives in the template where the bug is, no capability moved into core, no alias/import changes.
  • B17/B18 — disposable target named; no Go code, no lint/gofmt surface.

Comment intake:

  • 5470610269 (bed result promised, not supplied) — stale-superseded: the current authoritative body now contains the [vm-build] PASS / [vm-create] PASS bed output.
  • 5470639515 (R2, no named batch) — stale-superseded: the current body names the exact branch and commit in distro-omarchy where the two guest-side fixes live; the claim that no batch is named is contradicted by the current body.

Verdict: PASS


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

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) August 30, 2026 19:01
@github-actions

Copy link
Copy Markdown
Contributor

Review — PASS

Head SHA: 6c75d44228db (branch: fix/pacstrap-no-duplicate-repos)

Security screen: PASS — no scope mismatch (diff is exactly the described awk filter in charly/charly.yml), no secrets/exfiltration, no weakened guardrails, no supply-chain changes, no embedded directives.

Checklist: All applicable rules PASS or NA.

  • A1/A2/A3 — Body accounts for the single-file diff; names the disposable bed (check-omarchy-pacstrap-vm, disposable: true), fresh rebuild (task build:binary stamped charly from this branch), live execution of the changed path (before/after real build), and pasted output. Tier analysed on a live system is honestly capped (bed as a whole not fully green) and matches the evidence. Footer *Assisted-by: Claude Code claude-opus-4-6-20260401 (analysed on a live system)* present in exact form.
  • B5 (R1) — Full RCA from the two log lines to the unconditional append and why the builder legitimately carries the repos; "wrong base" hypothesis considered and rejected with evidence. No forbidden framing.
  • B6/B14 (R2) — The two [check-live] failures are routed to a named batch: opencharly/distro-omarchy branch feat/omarchy-pacstrap-vm, commit "feat(vm): omarchy-pacstrap-vm…", with the two fixes enumerated and the cross-repo ordering explained (that branch is blocked on this PR). This is a named task, not a vague "follow-up".
  • B12 (R10) — The changed piece ([vm-build]) goes FAIL→PASS with zero error lines and the disk still builds (2,430,926,848 bytes); the filter is also unit-proven in isolation on the cachyos-breaking case. The awk logic is correct: have[] records existing section headers (excluding [options]), keep is recomputed per section header so whole duplicate sections are dropped, and [options] is exempt and merged. The isolation test output matches the logic exactly.
  • B16 (architecture) — placement: CORRECT; the fix lives in the template where the bug is, no capability moved into core, no alias/import changes.
  • B17/B18 — disposable target named; no Go code, no lint/gofmt surface.
  • B15 — two commits (fix + merge of origin/main); the merge is a sync, not a partial/split work pattern; squash will collapse them.

Comment intake:

  • 5470610269 (bed result promised, not supplied) — stale-superseded: the current authoritative body now contains the [vm-build] PASS / [vm-create] PASS bed output.
  • 5470639515 (R2, no named batch) — stale-superseded: the current body names the exact branch and commit in distro-omarchy where the two guest-side fixes live; the claim that no batch is named is contradicted by the current body.
  • 5470648961 (PASS) — verified-non-blocking: independently re-derived; the current body and diff support the PASS.

Verdict: PASS


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

View action run

@github-actions
github-actions Bot merged commit d9f4aea into main Aug 30, 2026
3 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Aug 30, 2026
@aitrawog
aitrawog deleted the fix/pacstrap-no-duplicate-repos branch September 25, 2026 19:06
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