mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix(gateway): preflight user D-Bus before systemctl --user start (#14531)
On fresh RHEL/Debian SSH sessions without linger, `systemctl --user start hermes-gateway` fails with 'Failed to connect to bus: No medium found' because /run/user/$UID/bus doesn't exist. Setup previously showed a raw CalledProcessError and continued claiming success, so the gateway never actually started. systemd_start() and systemd_restart() now call _preflight_user_systemd() for the user scope first: - Bus socket already there → no-op (desktop / linger-enabled servers) - Linger off → try loginctl enable-linger (works when polkit permits, needs sudo otherwise), wait for socket - Still unreachable → raise UserSystemdUnavailableError with a clean remediation message pointing to sudo loginctl + hermes gateway run as the foreground fallback Setup's start/restart handlers and gateway_command() catch the new exception and render the multi-line guidance instead of a traceback.
This commit is contained in:
parent
d50be05b1c
commit
d45c738a52
3 changed files with 295 additions and 0 deletions
|
|
@ -2334,6 +2334,7 @@ def setup_gateway(config: dict):
|
|||
launchd_install,
|
||||
launchd_start,
|
||||
launchd_restart,
|
||||
UserSystemdUnavailableError,
|
||||
)
|
||||
|
||||
service_installed = _is_service_installed()
|
||||
|
|
@ -2357,6 +2358,10 @@ def setup_gateway(config: dict):
|
|||
systemd_restart()
|
||||
elif _is_macos:
|
||||
launchd_restart()
|
||||
except UserSystemdUnavailableError as e:
|
||||
print_error(" Restart failed — user systemd not reachable:")
|
||||
for line in str(e).splitlines():
|
||||
print(f" {line}")
|
||||
except Exception as e:
|
||||
print_error(f" Restart failed: {e}")
|
||||
elif service_installed:
|
||||
|
|
@ -2366,6 +2371,10 @@ def setup_gateway(config: dict):
|
|||
systemd_start()
|
||||
elif _is_macos:
|
||||
launchd_start()
|
||||
except UserSystemdUnavailableError as e:
|
||||
print_error(" Start failed — user systemd not reachable:")
|
||||
for line in str(e).splitlines():
|
||||
print(f" {line}")
|
||||
except Exception as e:
|
||||
print_error(f" Start failed: {e}")
|
||||
elif supports_service_manager:
|
||||
|
|
@ -2389,6 +2398,10 @@ def setup_gateway(config: dict):
|
|||
systemd_start(system=installed_scope == "system")
|
||||
elif _is_macos:
|
||||
launchd_start()
|
||||
except UserSystemdUnavailableError as e:
|
||||
print_error(" Start failed — user systemd not reachable:")
|
||||
for line in str(e).splitlines():
|
||||
print(f" {line}")
|
||||
except Exception as e:
|
||||
print_error(f" Start failed: {e}")
|
||||
except Exception as e:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue