#Gateway service PATH is not set
1 messages · Page 1 of 1 (latest)
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
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:
- Don’t assume
/usr/bin/openclawexists
- On most installs it’s
/usr/local/bin/openclaw(or in an npm prefix / version manager dir). - Check on the box:
command -v openclawhead -1 "$(command -v openclaw)"(often#!/usr/bin/env node→ needsnodeon PATH)
- 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.
- Best fix: let OpenClaw generate/audit the unit
openclaw gateway install(writes the recommended systemd user unit)openclaw doctor(audits + can repair/migrate)
Docs: https://docs.openclaw.ai/gateway#supervision-systemd-user-unit
- If you really want a system unit, add an explicit PATH + correct ExecStart path
Example patch (adapt paths tocommand -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-pagerjournalctl -u openclaw-gateway.service -n 200 --no-pager