Skip to content

Regression: OpenClaw 2026.6.1 misdetects root systemd user gateway service after update/doctor #90113

Closed

Description

@oalansilva

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.service reports 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:

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.service

Evidence

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/bus

Expected 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.

Activity

  1. clawsweeper commented on Jun 4, 2026

    @clawsweeper
    Contributor

    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 /root and /run/user/0/bus on bare systemctl --user; the fix merged after v2026.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:

    • Repository policy read: Read the full root AGENTS.md and applied its OpenClaw review guidance for source, tests, current/shipped behavior, related items, and history before deciding. (AGENTS.md:1, d4833e27c775)
    • Reported behavior: Live issue data shows the report is about a root-owned systemd user unit under /root/.config/systemd/user/openclaw-gateway.service, explicit /run/user/0/bus management working, and OpenClaw reporting service.loaded=false/runtime.status=stopped while RPC succeeds.
    • Current source fixes root user-manager scope selection: Current main now detects the root user-manager environment and sets machineUser to null, so stale non-root sudo context no longer redirects root /run/user/0/bus operations away from bare systemctl --user. (src/daemon/systemd.ts:680, d4833e27c775)
    • Fix covers install/doctor/update activation path: The systemd activation helper uses execSystemctlUser for daemon-reload, enable, and restart, so the root scope fix applies to the reported install/doctor refresh failure path. (src/daemon/systemd.ts:1068, d4833e27c775)
    • Fix covers status loaded/runtime reads: isSystemdServiceEnabled and readSystemdServiceRuntime use the same execSystemctlUser path for user-scope units, so status loaded/runtime detection now shares the fixed root scope routing. (src/daemon/systemd.ts:1233, d4833e27c775)
    • Regression coverage: Current tests assert that stale SUDO_USER plus HOME=/root, XDG_RUNTIME_DIR=/run/user/0, and root DBus keeps direct --user status/restart behavior. (src/daemon/systemd.test.ts:337, d4833e27c775)

    Likely related people:

    • vincentkoc: Authored the merged root stale-sudo scope fix in PR 93693 and earlier merged systemd status/sudo-scope work on the same daemon path. (role: recent area contributor and fix author; confidence: high; commits: 64785823d093, 56ca4e2269df, 556a74d25914; files: src/daemon/systemd.ts, src/daemon/systemd.test.ts, src/commands/status.service-summary.ts)
    • HemantSudarshan: Authored the open PR that targets the separate stale systemd failed-state status mismatch still tracked by the canonical adjacent issue. (role: adjacent open repair author; confidence: medium; commits: 705723b9d0e1; files: src/daemon/systemd.ts, src/daemon/systemd.test.ts)
    • Peter Steinberger: Recent history includes gateway startup/status environment recovery work that affects stripped-shell service detection context. (role: adjacent owner; confidence: medium; commits: 03a7b19228ed; files: src/daemon/systemd.ts, src/cli/daemon-cli/status.gather.ts)
    • Yuval Dinodia: Authored merged Linux system-scope systemd gateway unit detection on the same daemon lifecycle surface. (role: recent adjacent contributor; confidence: medium; commits: b988e2f92b0c; files: 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.

  2. added
    P2Normal backlog priority with limited blast radius.
    impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    on Jun 4, 2026
  3. added
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    on Jun 15, 2026
  4. locked as resolved and limited conversation to collaborators on Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions