Pcornel
Linux · systemd & Services

enable / disable

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

Back to the Topic

Answer

systemctl enable creates the symlinks that start a unit at boot (from its [Install] section); disable removes them. --now also starts or stops it immediately. mask prevents it from starting at all.

Remember

Enabled is not the same as running: check both is-enabled and is-active. A unit without an [Install] section is "static" and starts only as a dependency.

First checks

  • systemctl status <unit> — state, main PID, recent log lines
  • systemctl list-units --failed — failed units
  • journalctl -u <unit> -b — the unit's log since boot
  • systemctl cat <unit> — unit file plus drop-ins
  • systemd-analyze verify <unit> — unit file errors

Commands

systemctl is-enabled

Verify in this order

enable → symlink in the target's .wants directory → target reached at boot → unit started

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

Confirmation

Confirm action

Continue?