Unit Files
Cheat sheet · https://pcornel.dk/topic.php?topic=2722
Answer
A unit file is an INI-style file describing a unit: [Unit] (description, dependencies), a type section such as [Service] (ExecStart, User, Restart) and [Install] (which target enables it).
Remember
Do not edit package files in /usr/lib/systemd/system — create a drop-in with systemctl edit <unit> or a full copy in /etc/systemd/system. Run systemctl daemon-reload after changing files. To clear a list setting such as ExecStart in a drop-in, set it empty first.
First checks
systemctl 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
Commands
systemctl enablesystemctl statussystemctl edit <unit>systemctl edit --full <unit>systemctl edit
Verify in this order
unit file and drop-ins read → merged → daemon-reload loads them → next start uses them
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=2722