openclaw/src/daemon/systemd-hints.ts

30 lines
1.1 KiB
TypeScript
Raw Normal View History

2026-01-20 07:42:21 +00:00
import { formatCliCommand } from "../cli/command-format.js";
2026-01-17 18:19:47 +00:00
export function isSystemdUnavailableDetail(detail?: string): boolean {
if (!detail) {
return false;
}
2026-01-17 18:19:47 +00:00
const normalized = detail.toLowerCase();
return (
normalized.includes("systemctl --user unavailable") ||
normalized.includes("systemctl not available") ||
normalized.includes("not been booted with systemd") ||
normalized.includes("failed to connect to bus") ||
normalized.includes("systemd user services are required")
);
}
export function renderSystemdUnavailableHints(options: { wsl?: boolean } = {}): string[] {
if (options.wsl) {
return [
"WSL2 needs systemd enabled: edit /etc/wsl.conf with [boot]\\nsystemd=true",
"Then run: wsl --shutdown (from PowerShell) and reopen your distro.",
"Verify: systemctl --user status",
];
}
return [
"systemd user services are unavailable; install/enable systemd or run the gateway under your supervisor.",
2026-01-30 03:15:10 +01:00
`If you're in a container, run the gateway in the foreground instead of \`${formatCliCommand("openclaw gateway")}\`.`,
2026-01-17 18:19:47 +00:00
];
}