Skip to content

Fall back when reboot has no session D-Bus - #11151

Open
caueguerra wants to merge 8 commits into
omacom:quattrofrom
caueguerra:fix/issue-11108
Open

caueguerra wants to merge 8 commits into
omacom:quattrofrom
caueguerra:fix/issue-11108

Conversation

@caueguerra

Copy link
Copy Markdown

omarchy update → reboot fails from tmux, SSH, or a bare TTY with:

Failed to connect to user scope bus via local transport: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined

omarchy-system-reboot (and shutdown) always called systemd-run --user. Restore the session bus from $XDG_RUNTIME_DIR/bus when that socket exists, and fall back to systemd-run --system when it does not, so the 2s delayed reboot still schedules before windows close.

Fixes #11108

omarchy-system-reboot and shutdown always used systemd-run --user, which
fails from tmux, SSH, or a bare TTY when the session bus variables are
unset. Reconstruct the bus from XDG_RUNTIME_DIR when possible, then fall
back to the system manager so the delayed reboot still schedules.
@omarchybot omarchybot added the bug Something isn't working label Sep 27, 2026
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 2, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at 901d9aa against quattro, and the fix holds: #11108 is reproduced on a worker built from the Omarchy ISO and gone with this branch.

What ran on the worker:

  • With DBUS_SESSION_BUS_ADDRESS and XDG_RUNTIME_DIR unset, quattro's omarchy-system-reboot fails with the exact error in omarchy-system-reboot: fails when DBUS_SESSION_BUS_ADDRESS and XDG_RUNTIME_DIR are not set #11108 and the machine stays up. This branch's script reboots it within seconds, through the user manager, because XDG_RUNTIME_DIR is restored to /run/user/$UID.
  • Under sudo, which strips both variables, quattro fails the same way and this branch reboots through the --system fallback.
  • With the user manager unreachable, an ordinary user's --system fallback needs polkit. On a TTY it prompts for the password, and without one it is refused and the script exits 1 without touching state or windows — no worse than today.
  • test/shell.d/system-power-test.sh passes 7/7 here and fails against quattro's scripts. ./test/cli and bin-style-test.sh pass. Shutdown is the same change with poweroff, so it was covered by the test rather than by powering the worker off.

Reviewed by Claude Opus 5.5. The second opinion (Codex Medium) did not run: today's review budget was spent. So this is verified but not marked ready, and it waits on that second review and on the maintainer.

#13984 rewrites the same two scripts and still calls systemd-run --user unconditionally. Whichever lands second will need this fallback carried across.

@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Oct 4, 2026
…hutdown

quattro now schedules shutdown as a bounded user service that holds a sleep and lid inhibitor, so the fallback moves with it: restore the session bus from XDG_RUNTIME_DIR, and when the user manager is still unreachable start the same service in the system manager.
The reconstruction tests only required a non-empty address, and nothing exercised a missing XDG_RUNTIME_DIR. The systemd-run mock now records what the user manager attempt saw, so both restorations are checked by value.
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 7, 2026
@greptile-apps

greptile-apps Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change affects how system power requests are scheduled.

The PR should not merge until the fallback keeps desktop preparation under the caller’s account.

Findings

  1. P1 Shutdown skips closing applications ▶

Summary

Restores missing session-bus settings before scheduling a power action.

  • Power actions can still start when the session bus is missing.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Power action] --> B[Restore missing bus settings]
  B --> C{User manager starts worker?}
  C -->|Yes| D[Run worker]
  C -->|No| E{Logout?}
  E -->|Yes| F[Return failure]
  E -->|No| G[Try system manager]
  G --> D
Loading

Reviews (5) · Last reviewed commit: "Merge quattro into fix/issue-11108" · Reviewed by Greptile

Comment thread bin/omarchy-system-shutdown Outdated
Comment on lines +40 to +41
systemd-run --system --collect --quiet --property=Type=exec --property=RuntimeMaxSec=30s \
"$OMARCHY_PATH/bin/omarchy-system-shutdown" --inhibit

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Shutdown skips closing applications

If the system-manager fallback is authorized while applications are open, the --inhibit worker runs as root without the caller’s desktop environment. omarchy-hyprland-window-close-all cannot reach the user’s Hyprland session, and omarchy-state targets root’s state instead of the user’s. The worker still powers off after two seconds, skipping the promised clean application shutdown.

