Skip to content

Fix failure when switching channel from edge/dev back to stable/rc - #13397

Closed
ameeno wants to merge 1 commit into
omacom:quattrofrom
ameeno:fix/channel-set-rollback-conflict
Closed

ameeno wants to merge 1 commit into
omacom:quattrofrom
ameeno:fix/channel-set-rollback-conflict

Conversation

@ameeno

@ameeno ameeno commented Sep 27, 2026 •

Copy link
Copy Markdown

Problem

Switching from edge or dev (which installs omarchy-dev) back to stable or rc (which installs omarchy) fails during omarchy-refresh-pacman:

error: unresolvable package conflicts detected
error: failed to commit transaction (conflicting files)

Pacman runs non-interactively without --ask 4, so it aborts instead of accepting the package replacement and overwriting files under /usr/share/omarchy/.

Fix

When switching to stable or rc and omarchy-dev is installed, pass --ask 4 --overwrite '/usr/share/omarchy/*' to the -Syyuu transaction.

Tests

  • test/shell.d/channel-sudo-boundary-test.sh
  • test/shell.d/channel-test.sh
  • test/shell.d/update-hook-security-test.sh

@ameeno
ameeno force-pushed the fix/channel-set-rollback-conflict branch 2 times, most recently from ab70fe4 to b3a01ff Compare September 27, 2026 11:50
@ameeno ameeno changed the title Accept package replacements and file overwrites in omarchy-refresh-pacman Fix failure when switching channel from edge/dev back to stable/rc Sep 27, 2026
When switching channels (such as rolling back from edge to stable or rc),
omarchy-channel-set invokes omarchy-refresh-pacman to update mirror
configurations and perform an initial sync transaction.

Because omarchy and omarchy-dev are distinct conflicting packages that share
identical filesystem paths under /usr/share/omarchy, running pacman -Syyuu
non-interactively without --ask 4 causes pacman to abort with unresolvable
package conflicts before omarchy-channel-set can install the channel's target
packages.

Pass --ask 4 and --overwrite '/usr/share/omarchy/*' to the pacman transaction
in omarchy-refresh-pacman, aligning it with the conflict-handling and
file-overwrite patterns established in omarchy-update-system-pkgs.
@ameeno
ameeno force-pushed the fix/channel-set-rollback-conflict branch from b3a01ff to 85f1974 Compare September 27, 2026 11:56
@omarchybot omarchybot added the bug Something isn't working label Sep 27, 2026
@llstrk

llstrk commented Sep 29, 2026

Copy link
Copy Markdown

Automated AI review

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Outcome: The new flags go on the refresh -Syyuu, but omarchy-dev is swapped for omarchy in the next command, omarchy-channel-set line 137.

--ask 4 and --overwrite are on the wrong transaction

In the stable and rc repos nothing replaces omarchy-dev and dependencies on omarchy are unversioned, so with today's packages this -Syyuu does not pull in omarchy. Line 137 already passes --ask 4 but has no --overwrite. Impact: here --ask 4 answers yes to "X and Y are in conflict. Remove Y?" for any conflict in a downgrade-capable mirror switch (none in today's repos), which omarchy-update-system-pkgs-when-conflicted leaves to the user. Not reproduced; source and metadata only.

Suggested change: Drop this branch and, if unowned files under /usr/share/omarchy block the switch, add the --overwrite to line 137 and its channel-test.sh assertions.

More findings

The listed tests don't exercise the new branch

channel-test.sh stubs omarchy-refresh-pacman, the other two never assert its pacman arguments, and the new check reads the host's /var/lib/pacman/local. All three pass on the base commit, so they don't check this branch or its arguments.

Suggested change: Add a test that points the check at a fixture package database, as in the Reproducer below.

Reproducer (new test passes at 85f1974, fails at the base c5b4db7)

Save as test/shell.d/refresh-pacman-rollback-args-test.sh. It uses the existing sudo-boundary fixture and points the package check at a fixture directory, so it never reads the host's package database. The expected lines encode the PR as written; adjust them to the final fix.

#!/bin/bash

# Exercises the omarchy-dev rollback branch in omarchy-refresh-pacman against a
# fixture package database, never the host's /var/lib/pacman/local.

set -euo pipefail

