Basic systemd
concepts
1 Environment #
This document applies to the following products and product versions:
SUSE Linux Enterprise Server 15 SP3, 15 SP2, 15 SP1, 15 GA, 12 SP5, 12 SP4, 12 SP3
SUSE Linux Enterprise Server for SAP Applications 15 SP3, 15 SP2, 15 SP1, 15 GA, 12 SP5, 12 SP4, 12 SP3
SUSE Linux Enterprise High Availability Extension 15 SP3, 15 SP2, 15 SP1, 15 GA, 12 SP5, 12 SP4, 12 SP3
SUSE Linux Enterprise High Performance Computing 15 SP3, 15 SP2, 15 SP1, 15 GA
SUSE Linux Enterprise Desktop 15 SP3, 15 SP2, 15 SP1, 15 GA, 12 SP5, 12 SP4, 12 SP3
SUSE Linux Enterprise Real Time 15 SP3, 15 SP2, 15 SP1, 15 GA, 12 SP5, 12 SP4, 12 SP3
2 What is systemd
? #
systemd
is the modern replacement for the legacy Linux initialization
systems, System V (SysV) and Linux Standard Base init (LSB init).
systemd
owns PID 1, and is started directly by the kernel. All other
processes are either started directly by systemd
, or by one of its child
processes. systemd
is designed to manage the complex demands of modern
Linux systems, by dynamically managing all processes from system boot to
shutdown.
3 How does systemd
work? #
systemd
uses unit files to control related processes. A unit
configuration file contains all the elements necessary to operate a
service: a listening socket, device, mount point, automount point, swap
file or partition, startup target, watched file system path, timers,
temporary system state snapshot, resource management slice, or a group of
externally created processes. This simplifies system administration, as
systemd
tracks and manages all the elements necessary for a particular
service, and the administrator has only a single service unit file to
manage for any service.
Unit files are customizable, and simpler and easier to understand than SysV and LSB init scripts.
4 Benefits of systemd
#
systemd
provides a number of benefits. It is a single daemon
that performs complete process management, from startup to shutdown.
It speeds up boot times by parallelizing service starts. It conserves
system resources by starting services on demand, and puts them to sleep
when there is no demand. systemd
reduces complexity and
increases efficiency by opening listening sockets, which are then
available when services start, and the administrator does not have to
worry about starting them in the correct order.
In contrast, SysV and LSB init only start services at boot, then exit. The SysV and LSB init administrator must configure services carefully to start in the correct order, for example networking must start before network services, and the administrator must remember to configure all necessary services to start at boot.
systemd
is written in C, in contrast to the large assortment of shell
scripts that comprise SysV and LSB init. The compiled single systemd
binary is faster and more efficient than masses of scripts.
systemd
provides unified logging for all processes with the
systemd
journal, which is viewed with the journalctl
command.
systemd
organizes processes with Kernel Control Groups (cgroups).
cgroups are inbuilt in the Linux kernel. This provides an extremely
efficient way to organize all related processes for a service, and to
quickly find which process belongs to which service.
cgroups also provide resource management, such as CPU, memory, I/O, and
device groups.
The systemctl
command is the systemd
and service
manager.
journalctl
and systemctl
replace a
host of legacy commands and scripts.
systemd
is backwards-compatible with SysV and LSB init.