Keep desktop preparation in the user’s session and move only the privileged power-off step to the system manager.

Comment thread test/shell.d/system-power-test.sh Resolved
@omarchybot omarchybot added the ready Good to merge label Oct 7, 2026
Sandboxes that deny binding a Unix socket would otherwise fail the test on a missing fixture rather than a product bug, as compositor-guard-test.sh already allows for. The XDG_RUNTIME_DIR case needs no socket, so it runs first.
@omarchybot

Copy link
Copy Markdown
Collaborator

This branch no longer merged with quattro, which has since rewritten omarchy-system-shutdown to run itself as a bounded service holding a sleep and lid-switch inhibitor. I've pushed a merge of quattro that carries your fix into that shape, and two test commits on top. The head is now 2f9c5d0.

What changed in the merge:

  • omarchy-system-reboot is your change as it was, since quattro hasn't touched it.
  • omarchy-system-shutdown restores XDG_RUNTIME_DIR and the session bus the same way, then starts the --inhibit service in the user manager. If the user manager still can't be reached, it starts that same service in the system manager.
  • test/shell.d/system-power-test.sh keeps quattro's tests and adds yours, ported to the new mock. The mock now records which XDG_RUNTIME_DIR and bus address the user-manager attempt received, so restoring them is checked by value. The case that binds a Unix socket is skipped where binding isn't allowed, as compositor-guard-test.sh does.

What ran, on a worker built from the Omarchy ISO, against quattro at d9b970d:

  • With DBUS_SESSION_BUS_ADDRESS and XDG_RUNTIME_DIR unset, quattro's reboot and shutdown both fail with the error in omarchy-system-reboot: fails when DBUS_SESSION_BUS_ADDRESS and XDG_RUNTIME_DIR are not set #11108, as a user and under sudo, and the machine stays up.
  • This branch's reboot restarted the worker as a user and again under sudo. Under sudo, shutdown started the system service, which held a Shutdown in progress block inhibitor on sleep, idle and the lid switch, and then powered the worker off.
  • ./test/cli, system-power-test.sh (15/15) and bin-style-test.sh pass. The new power tests fail against quattro's scripts.

When the fallback runs as root, it doesn't close the user's windows or clear their restart state. Codex and Greptile both flagged this. It only happens when there is no user manager to reach, which in practice means root through sudo. There the caller has no Hyprland session to prepare anyway, and that is equally true of reboot's preparation on this branch. So the fallback does nothing less than quattro does; it powers the machine off where quattro fails.

Reviewed by Claude Opus 5.5, with Codex Medium as the second opinion over three rounds. Codex withdrew its first-round finding (the root fallback above) after checking that reasoning, and it agreed with the test changes. Its last round on this head found nothing open; independence between the two reviews is not guaranteed. This now waits on the maintainer.

#14248 and #13984 rewrite the same scripts and still call systemd-run --user unconditionally. Whichever lands after this one will need the fallback carried across.

@omarchybot omarchybot removed ready Good to merge verified Omarchy Triage has verified that this issue is ready for final review labels Oct 13, 2026
quattro replaced omarchy-system-reboot and omarchy-system-shutdown with a single omarchy-system that still schedules every session exit with an unconditional systemd-run --user. The fallback moves there: restore XDG_RUNTIME_DIR and the session bus first, and when the user manager still cannot be reached, start the same bounded --execute service in the system manager for reboot and shutdown. Logout stays user-manager only, since uwsm stop run by the system manager cannot end the caller's session.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot added verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Oct 13, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

This branch stopped merging with quattro again: #15231 deleted omarchy-system-reboot and omarchy-system-shutdown and moved logout, reboot and shutdown into one bin/omarchy-system, which still schedules every exit with a plain systemd-run --user. I've pushed a merge of quattro that carries your fix into that script. The head is now fb53810.

What changed in the merge:

  • bin/omarchy-system restores XDG_RUNTIME_DIR and the session bus the way your scripts did, then starts its bounded --execute service in the user manager. If that still fails, reboot and shutdown start the same service in the system manager.
  • Logout gets the restored bus but not the fallback. uwsm stop run by the system manager can't end the caller's session, so without a user manager logout fails as it does today.
  • test/shell.d/system-power-test.sh keeps quattro's tests and adds yours, ported to omarchy-system.

