Skip to content

Survive an unset OMARCHY_PATH in the update pipeline - #11111

Open
aholbreich wants to merge 2 commits into
omacom:quattrofrom
aholbreich:fix/issue-9953
Open

Survive an unset OMARCHY_PATH in the update pipeline#11111
aholbreich wants to merge 2 commits into
omacom:quattrofrom
aholbreich:fix/issue-9953

Conversation

@aholbreich

Copy link
Copy Markdown

sudo omarchy update aborts right after the snapshot — OMARCHY_PATH: unbound variable — before anything upgrades. On a dev-linked box it also silently skipped the dev checkout and printed a broken snapper setup path.

OMARCHY_PATH is set by default/bash/env-bootstrap, which only runs from a login shell, an interactive rc, or the uwsm session. sudo runs the router under env_reset, so the variable is gone and nothing re-establishes it.

Changes:

  • omarchy-update-dev and omarchy-snapshot resolve an unset OMARCHY_PATH from the root-owned /etc/omarchy.conf that omarchy-dev-link writes, falling back to /usr/share/omarchy.
  • omarchy-update-dev skips a dev-linked checkout when run as root and says so, instead of exiting silently — pulling a user-owned checkout as root would leave root-owned objects behind.
  • omarchy-snapshot prints the checkout's real snapper path instead of a bare /install/config.
  • omarchy-update-available keeps the plain packaged default: its git fetch shouldn't run as root on a user checkout.

This stops the abort. It doesn't make a root-run update correct — migrations, hooks, AUR/mise updates, and omarchy-restart-shell still read root's $HOME. Whether sudo omarchy update should be supported, refused, or drop privileges is a separate call.

Fixes #8369
Fixes #9953

omarchybot and others added 2 commits September 3, 2026 05:38
`sudo omarchy update` aborted right after the snapshot with
`/usr/bin/omarchy-update-dev: line 7: OMARCHY_PATH: unbound variable`,
before any package was upgraded.

OMARCHY_PATH is established by default/bash/env-bootstrap, which runs only
from a login shell, an interactive rc, or the uwsm session environment.
sudo execs the router directly under its default env_reset and
omarchy-update re-execs itself through `script -qefc`, so none of those
run and the variable is unset. Both scripts are `set -u` and dereference
it bare, which kills omarchy-update-dev and fires the ERR trap in
omarchy-update. omarchy-update-available is reached from the same run
through omarchy-update-status, where its death reads as "no updates".

/usr/share/omarchy is the value env-bootstrap itself picks when no
dev-link config is present, and omarchy-migrate already defaults the same
way one step later in this pipeline. A dev-linked checkout is therefore
not pulled under sudo, which is the safe branch: omarchy-dev-link grants
sudo a secure_path and no env_keep, and pulling a user-owned checkout as
root would leave root-owned objects behind.

This stops the abort; it does not make a root-run update correct. Whether
`sudo omarchy update` should be supported at all is a separate question.

Co-Authored-By: Codex XHigh <codex@openai.com>
sudo's env_reset drops OMARCHY_PATH. Defaulting straight to the packaged
tree silently skipped a dev-linked checkout in omarchy-update-dev and made
omarchy-snapshot print a bare /install/config path. Resolve from the
root-owned /etc/omarchy.conf that omarchy-dev-link writes, and warn instead
of pulling a user-owned checkout as root.

Documents the root-entry-point exception in AGENTS.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants