Skip to content

docs(gateway): run Linux system services as the state owner - #136266

Merged
obviyus merged 3 commits into
openclaw:mainfrom
yetval:docs/systemd-unit-examples
Sep 9, 2026
Merged

obviyus merged 3 commits into
openclaw:mainfrom
yetval:docs/systemd-unit-examples

Conversation

@yetval

@yetval yetval commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Related: #123872

What Problem This Solves

Operators following the Linux system-service example could omit User= and run the Gateway under the root account instead of the account that owns its state and configuration.

Why This Change Was Made

The system-service instructions now require the state-owning non-root account before enabling the unit. They explain systemd's primary-group and default home behavior, preserve the explicit state/configuration path controls, and warn against using root's home as a workaround.

Both unit examples retain the current managed fields, including TimeoutStopSec=330, OOMPolicy=continue, and KillMode=mixed. The added explanation connects the stop allowance to the five-minute cooperative drain and teardown reserve. Existing Doctor ownership, user-unit lingering, and profile naming guidance remain intact.

User Impact

Operators can configure the service account and locate the intended state before starting the Gateway. The examples explain the existing shutdown allowance without changing service behavior.

Evidence

  • Compared both complete unit examples against the pinned current managed-unit generator and its existing tests.
  • Checked account, group, home, restart-status, and lingering statements against the installed systemd 257.13 manuals and current configuration-path/start-guard source.
  • Targeted formatting, MDX checks for both changed pages, and git diff --check passed.
  • Fresh documentation review uses the complete source and manual evidence. Hosted documentation checks and the final exact-head review gate are required before landing.

Only two documentation pages change. No Gateway, service, configuration, shutdown, or runtime behavior is modified or operated by this repair. The original contributor commits are preserved.

@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime app: linux plugin: linux-node size: XS labels Sep 2, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 2, 2026
@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 9, 2026, 12:53 AM ET / 04:53 UTC (Revision 4).

ClawSweeper review

What this changes

Clarifies that Linux system services should run as the non-root account owning OpenClaw state and explains the existing 330-second shutdown allowance.

Merge readiness

✅ Ready for maintainer review

Keep open: the service-account clarification remains useful and is absent from current main and the latest release. No actionable patch defects remain; the earlier group/home concern is resolved. The protected security label also precludes automated closure.

Priority: P2
Reviewed head: 5752abb08acb620f19dd9abcef0c5f6e3052b75c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-supported documentation improvement with the prior actionable concern resolved and no remaining correctness finding.
Proof confidence 🌊 off-meta tidepool Not applicable: Real behavior proof is not required because this PR only changes files under docs/.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required because this PR only changes files under docs/.
Evidence reviewed 9 items Verified documentation-only scope: The merge-base-to-head diff contains only the account guidance and timeout explanations in the two documentation pages. The supplied verified test merge likewise changes only those pages; unrelated endpoint drift is not PR-introduced work.
Current main still lacks account selection: Current main tells operators to reuse the user-unit body as a system service without adding User=. The PR therefore supplies a distinct, still-needed clarification.
Latest release comparison: The v2026.9.3 runbook already includes TimeoutStopSec=330, but its system-service instructions still omit explicit account selection.
Findings None None.
Security None None.

How this fits together

Linux systemd starts and supervises the Gateway under a selected operating-system account. That account’s home and explicit environment overrides determine which OpenClaw configuration and state the Gateway reads.

flowchart LR
  A[Operator writes service unit] --> B[Select state-owning account]
  B --> C[systemd starts Gateway]
  D[Home and path overrides] --> C
  C --> E[Read configuration and state]
  C --> F[Drain work before shutdown]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Docs +24. Total +24 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 2 30 6 +24
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 30 6 +24

Review metrics

None.

Technical review

Best possible solution:

Keep service-account selection explicit before activation while retaining systemd-derived home/group defaults and the existing managed shutdown settings.

Do we have a high-confidence way to reproduce the issue?

Not applicable to this documentation-only patch; source and systemd manuals substantiate the account-selection and timeout statements without executing a service.

Is this the best way to solve the issue?

Yes. Adding User= guidance at the system-service setup step addresses the omission without introducing runtime changes or hardcoded group/home assumptions.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 9636ae49e001.

Labels

Label justifications:

  • P2: This bounded documentation correction helps custom Linux service operators avoid unintentionally running the Gateway as root.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Real behavior proof is not required because this PR only changes files under docs/.

Evidence

What I checked:

  • Verified documentation-only scope: The merge-base-to-head diff contains only the account guidance and timeout explanations in the two documentation pages. The supplied verified test merge likewise changes only those pages; unrelated endpoint drift is not PR-introduced work. Public docs: docs/gateway/index.md. (docs/gateway/index.md:294, 5752abb08acb)
  • Current main still lacks account selection: Current main tells operators to reuse the user-unit body as a system service without adding User=. The PR therefore supplies a distinct, still-needed clarification. Public docs: docs/gateway/index.md. (docs/gateway/index.md, 9636ae49e001)
  • Latest release comparison: The v2026.9.3 runbook already includes TimeoutStopSec=330, but its system-service instructions still omit explicit account selection. Public docs: docs/gateway/index.md. (docs/gateway/index.md, 1391f7cd2d40)
  • Managed-unit contract: Current main generates TimeoutStopSec=330, OOMPolicy=continue, and KillMode=mixed. Its own comment describes the five-minute drain plus teardown reserve, matching the added documentation. (src/daemon/systemd-unit.ts:85, 9636ae49e001)
  • State and configuration lookup: The home resolver uses HOME unless OPENCLAW_HOME overrides it; canonical configuration lookup honors OPENCLAW_CONFIG_PATH and otherwise resolves within the state directory. The proposed wording preserves these existing controls. (src/config/paths.ts:222, 5752abb08acb)
  • systemd account and home semantics: The installed systemd.exec manual states that system services default to root, omitted Group= uses the selected user's default group, and User= supplies HOME by default through SetLoginEnvironment. This supports the revised wording without assuming a /home/<user> directory. The inspected manual is /usr/share/man/man5/systemd.exec.5.gz; its source repository identity was not independently established.

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • obviyus: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-09-02T11:18:05.659Z sha 8e3fec813d9d985ee5b3802eb3354159e6a6050c :: needs changes before merge. :: [P2] Do not assume the service account’s group or home
  • reviewed 2026-09-02T11:57:39.536Z sha ddf4232f43c281a66de47e872735a35dc01d4a75 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-02T12:13:28.154Z sha e606747 :: needs maintainer review before merge. :: none