source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"
source "$SHELL_TEST_DIR/fixtures/sudo-boundary-test.sh"
copy_boundary_file bin/omarchy-refresh-pacman

fake_local="$boundary_tmp/pacman-local"
mkdir -p "$fake_local"
python3 - "$SUDO_TEST_ROOT/bin/omarchy-refresh-pacman" "$fake_local" <<'PY'
import sys
from pathlib import Path
p = Path(sys.argv[1])
p.write_text(p.read_text().replace('/var/lib/pacman/local', sys.argv[2]))
PY
if grep -q '/var/lib/pacman/local' "$SUDO_TEST_ROOT/bin/omarchy-refresh-pacman"; then
  fail "refresh reads the fixture package database"
fi

transaction() {
  reset_boundary
  "$SUDO_TEST_ROOT/bin/omarchy-refresh-pacman" "$1" >"$boundary_tmp/output" 2>&1 ||
    fail "refresh $1 failed" "$(<"$boundary_tmp/output")"
  grep '^step:pacman ' "$SUDO_TEST_LOG"
}

expect() {
  local channel=$1 expected=$2 description=$3 actual
  actual=$(transaction "$channel")
  printf '# %s: %s\n' "$description" "$actual"
  [[ $actual == "$expected" ]] || fail "$description" "expected: $expected"$'\n'"actual:   $actual"
  pass "$description"
}

plain='step:pacman -Syyuu --noconfirm'
rollback='step:pacman -Syyuu --noconfirm --ask 4 --overwrite /usr/share/omarchy/*'

expect stable "$plain" "stable without omarchy-dev keeps the plain refresh"

mkdir "$fake_local/omarchy-dev-4.0.0.r6689.gb421b1b-1"
expect stable "$rollback" "stable with omarchy-dev installed adds the rollback arguments"
expect rc "$rollback" "rc with omarchy-dev installed adds the rollback arguments"
expect edge "$plain" "edge with omarchy-dev installed keeps the plain refresh"

Run: bash test/shell.d/refresh-pacman-rollback-args-test.sh

Actual output at the head (85f1974), exit 0:

# stable without omarchy-dev keeps the plain refresh: step:pacman -Syyuu --noconfirm
ok - stable without omarchy-dev keeps the plain refresh
# stable with omarchy-dev installed adds the rollback arguments: step:pacman -Syyuu --noconfirm --ask 4 --overwrite /usr/share/omarchy/*
ok - stable with omarchy-dev installed adds the rollback arguments
# rc with omarchy-dev installed adds the rollback arguments: step:pacman -Syyuu --noconfirm --ask 4 --overwrite /usr/share/omarchy/*
ok - rc with omarchy-dev installed adds the rollback arguments
# edge with omarchy-dev installed keeps the plain refresh: step:pacman -Syyuu --noconfirm
ok - edge with omarchy-dev installed keeps the plain refresh

Actual output at the base (c5b4db7), exit 1:

