fix(daemon): add headless server hints to systemd unavailable error

Add loginctl enable-linger and XDG_RUNTIME_DIR recovery hints to the
generic (non-WSL) systemd unavailable error path, helping users on
SSH/headless servers diagnose and fix the issue without a desktop
session.

Fixes #11805

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
chocobo9
2026-03-24 16:07:47 -07:00
committed by Peter Steinberger
parent 2aaea9f99e
commit 762fed1f90
2 changed files with 4 additions and 0 deletions

View File

@@ -28,6 +28,8 @@ describe("renderSystemdUnavailableHints", () => {
it("renders generic Linux recovery hints outside WSL", () => {
expect(renderSystemdUnavailableHints()).toEqual([
"systemd user services are unavailable; install/enable systemd or run the gateway under your supervisor.",
"On a headless server (SSH/no desktop session): run `loginctl enable-linger` to persist your systemd user session across logins.",
"Also ensure XDG_RUNTIME_DIR is set: `export XDG_RUNTIME_DIR=/run/user/$(id -u)`, then retry.",
`If you're in a container, run the gateway in the foreground instead of \`${formatCliCommand("openclaw gateway")}\`.`,
]);
});

View File

@@ -24,6 +24,8 @@ export function renderSystemdUnavailableHints(options: { wsl?: boolean } = {}):
}
return [
"systemd user services are unavailable; install/enable systemd or run the gateway under your supervisor.",
"On a headless server (SSH/no desktop session): run `loginctl enable-linger` to persist your systemd user session across logins.",
"Also ensure XDG_RUNTIME_DIR is set: `export XDG_RUNTIME_DIR=/run/user/$(id -u)`, then retry.",
`If you're in a container, run the gateway in the foreground instead of \`${formatCliCommand("openclaw gateway")}\`.`,
];
}