'An Omarchy update is already running' when nothing is running (leaked update lock fd)
Re-audited on omarchy 4.0.2-1. The first-pass note holds in full: I diffed /usr/share/omarchy/bin/omarchy-update-lock on this machine against the quattro tree and it is byte identical, so the path is still ${XDG_RUNTIME_DIR:-/tmp}/omarchy-update.lock, it still does exec {OMARCHY_UPDATE_LOCK_FD}>"$lock_path" then flock -n, still prints exactly "An Omarchy update is already running.", and still exports the descriptor and execs. The held subcommand still validates the inherited fd through /proc/$$/fd/$OMARCHY_UPDATE_LOCK_FD, which is the direct evidence that the descriptor crosses the exec. bin/omarchy-migrate-notify on this machine still tests the same lock with ! flock -n "$lock" true and exits 0 when held, so the suppressed-notification half stands, and bin/omarchy-migrate is byte identical to quattro with --pending exiting 0 only when something is pending, so the record's step 4 is right. I read omacom/omarchy issue 8077 in full: it is OPEN, titled exactly as the first pass quoted, and its body matches the record's account including the flutter-beta and adb details. Two defects the first pass did not catch, both in the safety step that is the whole point of the record. First, the pgrep pattern is wrong. omarchy-update-system-pkgs on 4.0.2-1 runs sudo env LC_ALL=C OMARCHY_UPDATE_PACMAN=1 pacman -Syu --noconfirm, so argv[0] is pacman and the process command line has no directory component, which means pgrep -af '/usr/bin/pacman' returns nothing while a real system upgrade is running. The same is true on quattro HEAD, where the call has moved into a new bin/omarchy-update-pacman wrapper that still ends in exec sudo env ... pacman "$@". A reader who trusted that check would delete a live lock. Second, the record never mentions /var/lib/pacman/db.lck, which is the authoritative live-transaction indicator and is used for exactly that purpose by Omarchy itself: omarchy-migrate's wait_for_pacman_transaction polls that file for 900 seconds. I added it as the first check and flagged the stale-db.lck case as a different problem. I also corrected the danger, whose stated mechanism was wrong: it claimed concurrent writers can corrupt /var/lib/pacman, but pacman's own db.lck prevents a second pacman transaction, so the real cost of deleting a live Omarchy lock is a second update pipeline racing the first on snapshots, cache pruning, migration markers and AUR builds. symptom, cause and verify are accurate and I left them unchanged, so cause_reconciled should stay unset. Not exercised: I did not run an update, did not delete or create any lock, and did not reproduce the adb leak, so the leak mechanism is confirmed from the script source and the issue rather than from a live reproduction on this machine. fuser, lsof, yay and flock are all installed here (psmisc 23.7-2, lsof 4.99.7-1, yay 13.0.1-1), so the fix's commands exist on a stock Omarchy 4.
Only remove the lock file after you have checked both /var/lib/pacman/db.lck and pgrep -af 'omarchy-update|omarchy-migrate|pacman|yay'. Do not use /usr/bin/pacman as the pattern: omarchy-update-system-pkgs runs pacman through sudo env, so the command line carries no directory and the pattern misses exactly the case you are trying to detect. Deleting the Omarchy lock during a live update does not corrupt the pacman database, because pacman takes /var/lib/pacman/db.lck itself and a second pacman refuses with "unable to lock database" rather than writing alongside the first. What it does is let a whole second omarchy update pipeline run beside the first: another pre-update snapshot, paccache -rk2 pruning the cache the running transaction is installing from, two omarchy-migrate runs racing on the same marker files under ~/.local/state/omarchy/migrations, and interleaved yay builds. A half-applied migration is harder to unpick than a blocked update. Note the lock lives in $XDG_RUNTIME_DIR (tmpfs), so it never survives a reboot. If it comes back after a reboot, a process is re-leaking it and you need to find that process rather than keep deleting the file.
Symptom
Every omarchy update exits instantly with:
An Omarchy update is already running.
Nothing is updating, ps shows no omarchy-update or pacman, a reboot fixes it for exactly one run and then it comes back after the next update. The pending-migrations notification at login also stops appearing.
Cause
omarchy-update-lock run opens ${XDG_RUNTIME_DIR:-/tmp}/omarchy-update.lock, takes a non-blocking flock, exports the descriptor number and execs the update, without FD_CLOEXEC. Every child of the update therefore inherits the locked descriptor. Any process started during the update that daemonises and does not close inherited fds keeps the flock alive after the update itself is long gone. The reported case is adb started by a flutter-beta AUR rebuild during omarchy-update-aur-pkgs (yay -Sua), which reparents onto the user's systemd and holds /run/user/1000/omarchy-update.lock indefinitely (issue #8077). The same happens with any sticky helper an AUR build leaves behind, and after an update that was killed mid-run. omarchy-migrate-notify reads the same lock to decide whether to stay quiet, so a stale lock also suppresses the login prompt to run pending migrations.
Fix
# 1. Find the actual holder
fuser -v "${XDG_RUNTIME_DIR:-/tmp}/omarchy-update.lock"
# or
sudo lsof "${XDG_RUNTIME_DIR:-/tmp}/omarchy-update.lock"
# Example output:
# /run/user/1000/omarchy-update.lock:
# you 139567 F.... adb
# 2. Prove no real update is in flight before touching anything.
# Start with pacman's own database lock. It is a different file from the
# Omarchy lock and it is the one that says a transaction is live.
ls -l /var/lib/pacman/db.lck
# Then the processes. Match `pacman` unanchored: omarchy-update-system-pkgs
# runs `sudo env LC_ALL=C OMARCHY_UPDATE_PACMAN=1 pacman -Syu ...`, so the
# command line is `pacman -Syu` with no directory, and a pattern of
# `/usr/bin/pacman` matches nothing while an upgrade is running.
pgrep -af 'omarchy-update|omarchy-migrate|pacman|yay'
# If /var/lib/pacman/db.lck exists and pgrep found nothing, stop. That is a
# stale pacman lock, which is a separate problem from this one, and it also
# stalls omarchy-migrate, which waits on that exact file for 900 seconds.
# Removing the Omarchy lock will not help until it is resolved.
# 3a. Kill the leftover holder (preferred, it also stops it re-leaking)
adb kill-server # for the adb case
kill 139567 # generic
# 3b. Or drop the lock file; the next open creates a fresh inode
rm -f "${XDG_RUNTIME_DIR:-/tmp}/omarchy-update.lock"
# 4. Resume, then apply any migrations the suppressed notification hid from you
omarchy update
omarchy-migrate --pending && omarchy-migrate
To stop it recurring, keep sticky build daemons out of the update: adb kill-server before running omarchy update, or update those AUR packages separately with yay -Sua outside the Omarchy pipeline.
Verify
fuser -v "${XDG_RUNTIME_DIR:-/tmp}/omarchy-update.lock" prints nothing, and omarchy update reaches its confirmation prompt.
Sources
- https://raw.githubusercontent.com/basecamp/omarchy/quattro/bin/omarchy-update-lock
- https://raw.githubusercontent.com/basecamp/omarchy/quattro/bin/omarchy-update
- https://raw.githubusercontent.com/basecamp/omarchy/quattro/docs/update-process.md
- https://github.com/basecamp/omarchy/issues/8077
- https://raw.githubusercontent.com/omacom/omarchy/quattro/bin/omarchy-update-system-pkgs
- https://raw.githubusercontent.com/omacom/omarchy/quattro/bin/omarchy-migrate
- https://raw.githubusercontent.com/omacom/omarchy/quattro/bin/omarchy-update-pacman
- https://github.com/omacom/omarchy/issues/8077