Interview Prep/Linux/systemd services and journald

A service restarts every few seconds; the journal shows `Main process exited, code=killed, status=9/KILL` but nobody runs kill.

AdvancedTroubleshootingsystemd services and journald
Answer

Likely causes → The cgroup memory limit (MemoryMax=) triggers the OOM killer, systemd-oomd kills it under pressure, or a watchdog (WatchdogSec=) timeout expires.

Diagnose →

journalctl -u myapp -b | grep -Ei 'oom|watchdog'
journalctl -u systemd-oomd -b
systemctl show myapp -p MemoryMax -p WatchdogUSec -p NRestarts
dmesg -T | grep -i oom

Fix → Raise or fix the memory limit; if it's the watchdog, make the app send WATCHDOG=1 in time or increase WatchdogSec=.

Prevent → Alert on NRestarts growth and OOM events per unit.

All Linux questions Roadmap: Linux

More on systemd services and journald