Process ignores SIGTERM — cannot be gracefully stopped
systemctl stop <service> hangs for the full timeout
Focused incident mode — strips away everything but this runbook.
Symptoms
- systemctl stop <service> hangs for the full timeout
- kill -TERM <PID> has no effect; process keeps running
- Service restart cycles take too long due to shutdown timeout
Always try SIGTERM before SIGKILL. If the application ignores SIGTERM, that is a code bug to be fixed, not a reason to use SIGKILL routinely.
Evidence to grab
Collect these artifacts before you change anything — they prove (or rule out) each cause.
Process signal handling
cat /proc/<PID>/status | grep SigProcess open file descriptors
ls /proc/<PID>/fd | wc -l
Diagnostic flow
Run the steps in order, marking each claim confirmed or refuted. The evidence you gather feeds the ranked causes below.
Guided decision tree is ready.
Steps with commands, expected output, and pass/fail branches.
Ranked root causes
Evidence checklist
- SigIgn shows bit 15 (SIGTERM) is set
- kill -TERM has no visible effect
Confirm before fixing
cat /proc/<PID>/status | grep SigIgnCheck the signal ignore mask
Fix
kill -TERM <PID>; sleep 5; kill -0 <PID> 2>/dev/null && kill -9 <PID>Try TERM first, then escalate to SIGKILL after timeout
Resolution runbook
Apply from top to bottom after the cause is confirmed. Review every command before running it — risk tags are shown on each.
kill -TERM <PID>Attempt graceful shutdown first
cat /proc/<PID>/status | grep SigCheck if SIGTERM is being ignored
sleep 10 && kill -0 <PID> 2>/dev/null && kill -9 <PID>Escalate to SIGKILL if SIGTERM has no effect
Prevention
- Ensure all services handle SIGTERM and perform graceful shutdown (close DB connections, drain queues).
- Set TimeoutStopSec in systemd unit files so systemctl stop does not hang indefinitely.
- Test graceful shutdown as part of deployment smoke tests.
- Use docker stop with a timeout for containerized applications.
Related runbooks
Same stack, same failure family — worth a skim.
Commands marked READ CHANGE DESTRUCTIVE — never run DESTRUCTIVE commands against production data you cannot restore. Copy → verify → execute.