@yetval

yetval commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@yetval
yetval force-pushed the docs/systemd-unit-examples branch from 30aed1f to ddf4232 Compare September 2, 2026 11:47
@yetval

yetval commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 2, 2026
The "Linux (system service)" tab told operators to reuse the user-unit body
under /etc/systemd/system without User=, Group=, or HOME. Such a unit runs as
root with no home, so the Gateway looks for its config under /root/.openclaw,
exits with code 78 (Missing config), and RestartPreventExitStatus=78 keeps it
stopped. The tab now adds the owning account to [Service], says the Gateway
must not run as root, and points at loginctl enable-linger plus the user unit
as the supported boot-without-login path.

Both hand-written unit examples also carried TimeoutStopSec=30 while the
managed unit renders 330 so systemd does not SIGKILL the five-minute stop and
restart drain. Both examples now use 330 with a one-line reason.

Related: openclaw#123872
Drop the Group= and Environment=HOME= lines from the system-service snippet;
systemd supplies the primary group and home directory from User=, and an
explicit /home/<user> value would override accounts whose home lives elsewhere.
@yetval
yetval force-pushed the docs/systemd-unit-examples branch from ddf4232 to e606747 Compare September 2, 2026 12:03
@obviyus obviyus self-assigned this Sep 9, 2026
@obviyus
obviyus requested review from a team as code owners September 9, 2026 04:45
@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Sep 9, 2026
@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord channel: imessage Channel integration: imessage channel: line Channel integration: line labels Sep 9, 2026
@obviyus

obviyus commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Thanks @yetval!

The Linux system-service instructions now require the non-root state owner before activation, explain the default group and home behavior, and retain the supported state/configuration overrides. Both examples preserve the current 330-second stop allowance and managed-unit fields, with the drain and teardown reserve explained.

Validation: complete source/systemd-manual review, formatting and MDX checks for both pages, green hosted CI, and clean final exact-head review. No runtime or service behavior changed.

The stale server comparison was restored with one same-base refresh at the unchanged signed head. Dependency Guard then passed against the actual two-file documentation contribution; no dependency approval or policy override was used.

Merged as 7012d031c5410b21e96bf14f4d3e527c1e2b7331, preserving both contributor commits and credit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android app: ios App: ios app: linux app: macos App: macos app: wearos App: wearos app: web-ui App: web-ui channel: a2a channel: buzz channel: discord Channel integration: discord channel: feishu Channel integration: feishu channel: imessage Channel integration: imessage channel: irc channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: qa-channel Channel integration: qa-channel channel: reef Channel integration: reef channel: signal Channel integration: signal channel: slack Channel integration: slack channel: synology-chat channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web docker Docker and sandbox tooling docs Improvements or additions to documentation extensions: acpx extensions: active-memory extensions: admin-http-rpc extensions: alibaba extensions: amazon-bedrock extensions: amazon-bedrock-mantle extensions: anthropic extensions: anthropic-vertex extensions: arcee extensions: baseten Extension: baseten extensions: brave extensions: browser extensions: byteplus extensions: canvas extensions: cerebras extensions: chutes extensions: clawrouter Extension: clawrouter extensions: clickclack extensions: cloudflare-ai-gateway extensions: codex extensions: cohere extensions: comfy extensions: copilot extensions: copilot-proxy Extension: copilot-proxy extensions: crabbox extensions: deepgram extensions: deepinfra extensions: deepseek extensions: device-pair extensions: diagnostics-otel Extension: diagnostics-otel extensions: document-extract extensions: exa extensions: fireworks extensions: fish-audio Extension: fish-audio extensions: groq extensions: meta Extension: meta extensions: microsoft-foundry extensions: onepassword 1Password plugin extensions: policy extensions: qa-lab extensions: qwen extensions: runway extensions: searxng extensions: tts-local-cli extensions: vault Extension: vault extensions: voyage extensions: vydra extensions: web-readability fleet gateway Gateway runtime P2 Normal backlog priority with limited blast radius. plugin: azure-speech Azure Speech plugin plugin: beam Beam session sharing plugin plugin: bonjour Plugin integration: bonjour plugin: cua-computer plugin: file-transfer plugin: geolocation Geolocation plugin (IP to coarse city) plugin: google-meet plugin: linux-node plugin: logbook Logbook automatic work journal plugin plugin: team-reports plugin: teams-meetings Teams Meetings plugin plugin: workboard plugin: zoom Zoom plugin rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. security Security documentation size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants