Service Dependencies
Cheat sheet · https://pcornel.dk/topic.php?topic=2721
Answer
Service dependencies tell systemd what must also start (Wants=, Requires=) and in which order (After=, Before=). They are separate: Requires= without After= starts both at the same time.
Remember
Use After=network-online.target plus Wants=network-online.target for services that need a configured network. Use RequiresMountsFor=<path> for data on a mount. Prefer Wants= over Requires= unless the service truly cannot run without the other.
First checks
systemd-analyze critical-chain <unit>— what the unit waited forsystemctl status <unit>— state, main PID, recent log linessystemctl list-units --failed— failed unitsjournalctl -u <unit> -b— the unit's log since bootsystemctl cat <unit>— unit file plus drop-inssystemd-analyze verify <unit>— unit file errors
Verify in this order
unit requested → Wants/Requires add other units → After/Before order them → units start in order
Where it usually breaks
First mismatch in persistent unit/config/generator → dependency/order graph → systemd state → process/cgroup → socket/resource dependency → journal → consumer check; preserve identity/native diagnostic/pre-state before mutation.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2721