What systemd is and how it works
systemd is the Linux init system and service manager: the first process (PID 1), which brings the system up at boot, starts services and supervises them until shutdown. Everything it manages is described by units: services, sockets, timers and mount points.
You work with systemd whenever you start a service, read the journal or schedule a task. Services are described not by scripts but by short unit files, and systemd itself takes care of processes, restarts and start-up order. systemd runs only on Linux.
At boot the kernel hands control to systemd, which activates default.target along with all its dependencies. Units with no ordering between them start in parallel. systemd puts the processes of each service into a separate control group (cgroup) named after the unit, so it knows every process of the service, even those that have gone into the background. The output of services is collected by systemd-journald, and the manager is controlled with systemctl.
backup.timer has no processes of its own: it starts the service backup.service.What systemd consists of
| Component | What it does |
|---|---|
systemd (PID 1) | Starts and stops units according to their dependencies and supervises service processes |
systemctl | Controls the manager: starting and stopping units, enabling at boot, status, reloading |
systemd-journald, journalctl | journald collects the journal: service output, kernel messages and syslog; journalctl reads it |
systemd-logind | Tracks user logins and sessions and creates slices for them under user.slice |
systemd-resolved | Resolves names for local programs and caches DNS answers; the DNS stub listener is on 127.0.0.53 |
System manager and user manager
The system manager is PID 1, and it runs as root. For each logged-in user, systemd starts a separate unprivileged instance: the user manager, systemd --user, in the service user@UID.service. It has its own units and its own default.target, and the commands are the same with the --user flag: systemctl --user status.
What to know first
- Processes, signals, users and permissions in Linux: see the Linux reference.
- Environment variables and quoting in commands: see the Bash reference.
Section sources
the section is written from these pages- systemdfreedesktop.org/software/systemd/man/262/systemd.html(opens in a new tab)
- systemd.specialfreedesktop.org/software/systemd/man/262/systemd.special.html(opens in a new tab)
- systemd-journald.servicefreedesktop.org/software/systemd/man/262/systemd-journald.service.html(opens in a new tab)
- systemd-logind.servicefreedesktop.org/software/systemd/man/262/systemd-logind.service.html(opens in a new tab)
- systemd-resolved.servicefreedesktop.org/software/systemd/man/262/systemd-resolved.service.html(opens in a new tab)