Repository navigation
Description
Summary
On a headless Ubuntu server running as root, OpenClaw 2026.6.1 still misdetects the Linux systemd user gateway service as disabled/stopped even though:
systemctl --user show openclaw-gateway.servicereports the unit as loaded, enabled, active, and running.- The gateway RPC probe succeeds.
- The gateway server version is
2026.6.1. - Plugin version drift is empty.
This looks like a regression or incomplete fix for the issues previously closed as fixed:
- [Bug]: openclaw gateway restart fails while user systemd service works via systemctl --user (service shown as disabled/stopped inconsistently) #40275
- openclaw gateway status fails on EC2/headless servers due to missing user-level systemd #11805
- bug:
openclaw gateway installfails on Linux when service not yet installed #38052 - [Bug]: openclaw status incorrectly reports "systemd not installed" when gateway is running via systemd #27267
Environment
- OpenClaw:
2026.6.1 (2e08f0f) - Install method: npm global / package-manager update
- Node:
v22.22.2 - npm:
10.9.7 - OS: Ubuntu
24.04.4 LTS(noble) - Kernel/arch: Linux
6.17.0-1011-oracle,aarch64 - User:
root - Gateway service type: Linux systemd user service
- Unit path:
/root/.config/systemd/user/openclaw-gateway.service - There is also a local drop-in wrapper for SecretRef/BWS-backed environment loading; sensitive details omitted.
What happened
After openclaw update from 2026.5.27 to 2026.6.1, the update completed the package step and doctor checks, but failed while refreshing/restarting the Gateway service:
Failed to refresh gateway service environment from updated install: Error: updated install refresh failed (/usr/lib/node_modules/openclaw/dist/index.js): [state-migrations] Legacy state migration warnings:
- Left plugin install index in place because shared SQLite state has conflicting plugin install metadata for: acpx, brave, codex
Gateway install failed: Error: systemctl enable failed: Failed to enable unit: Unit file openclaw-gateway.service does not exist.
Then openclaw doctor --fix reported the same install failure:
Gateway service install failed: Error: systemctl enable failed: Failed to enable unit:
Unit file openclaw-gateway.service does not exist.
Manually targeting the root systemd user bus works:
export XDG_RUNTIME_DIR=/run/user/0
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/0/bus
systemctl --user daemon-reload
systemctl --user enable openclaw-gateway.service
systemctl --user restart openclaw-gateway.serviceEvidence
Systemd user state, with explicit root user bus:
$ env XDG_RUNTIME_DIR=/run/user/0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/0/bus \
systemctl --user show openclaw-gateway.service \
-p LoadState -p UnitFileState -p ActiveState -p SubState -p MainPID -p FragmentPath -p DropInPaths --no-pager
MainPID=<pid>
LoadState=loaded
ActiveState=active
SubState=running
FragmentPath=/root/.config/systemd/user/openclaw-gateway.service
DropInPaths=/root/.config/systemd/user/openclaw-gateway.service.d/10-bitwarden-secrets-manager.conf
UnitFileState=enabled
But openclaw gateway status --json still reports the service as disabled/stopped:
{
"cli": {
"version": "2026.6.1",
"entrypoint": "/usr/bin/openclaw"
},
"service": {
"label": "systemd user",
"loaded": false,
"loadedText": "enabled",
"notLoadedText": "disabled",
"command": {
"programArguments": [
"/usr/bin/node",
"/usr/lib/node_modules/openclaw/dist/index.js",
"gateway",
"--port",
"18789"
],
"sourcePath": "/root/.config/systemd/user/openclaw-gateway.service"
},
"runtime": {
"status": "stopped",
"state": "inactive",
"subState": "dead",
"systemd": {
"unit": "openclaw-gateway.service",
"killMode": "control-group"
}
}
},
"gateway": {
"bindMode": "loopback",
"bindHost": "127.0.0.1",
"port": 18789,
"version": "2026.6.1"
},
"rpc": {
"ok": true,
"capability": "admin_capable",
"version": "2026.6.1",
"url": "ws://127.0.0.1:18789"
},
"pluginVersionDrift": {
"gatewayVersion": "2026.6.1",
"drifts": []
}
}The same false service state is returned even when openclaw gateway status --json is executed with:
XDG_RUNTIME_DIR=/run/user/0
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/0/busExpected behavior
When the root systemd user unit exists and systemd reports:
LoadState=loaded
UnitFileState=enabled
ActiveState=active
SubState=running
OpenClaw should report the gateway service as enabled/running, and openclaw update / openclaw doctor --fix should not try to use a system-scope systemctl enable path that fails with:
Unit file openclaw-gateway.service does not exist.
Actual behavior
OpenClaw can connect to the running 2026.6.1 Gateway via RPC, but its service detection reports:
service.loaded=false
service.runtime.status=stopped
service.runtime.state=inactive
service.runtime.subState=dead
This is operationally confusing after updates because the service is actually healthy, while OpenClaw's own lifecycle/status path says it is disabled/stopped.
Notes
This host has loginctl enable-linger root enabled and /run/user/0/bus exists. The service can be managed successfully with systemctl --user when the root user bus environment is explicit.
The issue appears to be in OpenClaw's service detection/lifecycle path rather than in the running Gateway process.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Jun 4, 2026
Thanks for the context here. I did a careful shell check against current
main, and this is already implemented.Close: current main fixes the root user-manager scope misdetection by keeping effective-root commands with
/rootand/run/user/0/buson baresystemctl --user; the fix merged afterv2026.6.8, so it is main-only for now.I found the merged PR that appears to have closed this: #93693: fix(gateway): ignore stale sudo scope for root user services.
So I’m closing this as already implemented rather than keeping a duplicate issue open.
Review details
Best possible solution:
Keep the current main root systemd scope fix, and use #79515 for the separate stale failed-state status cross-check if that still reproduces.
Do we have a high-confidence way to reproduce the issue?
Yes for source reproduction: the reported root user-bus shape is covered by the merged regression tests and current source now keeps that path on direct
systemctl --user. I did not run a live Ubuntu root systemd user-manager setup in this read-only review.Is this the best way to solve the issue?
Yes. Fixing the shared systemd user-scope resolver is the narrow maintainable solution because status, service enable/restart, and doctor/update activation all route through
execSystemctlUser.Security review:
Security review: No patch is under review and the issue is not a security-sensitive report.
AGENTS.md: found and applied where relevant.
What I checked:
AGENTS.md:1, d4833e27c775)/root/.config/systemd/user/openclaw-gateway.service, explicit/run/user/0/busmanagement working, and OpenClaw reportingservice.loaded=false/runtime.status=stoppedwhile RPC succeeds.machineUserto null, so stale non-root sudo context no longer redirects root/run/user/0/busoperations away from baresystemctl --user. (src/daemon/systemd.ts:680, d4833e27c775)execSystemctlUserfordaemon-reload,enable, andrestart, so the root scope fix applies to the reported install/doctor refresh failure path. (src/daemon/systemd.ts:1068, d4833e27c775)isSystemdServiceEnabledandreadSystemdServiceRuntimeuse the sameexecSystemctlUserpath for user-scope units, so status loaded/runtime detection now shares the fixed root scope routing. (src/daemon/systemd.ts:1233, d4833e27c775)SUDO_USERplusHOME=/root,XDG_RUNTIME_DIR=/run/user/0, and root DBus keeps direct--userstatus/restart behavior. (src/daemon/systemd.test.ts:337, d4833e27c775)Likely related people:
src/daemon/systemd.ts,src/daemon/systemd.test.ts,src/commands/status.service-summary.ts)src/daemon/systemd.ts,src/daemon/systemd.test.ts)src/daemon/systemd.ts,src/cli/daemon-cli/status.gather.ts)src/daemon/systemd.ts,src/daemon/systemd.test.ts,src/cli/daemon-cli/lifecycle.ts)Codex review notes: model internal, reasoning high; reviewed against d4833e27c775; fix evidence: merged PR #93693, commit 64785823d093, main fix timestamp 2026-06-16T15:56:12Z.