Systemd shutdown stuck — unit hangs during shutdown/reboot
Shutdown or reboot hangs for minutes before eventually completing
Focused incident mode — strips away everything but this runbook.
Symptoms
- Shutdown or reboot hangs for minutes before eventually completing
- systemctl list-jobs shows a blocked job during shutdown
- A service takes the full DefaultTimeoutStopSec before being killed
A slow shutdown is usually a slow service, not a systemd bug. Find the specific service blocking the sequence and fix its shutdown behavior.
Evidence to grab
Collect these artifacts before you change anything — they prove (or rule out) each cause.
Pending systemd jobs
systemctl list-jobsJournal shutdown messages
journalctl -b -1 -p err --no-pager | tail -30
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
- journalctl shows systemd waiting for the full TimeoutStopSec
- The service does not respond to SIGTERM
Confirm before fixing
systemctl show <service> | grep -E 'TimeoutStopSec|ExecStop'Check the stop timeout and ExecStop command
Fix
systemctl edit <service> --forceOverride TimeoutStopSec to a shorter value and add a proper ExecStop
Resolution runbook
Apply from top to bottom after the cause is confirmed. Review every command before running it — risk tags are shown on each.
systemctl list-jobsFind the job blocking shutdown
journalctl -b -1 --no-pager | grep -i 'stop\|timeout' | tail -20Read shutdown logs to find the slow service
systemctl edit <service> --forceOverride the slow service's TimeoutStopSec
shutdown -r nowReboot again after fixing the timeout
Prevention
- Set TimeoutStopSec= in every service unit file to a reasonable value (15-30s).
- Test service shutdown behavior with systemctl stop <service> during maintenance.
- Use soft NFS mount options (soft,timeo=30) to prevent mount hangs during shutdown.
- Use systemd-analyze plot to visualize the shutdown dependency chain.
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.