# stable without omarchy-dev keeps the plain refresh: step:pacman -Syyuu --noconfirm
ok - stable without omarchy-dev keeps the plain refresh
# stable with omarchy-dev installed adds the rollback arguments: step:pacman -Syyuu --noconfirm
expected: step:pacman -Syyuu --noconfirm --ask 4 --overwrite /usr/share/omarchy/*
actual:   step:pacman -Syyuu --noconfirm
not ok - stable with omarchy-dev installed adds the rollback arguments
Details

Why this -Syyuu does not reach the pair (pacman v7.1.0 source; stable, rc and edge repo databases fetched 2026-09-29):

  • --ask 4 is ALPM_QUESTION_CONFLICT_PKG (1 << 2), not the replace question (1 << 1, default yes, already accepted by --noconfirm). --ask inverts the default answer for every question of that type in the transaction.
  • omarchy declares conflicts=omarchy-dev; omarchy-dev declares provides=omarchy and conflicts=omarchy. No package replaces omarchy-dev. libalpm adds a package to a sysupgrade only through replaces, a same-name package or dependency resolution, so omarchy is never a target here.
  • On rc, omarchy-dev is not in the repo and this transaction leaves it alone. On stable, the repo still carries an older omarchy-dev build (4.0.0.r1832.g23dab9e-1), so -Syyuu downgrades omarchy-dev and omarchy-settings-dev to it.
  • In the swap at line 137, files owned by omarchy-dev or omarchy-settings-dev are not file conflicts because those packages are removed in the same transaction. Only unowned or foreign-owned files could stop it with "conflicting files".
  • "unresolvable package conflicts detected" ends the prepare step; "failed to commit transaction (conflicting files)" only comes from the later commit step, so one run cannot print both. The full pacman output would show which pair conflicted.
  • A scan of core, extra and the omarchy repo found no conflict that a stable or rc version adds relative to edge today, so the extra --ask 4 most likely changes nothing now; the exposure is future snapshots or user-installed alternatives.

Optional notes:

  • Detection: compgen -G "/var/lib/pacman/local/omarchy-dev-*" also matches any package named omarchy-dev-<something> (a sandbox test with omarchy-dev-tools-1.0-1 took the branch; no such package is published today) and ignores a DBPath set by the pre-refresh hook. pacman -Q omarchy-dev, as omarchy-channel-current uses, avoids both.
  • The branch also runs from omarchy-reinstall-pkgs (channel stable), not only on a rollback as the code comment says.
  • Outside this diff: because the stable repo's older dev build lacks default/omarchy/sudo-no-update/sudo, an edge-to-stable switch today should stop at the stop_for_older_destination check right after this refresh, before the swap (derived from repo metadata and line 135; not run).

Verified (sandbox, stubbed pacman and sudo):


Review information

Test scope: Source, public repo metadata and sandbox tests with stubbed pacman and sudo, at 85f1974.

AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check.

Opt out: To stop receiving these reviews, reply to this comment saying so.

@omarchybot

Copy link
Copy Markdown
Collaborator

I ran this on a worker VM built from the Omarchy ISO: switched it to edge with omarchy-channel-set edge (installing omarchy-dev and omarchy-settings-dev), then back with omarchy-channel-set stable, once with quattro as it is and once with this branch's bin/omarchy-refresh-pacman in place. The switch back fails both times, the same way, and this change does not fix it.

What actually fails. The -Syyuu in omarchy-refresh-pacman stops with failed to commit transaction (conflicting files), but no file in the conflict is under /usr/share/omarchy. Every one belongs to a package being downgraded to stable's older build: linux-firmware-other (689 files that edge's split-out linux-firmware-ti now owns, and stable has no linux-firmware-ti), plus linux-omarchy and linux-omarchy-headers (an unowned /usr/lib/modules/7.2.5-3-omarchy the module hook kept for the running kernel). There was no unresolvable package conflicts error. Running the branch's exact command, pacman -Syyuu --noconfirm --ask 4 --overwrite '/usr/share/omarchy/*', fails with the same conflicting-files error.

Why the flags are on the wrong transaction. No package in the stable, rc or edge repository declares replaces=omarchy-dev, so -Syyuu never swaps omarchy-dev for omarchy: on stable it downgrades omarchy-dev to the old 4.0.0.r1832 build stable still carries, and on rc it leaves it installed. The swap happens at bin/omarchy-channel-set:137, which already passes --ask 4. I ran that transaction on the worker and it replaced omarchy-dev and omarchy-settings-dev cleanly, with no file conflicts and no --overwrite needed.

What the change would add. --ask 4 answers yes to every "X and Y are in conflict. Remove Y?" question in the transaction, not only the one about omarchy-dev. On a full, downgrade-capable -Syyuu, that would let any unrelated package conflict remove an installed package without asking, which quattro currently refuses. The compgen check itself is fine: it is a builtin under bash -p, and no match stays inside the if. The three tests in the description don't run the new branch: channel-test.sh stubs omarchy-refresh-pacman, and the sudo-boundary test's pacman stub always succeeds.

The second opinion, Codex at medium effort, reached the same conclusion, though its independence from my review isn't guaranteed. On its own it pointed out that pacman's sync code selects replacements only through replaces or a same-name package, not through conflicts or provides.

Next step is yours. If you hit unresolvable package conflicts on a real machine, please post the full output of the failing omarchy-channel-set run and pacman -Q omarchy omarchy-dev omarchy-settings omarchy-settings-dev. That would show which transaction failed and which package pulled omarchy in. Without that, the failure this reproduces is the firmware and kernel downgrade above, and it needs a different fix. I've passed it on to the maintainer.

@ameeno ameeno closed this Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants