omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

omarchy update wedged by unowned kernel-modules-hook leftovers after release-migration kernel downgrade

Open DrakeMorrison opened this issue 3 months ago • 2 comments

System details

  • Omarchy: 4.0.1 (was 4.0.0 when the bug hit; arrived there via the omarchy-dev → 4.0.0 release migration)
  • CPU: 13th Gen Intel Core i5-1335U (ThinkPad E16)
  • GPU: Intel Raptor Lake-P Iris Xe
  • kernel-modules-hook 0.1.7-3 (installed via omarchy-base.packages)

What happened

omarchy update aborted with 6,454 raw pacman errors, all of the form:

error: failed to commit transaction (conflicting files)
linux: /usr/lib/modules/7.1.9-arch1-2/... exists in filesystem

Every conflicting path was inside /usr/lib/modules/7.1.9-arch1-2/, which existed on disk but was owned by no package. The update died before any transaction started, with no guidance beyond the generic "Something went wrong during the update!" trap message.

Root cause

This is an interaction between the release migration's kernel downgrade and kernel-modules-hook (which Omarchy installs in the base package set):

  1. Machine was on the omarchy-dev channel with linux 7.1.9.arch1-2 installed and booted.
  2. The omarchy-dev → 4.0.0 release migration synced back to the stable repo state, which at that moment meant downgraded linux (7.1.9.arch1-2 -> 7.1.8.arch1-3) (from pacman.log).
  3. kernel-modules-hook did its job: its 10-linux-modules-post hook rsync'd the running kernel's (7.1.9) modules back into /usr/lib/modules/ so the live system kept working — leaving the whole 7.1.9 tree unowned by any package.
  4. The user (me) didn't reboot.
  5. Arch later re-released linux 7.1.9.arch1-2. The next omarchy update tries to upgrade 7.1.8 → 7.1.9 and pacman refuses: every package file collides with the unowned hook-restored copy.

Two properties make this a persistent wedge rather than a self-healing hiccup:

  • pacman's file-conflict check runs before PreTransaction hooks, so 10-linux-modules-pre never gets a chance to move the directory out of the way.
  • kernel-modules-hook's linux-modules-cleanup.service explicitly skips the running kernel's tree, so as long as you stay booted into 7.1.9, nothing ever cleans it up, and every omarchy update fails the same way. (omarchy update only passes --overwrite '/usr/share/omarchy/*', which doesn't cover it.)

Steps to reproduce

  1. Be booted into kernel version X with kernel-modules-hook installed.
  2. Downgrade linux to an older version (the dev → 4.0.0 release migration did this implicitly) — the hook restores X's modules as unowned files.
  3. Without rebooting, wait for the repo to offer version X again and run omarchy update.
  4. Update fails with thousands of "exists in filesystem" conflicts.

Expected

Either the update handles the conflict (the on-disk files are byte-identical to the package's — I verified with diff -rq against the cached linux-7.1.9.arch1-2 package before overwriting), or the failure message tells the user what's going on instead of dumping ~6,500 raw pacman lines.

Workarounds that fix it

  • sudo pacman -S linux --overwrite '/usr/lib/modules/<running-kver>/*', then rerun omarchy update (what I did — clean result, package took ownership of identical files), or
  • reboot first (into the installed older kernel), which lets linux-modules-cleanup.service sweep the now-not-running unowned tree, then update.

Suggested fix

In omarchy-update-system-pkgs, when the upgrade fails and the conflicts are confined to /usr/lib/modules/$(uname -r)/ with that directory unowned (pacman -Qo fails) and the linux upgrade target matches the running kernel version, retry with --overwrite "/usr/lib/modules/$(uname -r)/*" — or at minimum detect the pattern and print "reboot, then update again" instead of the raw pacman spew. Could also be handled in the migration that performs the downgrade.

Happy to PR the detection/retry if you'd take it.

DrakeMorrison avatar Aug 30 '26 10:08 DrakeMorrison

Opened a fix in https://github.com/omacom/omarchy/pull/9285.

The update conflict handler only auto-cleared leftovers blamed on omarchy/settings packages, so linux: conflicts under the running kver modules tree (kernel-modules-hook after a downgrade) left omarchy update permanently wedged. The PR quarantines that tree when every reported filesystem conflict is unowned under it, then retries.

fresh3nough avatar Aug 31 '26 01:08 fresh3nough

Checked against quattro at be052339d. This is still a bug there. omarchy-update-system-pkgs only passes --overwrite '/usr/share/omarchy/*'. On failure it hands off to omarchy-update-system-pkgs-when-conflicted, which only clears unowned paths that conflict with the omarchy, omarchy-dev, omarchy-settings or omarchy-settings-dev packages. A conflict made up only of linux: lines leaves it with nothing to clear, and it exits 1. kernel-modules-hook is still in install/omarchy-base.packages, and omarchy-refresh-pacman still syncs with -Syyuu, which allows downgrades. So the path described here is a supported one, not an edge case.

The mechanism holds up from source, with one correction. pacman checks for file conflicts before it runs PreTransaction hooks. linux-modules-cleanup.service skips the running kernel's tree. But 10-linux-modules-pre copies the running tree rather than moving it, so running that hook earlier would not clear these collisions either. The downgrade itself was not reproduced on a worker, and nothing here depends on that: the gap is in the handler.

#9285 by @fresh3nough already proposes a fix and is linked to close this issue. It will be reviewed and run on a worker as its own item. No competing fix is open. This issue now waits on the maintainer's decision on that pull request.

Reviewed by Claude Opus 5.5 and, as a second opinion, Codex at medium effort. Codex agreed it is a bug, and it found the pre-hook correction above. Its independence from the first review is not guaranteed.

omarchybot avatar Oct 09 '26 08:10 omarchybot