Linux systemd Doctor
Troubleshoot and fix broken systemd services.
Quick Diagnosis
# Check service status
systemctl status SERVICE --no-pager -l
# View full journal
journalctl -u SERVICE -n 100 --no-pager
# Follow live logs
journalctl -u SERVICE -f
Common Fixes
Service won't start
- Check syntax
systemctl cat SERVICE - View full error
journalctl -u SERVICE -n 50 --no-pager -x - Test the ExecStart command directly
- Check ExecStartPre failures
- Verify file permissions on all referenced paths
Service keeps restarting (Restart=always loop)
# Stop the restart loop
systemctl stop SERVICE
# Check the actual error
journalctl -u SERVICE -n 200 --no-pager
# Temporary fix: set Restart=no to debug
systemctl edit SERVICE
# Add:
# [Service]
# Restart=no
Service File Reference
| Directive | Purpose |
|---|---|
| ExecStart | Main command |
| ExecStartPre | Pre-start checks |
| ExecReload | Reload command |
| Restart=on-failure | Auto-restart strategy |
| RestartSec=5 | Wait time between restarts |
| StartLimitIntervalSec=60 | Rate limiting |
| User= | Unprivileged user |
| WorkingDirectory= | CWD for service |
| Environment= | Env variables |
| LimitNOFILE= | File descriptor limit |
Port Conflict Check
# Check if service port is occupied
systemctl cat SERVICE | grep -i port
ss -tlnp | grep ":<PORT> "
📢 Need Help?
Need OpenClaw deployed on your server? I offer managed deployment & hosting:
- 📧 laolaoqi@hotmail.com
- 🏯 颐和园 OpenClaw 运维