openclaw - ✅(Solved) Fix [Bug]: openclaw node install fails with 'Unit file openclaw-gateway.service does not exist' on node-only VMs [2 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#68287Fetched 2026-04-18 05:53:18
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
cross-referenced ×2referenced ×2

Error Message

Node install failed: Error: systemctl enable failed: Failed to enable unit: Unit file openclaw-gateway.service does not exist.

Root Cause

In src/daemon/systemd.ts, activateSystemdService and uninstallSystemdService both call resolveGatewaySystemdServiceName (which always returns openclaw-gateway) instead of resolveSystemdServiceName (which honours the OPENCLAW_SYSTEMD_UNIT env override set by node-service.ts to openclaw-node).

So even though the unit file is written to the correct path (openclaw-node.service), the subsequent systemctl enable tries to enable openclaw-gateway.service which doesn't exist on a node-only machine.

Fix Action

Fix

Two-line change in src/daemon/systemd.ts:

  • activateSystemdService: use resolveSystemdServiceName(params.env) instead of resolveGatewaySystemdServiceName(params.env.OPENCLAW_PROFILE)
  • uninstallSystemdService: same substitution

PR: #68241

PR fix notes

PR #68288: fix(systemd): use resolveSystemdServiceName in activate/uninstall

Description (problem / solution / changelog)

Fixes #68287

Problem

openclaw node install fails on node-only VMs with:

Node install failed: Error: systemctl enable failed:
Failed to enable unit: Unit file openclaw-gateway.service does not exist.

Root cause

activateSystemdService and uninstallSystemdService both called resolveGatewaySystemdServiceName(), which hardcodes openclaw-gateway regardless of the service being installed. The write step correctly uses resolveSystemdServiceName() (which honours OPENCLAW_SYSTEMD_UNIT), but the activate/uninstall steps didn't — so on a node-only machine they'd try to enable/disable openclaw-gateway.service which doesn't exist.

Fix

Two-line change: replace resolveGatewaySystemdServiceName(env.OPENCLAW_PROFILE) with resolveSystemdServiceName(env) in both activateSystemdService and uninstallSystemdService. No behaviour change for gateway installs (the override is absent so it falls through to the gateway name).

Why CI didn't catch it

Integration test containers use a stub systemctl that accepts every verb/unit and returns 0, masking the mismatch.

Changed files

  • src/cli/program/register.onboard.ts (modified, +2/-0)
  • src/commands/daemon-install-helpers.ts (modified, +29/-0)
  • src/commands/onboard-non-interactive/local/daemon-install.ts (modified, +7/-2)
  • src/commands/onboard-types.ts (modified, +1/-0)
  • src/daemon/systemd.ts (modified, +2/-2)
  • src/wizard/setup.finalize.ts (modified, +8/-1)

PR #68293: fix(systemd): use resolveSystemdServiceName in activate/uninstall

Description (problem / solution / changelog)

Fixes #68287

Problem

openclaw node install fails on node-only VMs with:

Node install failed: Error: systemctl enable failed:
Failed to enable unit: Unit file openclaw-gateway.service does not exist.

Root cause

activateSystemdService and uninstallSystemdService both called resolveGatewaySystemdServiceName(), which hardcodes openclaw-gateway regardless of the service being installed. The write step correctly uses resolveSystemdServiceName() (which honours OPENCLAW_SYSTEMD_UNIT), but the activate/uninstall steps didn't — so on a node-only machine they'd try to enable/disable openclaw-gateway.service which doesn't exist.

Fix

Two-line change: replace resolveGatewaySystemdServiceName(env.OPENCLAW_PROFILE) with resolveSystemdServiceName(env) in both activateSystemdService and uninstallSystemdService. No behaviour change for gateway installs (the override is absent so it falls through to the gateway name).

Why CI didn't catch it

Integration test containers use a stub systemctl that accepts every verb/unit and returns 0, masking the mismatch.

Changed files

  • src/daemon/systemd.test.ts (modified, +165/-0)
  • src/daemon/systemd.ts (modified, +2/-2)

Code Example

openclaw node install --host <gw> --port 18789 --runtime node --force

---

Node install failed: Error: systemctl enable failed: Failed to enable unit:
Unit file openclaw-gateway.service does not exist.
RAW_BUFFERClick to expand / collapse

Symptom

On a freshly provisioned node VM (no gateway service installed), running:

openclaw node install --host <gw> --port 18789 --runtime node --force

fails with:

Node install failed: Error: systemctl enable failed: Failed to enable unit:
Unit file openclaw-gateway.service does not exist.

The install is transactional, so the unit file written (~/.config/systemd/user/openclaw-node.service) and ~/.openclaw/node.json are rolled back. Re-running produces the same error.

Root cause

In src/daemon/systemd.ts, activateSystemdService and uninstallSystemdService both call resolveGatewaySystemdServiceName (which always returns openclaw-gateway) instead of resolveSystemdServiceName (which honours the OPENCLAW_SYSTEMD_UNIT env override set by node-service.ts to openclaw-node).

So even though the unit file is written to the correct path (openclaw-node.service), the subsequent systemctl enable tries to enable openclaw-gateway.service which doesn't exist on a node-only machine.

Why CI doesn't catch this

Integration test containers use a stub systemctl that returns 0 for all verbs/units, masking the bug.

Fix

Two-line change in src/daemon/systemd.ts:

  • activateSystemdService: use resolveSystemdServiceName(params.env) instead of resolveGatewaySystemdServiceName(params.env.OPENCLAW_PROFILE)
  • uninstallSystemdService: same substitution

PR: #68241

extent analysis

TL;DR

The most likely fix is to update the activateSystemdService and uninstallSystemdService functions in src/daemon/systemd.ts to use resolveSystemdServiceName instead of resolveGatewaySystemdServiceName.

Guidance

  • Verify that the OPENCLAW_SYSTEMD_UNIT environment variable is set to openclaw-node in node-service.ts to ensure the correct systemd service name is used.
  • Update the activateSystemdService and uninstallSystemdService functions as described in the fix to use the correct systemd service name.
  • Test the changes by running the openclaw node install command again to ensure the error is resolved.
  • Consider updating the integration tests to use a non-stub systemctl to catch similar bugs in the future.

Example

// src/daemon/systemd.ts
activateSystemdService(params) {
  const serviceName = resolveSystemdServiceName(params.env);
  // ...
}

uninstallSystemdService(params) {
  const serviceName = resolveSystemdServiceName(params.env);
  // ...
}

Notes

This fix assumes that the resolveSystemdServiceName function correctly returns the openclaw-node service name when the OPENCLAW_SYSTEMD_UNIT environment variable is set.

Recommendation

Apply the workaround by updating the activateSystemdService and uninstallSystemdService functions as described, and consider submitting a PR with the fix (e.g., #68241).

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING