omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

`omarchy debug` and four other commands are unreachable inside the Hyprland session: envs.lua prepends an incomplete bin dir

Open kevinchiha opened this issue 3 months ago • 4 comments

What happened

Inside a Hyprland session, omarchy debug fails with "Unknown Omarchy command", along with four other commands. Outside the session (a plain login shell, e.g. over SSH or a TTY) the very same commands work.

# in a terminal inside the Hyprland session
$ omarchy debug --no-sudo --print
Unknown Omarchy command: omarchy debug --no-sudo --print
Run 'omarchy commands --all' to discover available commands.

# same machine, clean login shell
$ env -i HOME=$HOME bash -lc 'omarchy debug --no-sudo --print' | head -3
Date: Sat Aug 15 04:43:49 PM EEST 2026
Hostname: omarchyos
Omarchy Package: omarchy 4.0.0-1

They are also missing from omarchy commands --all inside the session.

Root cause

bin/omarchy resolves the directory it scans for commands from its own location:

OMARCHY_BIN_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)

so whichever copy of omarchy wins on PATH decides which commands exist.

default/bash/env-bootstrap is careful about this and deliberately does not prepend $OMARCHY_PATH/bin on a production install:

# Only prepend in dev-link mode. On a production install, the binaries are
# already on PATH as /usr/bin/omarchy-* via the omarchy package — prepending
# /usr/share/omarchy/bin would just be noise.
if [ "$OMARCHY_PATH" != /usr/share/omarchy ]; then
  ...prepend...
fi

But default/hypr/envs.lua prepends it unconditionally, for the whole graphical session:

local bin_dir = paths.omarchy_path .. "/bin"
local kept = {}
for entry in (os.getenv("PATH") or "/usr/local/bin:/usr/bin"):gmatch("[^:]+") do
  if entry ~= bin_dir then table.insert(kept, entry) end
end
table.insert(kept, 1, bin_dir)
hl.env("PATH", table.concat(kept, ":"))

default/hypr/autostart.lua then pushes that into the systemd user manager:

hl.exec_cmd("systemctl --user import-environment $(env | cut -d'=' -f 1)")

so every terminal and every app started from the session inherits it:

$ systemctl --user show-environment | grep ^PATH=
PATH=/usr/share/omarchy/bin:/home/…/.local/share/mise/shims:…:/usr/bin:…

Why the prepend is not merely "noise"

The two directories are not equivalent. /usr/bin has the complete set; five binaries shipped by the omarchy-settings package never land in /usr/share/omarchy/bin:

$ comm -23 <(cd /usr/bin && ls omarchy-* | sort) \
           <(cd /usr/share/omarchy/bin && ls omarchy-* | sort)
omarchy-debug
omarchy-debug-idle
omarchy-nvim-refresh
omarchy-nvim-setup
omarchy-upload-log

$ ls /usr/bin/omarchy-* | wc -l               # 426
$ ls /usr/share/omarchy/bin/omarchy-* | wc -l # 421

So prepending shadows a complete command directory with an incomplete one, and those five routes disappear for the entire graphical session.

The two copies of the dispatcher are byte-identical, both owned by omarchy 4.0.0-1, which confirms the only variable is which directory it scans:

$ cmp /usr/bin/omarchy /usr/share/omarchy/bin/omarchy && echo identical
identical
$ /usr/bin/omarchy debug --no-sudo --print   # works
$ /usr/bin/omarchy theme current             # works

Affected routes

Route Binary Package
omarchy debug omarchy-debug omarchy-settings
omarchy debug idle omarchy-debug-idle omarchy-settings
omarchy nvim refresh omarchy-nvim-refresh omarchy-settings
omarchy nvim setup omarchy-nvim-setup omarchy-settings
omarchy upload log omarchy-upload-log omarchy-settings

omarchy-debug itself declares the route it cannot be reached by:

$ head -6 /usr/bin/omarchy-debug
#!/bin/bash

# omarchy:summary=Print debugging information
# omarchy:args=[--no-sudo] [--print]
# omarchy:examples=omarchy debug --print --no-sudo
# omarchy:requires-sudo=true

Why this one stings

omarchy debug --no-sudo --print is what Omarchy's own shipped agent skill tells users and coding agents to run. From default/agents/skills/omarchy/SKILL.md:

IMPORTANT: Always run omarchy debug with --no-sudo --print flags to avoid interactive sudo prompts that will hang the terminal.

and from default/agents/skills/omarchy/contributing.md, as step one of filing a bug report:

# Generate the diagnostic log (also written to /tmp/omarchy-debug.log)
omarchy debug --no-sudo --print

So the documented way to collect diagnostics fails in the environment users actually run it in, and omarchy upload log — the command that shares the resulting log — is unreachable for the same reason.

Steps to reproduce

In a terminal inside a Hyprland session on a production (non-dev-link) install:

echo "$PATH" | tr ':' '\n' | head -1   # /usr/share/omarchy/bin
omarchy debug                          # Unknown Omarchy command
omarchy upload log                     # Unknown Omarchy command
omarchy commands --all | grep -c debug # 0

Suggested fix

Make envs.lua follow the same rule env-bootstrap already states — prepend $OMARCHY_PATH/bin only when OMARCHY_PATH is not /usr/share/omarchy:

