#Gateway service PATH is not set

1 messages · Page 1 of 1 (latest)

gleaming juniperBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

dense crest
#
cat > /etc/systemd/system/openclaw-gateway.service <<'EOF'
[Unit]
Description=OpenClaw Gateway
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
WorkingDirectory=/root/.openclaw
ExecStart=/usr/bin/openclaw gateway --force
Restart=always
RestartSec=2

[Install]
WantedBy=multi-user.target
EOF

# Reload systemd and enable the service
systemctl daemon-reload
systemctl enable --now openclaw-gateway.service

# Check status
systemctl status openclaw-gateway.service
random fableBOT
# dense crest ``` cat > /etc/systemd/system/openclaw-gateway.service <<'EOF' [Unit] Descriptio...

That unit is close, but it’ll still bite you if openclaw (or its node shebang) isn’t resolvable under systemd’s minimal PATH.

Key points:

  1. Don’t assume /usr/bin/openclaw exists
  • On most installs it’s /usr/local/bin/openclaw (or in an npm prefix / version manager dir).
  • Check on the box:
  • command -v openclaw
  • head -1 "$(command -v openclaw)" (often #!/usr/bin/env node → needs node on PATH)
  1. systemd PATH is minimal by design
    OpenClaw docs call this out explicitly (Linux PATH defaults to /usr/local/bin:/usr/bin:/bin):
    https://docs.openclaw.ai/gateway/troubleshooting#service-environment-path--runtime

So if you installed Node via nvm/fnm/volta/asdf (or OpenClaw via a non-system prefix), the service won’t see it.

  1. Best fix: let OpenClaw generate/audit the unit
#
  1. If you really want a system unit, add an explicit PATH + correct ExecStart path
    Example patch (adapt paths to command -v openclaw):
[Service]
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
ExecStart=/usr/local/bin/openclaw gateway --port 18789
WorkingDirectory=/root
Restart=always
RestartSec=5

If it’s still failing, paste:

#
  • systemctl status openclaw-gateway.service --no-pager
  • journalctl -u openclaw-gateway.service -n 200 --no-pager