openclaw - ✅(Solved) Fix gateway restart should handle non-systemd background gateway processes [1 pull requests, 2 comments, 2 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#72223Fetched 2026-04-27 05:33:04
View on GitHub
Comments
2
Participants
2
Timeline
4
Reactions
0
Timeline (top)
commented ×2closed ×1cross-referenced ×1

openclaw gateway restart fails in Linux environments where the gateway is already running in the background under a non-systemd supervisor.

Root Cause

openclaw gateway restart fails in Linux environments where the gateway is already running in the background under a non-systemd supervisor.

Fix Action

Fixed

PR fix notes

PR #72224: fix gateway restart outside systemd

Description (problem / solution / changelog)

Closes #72223

Summary

  • detect Linux background gateway listeners via native /proc inspection before falling back to lsof and ss
  • treat bare openclaw-gateway process titles as verified gateway processes for unmanaged restart signaling
  • reuse resolved gateway probe auth during unmanaged restart health checks so auth-protected gateways can report healthy after SIGUSR1 restarts

Testing

  • pnpm test src/cli/daemon-cli/lifecycle.test.ts src/cli/daemon-cli/restart-health.test.ts
  • pnpm test src/infra/gateway-process-argv.test.ts src/infra/gateway-processes.test.ts src/infra/restart-stale-pids.test.ts src/infra/restart.test.ts
  • pnpm build
  • verified locally in a non-systemd container: node openclaw.mjs gateway restart --json now returns result: "restarted" while the gateway is running in the background

Changed files

  • src/cli/daemon-cli/lifecycle.test.ts (modified, +33/-0)
  • src/cli/daemon-cli/lifecycle.ts (modified, +35/-6)
  • src/cli/daemon-cli/restart-health.test.ts (modified, +38/-0)
  • src/cli/daemon-cli/restart-health.ts (modified, +13/-6)
  • src/cli/daemon-cli/status.gather.ts (modified, +29/-13)
  • src/infra/gateway-process-argv.test.ts (modified, +6/-0)
  • src/infra/gateway-process-argv.ts (modified, +10/-6)
  • src/infra/gateway-processes.test.ts (modified, +15/-0)
  • src/infra/restart-stale-pids.test.ts (modified, +122/-13)
  • src/infra/restart-stale-pids.ts (modified, +212/-15)
  • src/infra/restart.test.ts (modified, +36/-0)
RAW_BUFFERClick to expand / collapse

Summary

openclaw gateway restart fails in Linux environments where the gateway is already running in the background under a non-systemd supervisor.

Reproduction

  • Run OpenClaw inside a container or supervisor-managed environment without usable systemctl --user
  • Start the gateway in the background so openclaw-gateway is listening on the configured port
  • Run openclaw gateway restart

Actual

Restart falls back to not-loaded / disabled service behavior, even though a verified background gateway process is already running.

Expected

When systemd user services are unavailable, restart should still succeed if OpenClaw can verify a background gateway listener on the configured port.

Notes

Two detection gaps showed up in practice:

  • the running process may appear as a bare openclaw-gateway process title
  • Linux listener discovery should not depend entirely on lsof; /proc and ss fallback paths are needed in containerized environments

extent analysis

TL;DR

The openclaw gateway restart command may fail in Linux environments without systemd user services, but a workaround can be implemented to detect and manage the gateway process.

Guidance

  • Verify if the openclaw-gateway process is running in the background by checking the process list or using tools like pgrep or pkill.
  • Implement a fallback detection mechanism using /proc and ss commands to discover the listener on the configured port, especially in containerized environments.
  • Consider modifying the restart command to check for the presence of the openclaw-gateway process and its listening port before attempting to restart.
  • Review the current detection logic to handle cases where the process title appears as a bare openclaw-gateway process.

Example

No code snippet is provided due to the lack of specific implementation details in the issue.

Notes

The provided guidance is based on the assumption that the issue is related to the detection of the openclaw-gateway process and its listening port. Additional information about the current implementation and detection logic may be necessary to provide a more accurate solution.

Recommendation

Apply a workaround to implement the fallback detection mechanism using /proc and ss commands, as the issue is likely related to the reliance on lsof and systemd user services.

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