Pcornel
Linux

systemd & Services

Cheat sheet · https://pcornel.dk/topic.php?topic=355

Back to the Topic

Answer

systemd starts, supervises and stops the services on a Linux system. Each service is a unit, controlled with systemctl, and its output goes to the journal.

Remember

Running now and starting at boot are separate: start versus enable. "Active (running)" means the process exists, not that the application answers. After editing a unit file: systemctl daemon-reload, then restart.

First checks

  • systemctl status <unit> — loaded, enabled, active or failed, since when, last log lines.
  • systemctl --failed — every unit that failed.
  • journalctl -u <unit> -b — the unit's log since boot.
  • systemctl is-enabled <unit> — will it start at boot?
  • systemctl cat <unit> — the unit file and drop-ins in effect.

Commands

journalctl
Query systemd journal records by unit, boot, time, priority or structured field.
systemctl
Inspect or change systemd unit state, enablement and manager operations.
systemctl --failed
systemctl status <unit>
journalctl -u <unit> -b
show
systemctl cat <unit>
systemctl edit <unit>
systemctl restart <unit>
systemctl is-active <unit>
systemctl is-enabled <unit>
systemctl status
journalctl -u
systemctl start nginx
systemctl stop nginx
systemctl restart nginx

Verify in this order

unit file found and loaded → enabled for boot → dependencies started → process started and stays up → application listening → answers a real request

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=355

Confirmation

Confirm action

Continue?