What ran, on a worker built from the Omarchy ISO, against quattro at d8027c9:

  • With DBUS_SESSION_BUS_ADDRESS and XDG_RUNTIME_DIR unset, quattro's omarchy-system reboot and shutdown both fail with the error in omarchy-system-reboot: fails when DBUS_SESSION_BUS_ADDRESS and XDG_RUNTIME_DIR are not set #11108, as a user and under sudo, and the worker stays up.
  • This branch rebooted the worker as a user, through the user manager, and again under sudo, through the system-manager fallback. Under sudo, shutdown powered the worker off within a second.
  • ./test/cli, system-power-test.sh (27/27) and bin-style-test.sh pass. The new power tests fail against quattro's script.

Greptile's finding is the same one answered above: when the fallback runs as root, preparation doesn't reach the user's Hyprland session. That only happens when no user manager can be reached, and the fallback still powers off where quattro fails.

Reviewed by Claude Opus 5.5. Codex Medium reviewed this head as the second opinion. It found nothing open, agreed with the logout decision and reproduced the failure on quattro itself. Independence between the two reviews is not guaranteed. This now waits on the maintainer.

@jandrusk

Copy link
Copy Markdown

Still a real gap for update→reboot from tmux/SSH (#11108).

#15231 consolidated reboot/shutdown into bin/omarchy-system, and omarchybot already noted this branch keeps losing the merge. A rebase onto current quattro (and re-check the session-bus fallback against the new layout) and this should be mergeable again.

@omarchybot omarchybot removed ready Good to merge verified Omarchy Triage has verified that this issue is ready for final review labels Oct 14, 2026
quattro added a reboot-boot-menu action to omarchy-system and appended its test to system-power-test.sh. The script merged cleanly, and the new action takes the system-manager fallback like reboot, since it is not logout. The test conflicted at the end of the file: quattro's block runs first now, because this branch's tests end in an early exit where a Unix socket cannot be bound, and reboot-boot-menu joins the fallback loop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot added verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Oct 14, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

This branch stopped merging with quattro again: #15301 added a reboot-boot-menu action to bin/omarchy-system and a test for it at the end of system-power-test.sh. I've pushed a merge of quattro, and the head is now 460e754.

What changed in the merge:

  • bin/omarchy-system merged cleanly. reboot-boot-menu gets the restored session bus and the system-manager fallback the same as reboot, since only logout is kept out of it.
  • In the test, quattro's reboot-boot-menu block now runs before this branch's tests, because the last of those exits early where a Unix socket can't be bound. reboot-boot-menu is added to the fallback loop.

What ran, on a worker built from the Omarchy ISO, against quattro at 58a289e:

  • With DBUS_SESSION_BUS_ADDRESS and XDG_RUNTIME_DIR unset, quattro's reboot, reboot-boot-menu and shutdown all fail with the error in omarchy-system-reboot: fails when DBUS_SESSION_BUS_ADDRESS and XDG_RUNTIME_DIR are not set #11108, as a user and under sudo, and the worker stays up.
  • This branch's reboot-boot-menu rebooted the worker into the Omarchy boot menu as a user, and again under sudo through the system-manager fallback.
  • system-power-test.sh (29/29), ./test/cli and bin-style-test.sh pass. With quattro's omarchy-system put back, the power test fails.

Reviewed by Claude Opus 5.5. Codex Medium reviewed the merge as the second opinion and found nothing open: it checked that no later test depends on the moved block and that quattro's changes all came across. Independence between the two reviews is not guaranteed. This now waits on the maintainer.

@omarchybot omarchybot removed ready Good to merge verified Omarchy Triage has verified that this issue is ready for final review labels Oct 18, 2026
quattro removed reboot-boot-menu from omarchy-system and its test (omacom#15795), so the block this branch had moved ahead of its own tests goes too, and the fallback loop covers reboot and shutdown only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot added verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Oct 18, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

This branch stopped merging with quattro again: #15795 removed the reboot-boot-menu action from bin/omarchy-system and its test. I've pushed a merge of quattro, and the head is now 9fc0681.

What changed in the merge:

  • bin/omarchy-system merged cleanly. Your session-bus restore and the system-manager fallback now sit beside quattro's translated messages, and nothing in the script mentions reboot-boot-menu any more.
  • In test/shell.d/system-power-test.sh, the reboot-boot-menu block this branch had moved ahead of its own tests is gone, as on quattro, and the fallback loop covers reboot and shutdown.

What ran, on a worker built from the Omarchy ISO, against quattro at 0c93f61:

  • With DBUS_SESSION_BUS_ADDRESS and XDG_RUNTIME_DIR unset, quattro's omarchy-system reboot and shutdown both fail with the error in omarchy-system-reboot: fails when DBUS_SESSION_BUS_ADDRESS and XDG_RUNTIME_DIR are not set #11108, as a user and under sudo, and the worker stays up.
  • This branch rebooted the worker as a user and again under sudo, through the system-manager fallback. Under sudo, shutdown powered the worker off within seconds.
  • ./test/cli, system-power-test.sh (27/27) and bin-style-test.sh pass. With quattro's omarchy-system put back, the power test fails.

Reviewed by Claude Opus 5.5, with Codex Medium as the second opinion over two rounds. Codex found that when the fallback runs as root, HOME is unset, so the new omarchy-i18n lookups fail and the on-screen message and failure notification are empty. That's true, but those strings are only shown in the user's graphical session, which a root service in the system manager can't reach either way. Setting HOME would give root's language, not the user's. In its second round Codex checked this, closed the finding, and found nothing else open. Independence between the two reviews is not guaranteed. This now waits on the maintainer.

@omarchybot omarchybot removed ready Good to merge verified Omarchy Triage has verified that this issue is ready for final review labels Nov 16, 2026
Carry the session-bus restore and system-manager fallback through omacom#19003, which added the firmware action, and omacom#19006, which delays the exit OSD. Firmware falls back like reboot and shutdown, so the comment now names every exit but logout, and the fallback test covers it. Quattro's firmware test runs before this branch's tests, the last of which exits early where a Unix socket can't be bound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Nov 16, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

This branch stopped merging with quattro again. #19003 added a firmware action to bin/omarchy-system, which reboots into the BIOS, and put a test for it at the end of system-power-test.sh, where this branch's tests also end. I've pushed a merge of quattro, so the head is now dd5eff3.

What changed in the merge:

  • bin/omarchy-system merged cleanly. firmware gets your restored session bus and the system-manager fallback the same as reboot, so the comment above the fallback now says every exit except logout falls back. Show the system exit OSD only once the exit has taken 2 seconds #19006's delayed OSD came across unchanged.
  • In the test, quattro's firmware block runs before this branch's tests, because the last of those exits early where a Unix socket can't be bound. firmware is added to the fallback loop.

What ran, on a worker built from the Omarchy ISO, against quattro at 3b36b9e:

  • With DBUS_SESSION_BUS_ADDRESS and XDG_RUNTIME_DIR unset, quattro's omarchy-system reboot, firmware and shutdown all fail with the error in omarchy-system-reboot: fails when DBUS_SESSION_BUS_ADDRESS and XDG_RUNTIME_DIR are not set #11108, as a user and under sudo, and the worker stays up.
  • This branch rebooted the worker as a user, with the unit in the user manager. Under sudo the user bus still fails, so the unit runs in the system manager instead, and the worker rebooted that way too. Under sudo, shutdown powered the worker off within five seconds. A real firmware reboot was not run, because under sudo it would leave the VM sitting in firmware setup. It is scheduled exactly like reboot, and the mocked test covers its fallback.
  • ./test/cli, system-power-test.sh (29/29) and bin-style-test.sh pass. With quattro's omarchy-system put back, the power test fails.

Reviewed by Claude Opus 5.5. Codex Medium and muse-wonder (via pi, thinking high) reviewed the merge as second opinions and found nothing to change. They checked that no later test depends on what the moved firmware block leaves behind. They also checked that the logind firmware check and systemctl reboot --firmware-setup work from a root unit in the system manager, and that the delayed OSD doesn't hold up the reboot there. Independence between the reviews is not guaranteed.

One question is still open, as before. When the fallback runs as root in the system manager, closing windows and saving state don't reach the user's Hyprland session. So the choice between keeping that fallback and shipping only the session-bus restore is the maintainer's. This now waits on the maintainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

omarchy-system-reboot: fails when DBUS_SESSION_BUS_ADDRESS and XDG_RUNTIME_DIR are not set

3 participants