systemd for Mere Mortals
systemd is the program that starts your Linux system and minds everything running on it: services, timers, mounts, logs. It's PID 1 — the first process the kernel starts, and the parent of all others. This guide explains the parts a mortal actually touches: writing a service, keeping it alive, reading its logs, scheduling with timers, and figuring out why one won't start.
This guide assumes you use a terminal on a Linux machine and have edited a config file before. Everything systemd-specific — units, journals, targets — is explained from zero.
What this guide covers
- What systemd is — PID 1,
units, and the one program underneath
systemctl - Unit files — the anatomy:
[Unit],[Service],[Install] - Everyday systemctl — start, stop, enable, status: the verbs and what they really do
- Your first service — a script becomes a service, end to end
- Logs with journalctl — where the output goes and how to read it back
- Restarts and failures — service types, restart policies, and the crash loop
- Dependencies and targets — ordering vs. requiring, and what "booted" means
- Timers — cron's replacement: schedules as units
- Transient and user services —
systemd-run, and services that don't need root - Hardening services — the sandboxing options, with a before/after security score
- Troubleshooting — symptom → fix, with the real status codes and messages
- Glossary — the terms, collected in one place
What it doesn't cover
Writing C against systemd APIs, containers under systemd (nspawn, quadlet), socket activation in depth, and the decades-old init wars — why systemd won is history; how to use it is this guide.
How to use this guide
Every unit, command, and failure in this guide was run
for real on systemd 255 (Ubuntu 24.04): a demo service
was started, killed, restarted by its policy, and stopped;
a crash-looping service was watched until systemd gave up
on it; a timer fired on schedule; and a sandboxed
service's blocked writes were verified in its journal.
Per-user services (systemctl --user) couldn't run in
the test environment (no user manager session), so that
section is marked (documented).
Part of the series
This guide is one of the For Mere Mortals guides: plain-language guides to the tools programmers and makers use.
Related guides:
License
The writing in this guide is licensed under CC BY 4.0. Code examples and lab scripts are licensed under the MIT License.