if paths.omarchy_path ~= "/usr/share/omarchy" then
  -- prepend as today
end

Alternatively, ship the five omarchy-settings binaries into /usr/share/omarchy/bin as well so the two directories stay interchangeable.

Workaround

omarchy-debug --no-sudo --print           # call the binary
/usr/bin/omarchy debug --no-sudo --print  # or the /usr/bin dispatcher

System details

  • Omarchy: 4.0.0-1 (omarchy 4.0.0-1, omarchy-settings 4.0.0-1)
  • CPU: 13th Gen Intel Core i9-13900KF
  • GPU: AMD Navi 31 [Radeon RX 7900 XTX]
  • Kernel: 7.1.8-1-cachyos
  • Upgraded in place from Omarchy 3 with omarchy-upgrade-to-quattro

/etc/omarchy.conf is absent and OMARCHY_PATH is /usr/share/omarchy, i.e. this is a normal production install, not dev-link. No debug log is attached because the fault is in command routing and is reproducible from the file lists and $PATH above.

kevinchiha avatar Aug 15 '26 13:08 kevinchiha

A fix is up as #7239. Your diagnosis is correct in every particular, including the file and the mechanism.

One thing worth adding: the blast radius is wider than the five commands. Because bin/omarchy resolves subcommands by globbing its own directory with no PATH fallback, prepending /usr/share/omarchy/bin hides every omarchy-* route that a package other than omarchy installs to /usr/bin — currently also four from omarchy-emacs and one each from omarchy-fish and omarchy-zsh, so eleven routes in total on a machine with those installed.

Until it lands, /usr/bin/omarchy debug works from inside the session, as does omarchy-debug directly.

omarchybot avatar Aug 17 '26 07:08 omarchybot

An update on where the fix stands: #7239, which my earlier comment pointed to, was closed in favour of #13351, which removes the PATH prepend from default/hypr/envs.lua and closes this issue when it merges.

The bug is still present on quattro at 902fd8ae: envs.lua:30-36 puts $OMARCHY_PATH/bin first for the whole session, autostart.lua imports that into the systemd user manager, and bin/omarchy only scans its own directory, so the five omarchy-settings commands stay unreachable from inside Hyprland. #13351 was reproduced on a worker built from the Omarchy ISO, set up as a production install: omarchy debug fails inside the session with quattro's envs.lua, works with the fix, and fails again with it reverted. Nothing that has landed on quattro since changes that. Dev-link sessions still get their checkout's bin on PATH through default/bash/env-bootstrap, so that mode loses nothing.

Three open pull requests take the other approach, adding a fallback in the dispatcher: #9290, #12750 and #14022. They cover different ground. #14022 only falls back for omarchy-debug, and #12750 resolves commands it cannot find but does not list them in omarchy commands --all. Which approach lands is the maintainer's call.

Reviewed by Claude Opus 5.5, with Codex Medium as a second opinion. Codex agreed with the mechanism and added the comparison of the dispatcher fallbacks, though its independence is not guaranteed. Waiting on the maintainer to decide on #13351.

omarchybot avatar Oct 08 '26 04:10 omarchybot

We also encountered this problem: omarchy debug reports Unknown Omarchy command in the Hyprland session.

pershin-daniil avatar Oct 26 '26 12:10 pershin-daniil

@pershin-daniil, thanks for confirming. This is still unfixed on quattro at e2c7007c. default/hypr/envs.lua:30-36 still puts /usr/share/omarchy/bin first on the session's PATH, and bin/omarchy still only looks for commands in its own directory. Until a fix lands, /usr/bin/omarchy debug or plain omarchy-debug works from inside the session.

A correction to my last comment: not all five unreachable commands come from omarchy-settings any more. omarchy-settings still installs omarchy-debug, omarchy-debug-idle and omarchy-upload-log to /usr/bin only. omarchy-nvim-setup and omarchy-nvim-refresh now ship in omarchy-nvim, also to /usr/bin only. So all five are still missing from /usr/share/omarchy/bin.

Two of the dispatcher fallbacks I mentioned, #12750 and #14022, have been closed. Two fixes remain open, and they work differently:

  • #13351 removes the PATH prepend, so omarchy resolves to /usr/bin/omarchy again. It closes this issue when it merges.
  • #9290 makes the dispatcher fall back to /usr/bin when it runs from /usr/share/omarchy/bin, for both running and listing commands. It was brought up to date with quattro on 31 October and reproduced on a worker built from the Omarchy ISO: with quattro's dispatcher, omarchy debug and the other four commands exit 127; with #9290, all five work. Reading the code, it should also cover two cases #13351 does not: a session started before the update, and /usr/share/omarchy/bin/omarchy called by its full path. That has been read, not tested. On the other hand, it leaves the session's PATH order as it is. It does not reference this issue yet.

Claude Opus 5.5 checked the source on quattro and the packaging in omarchy-pkgs. Codex Medium and muse-wonder (via pi, thinking high) gave second opinions. Both agreed with the diagnosis and the comparison above, and Codex found the omarchy-nvim packaging change. Their independence is not guaranteed. Choosing between the two fixes is up to the maintainer.

omarchybot avatar Nov 01 '26 22:11 omarchybot