EMZETT.
Login

systemd and init systems

In short: The init system is the first process after the kernel (PID 1). It starts services and manages them. systemd is the default on almost all major distributions today.

In more detail: In the past there was SysV init with scripts that ran one after another. systemd starts services in parallel and monitors them. It also brings logging, timers and network tools.

In detail

systemctl status ssh          # state
sudo systemctl start nginx    # start
sudo systemctl enable nginx   # start at boot
sudo systemctl restart nginx
journalctl -u nginx -f        # follow the log
systemctl list-units --failed # failed services
systemd-analyze blame         # what boots slowly?
  • Unit files: /etc/systemd/system/*.service, also .timer (replacement for cron), .socket, .mount, .target.
  • Targets: multi-user.target (server), graphical.target (desktop), rescue.target.
  • Alternatives: OpenRC (Alpine, Gentoo), runit (Void), s6, dinit.
  • Criticism: systemd is very extensive and therefore complex; advocates praise the uniformity.
  • Journal: binary logs, readable via journalctl.

See also: The Linux kernel at a glance, Display manager and login screen