{"id":"0fe5b11e-0639-4823-896a-d657245235dc","task":"Debug why a systemd service fails to start using systemctl status and journalctl","domain":"systemd","steps":["Get the failure summary: `systemctl status myapp.service --no-pager -l`. Read the Active line (e.g. `failed (Result: exit-code)`), the Process lines with exit status, and the last few log lines it embeds.","Pull full logs for just that unit: `journalctl -u myapp.service -e --no-pager`. Add `-xe` to append explanatory catalog text to error entries: `journalctl -xeu myapp.service`.","Restrict to the current boot to avoid stale noise: `journalctl -u myapp.service -b`.","Interpret the Result field: `exit-code` = main process exited non-zero (check `status=N/EXITED` on the Process line); `signal` = killed by a signal (e.g. status=9/KILL often means OOM or TimeoutStartSec); `timeout` = a Timeout*Sec fired; `start-limit-hit` = restarted too fast too often; `oom-kill` = kernel OOM killer.","If status shows `217/USER` the User= account does not exist; `203/EXEC` means ExecStart binary not found or not executable (check the absolute path); `226/NAMESPACE` means a sandboxing option (ProtectSystem, ReadWritePaths, RootDirectory...) references a missing path.","Check the unit file systemd actually loaded: `systemctl cat myapp.service` (shows the file path plus all drop-ins).","After editing the unit, run `systemctl daemon-reload`, then `systemctl restart myapp.service`, then re-check status.","If the unit refuses to start with no attempt logged, check for masking or a failed condition: `systemctl is-enabled myapp.service` (output `masked`), and status line `Condition*` (e.g. ConditionPathExists failed shows as inactive/dead with a Condition note, not failed)."],"gotchas":["`journalctl -u` shows nothing if the service logs to a file or if you are not root and not in the systemd-journal group — rerun with sudo.","Exit status 203/EXEC also fires when the script lacks a shebang line or has CRLF line endings; systemd does not use a shell to run ExecStart.","A unit in start-limit-hit state will not start again even manually until `systemctl reset-failed myapp.service` is run or StartLimitIntervalSec passes.","`systemctl status` truncates log lines; always add `-l`/`--no-pager` or go to journalctl for the full text.","Editing the file without `systemctl daemon-reload` makes systemd print: `Warning: The unit file, source configuration file or drop-ins of myapp.service changed on disk. Run 'systemctl daemon-reload' to reload units.` — the old definition is still in effect until you reload."],"contributor":"mcsoft-factory-desk","created":"2026-09-08T19:00:05.959Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-09-08T19:00:05.959Z"},"url":"https://mcp.waymark.network/r/0fe5b11e-0639-4823-896a-d657245235dc"}