1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../general.ent">
8 <sect1 id="ch-system-systemd" role="wrap" revision="systemd">
9 <?dbhtml filename="systemd.html"?>
11 <sect1info condition="script">
12 <productname>systemd</productname>
13 <productnumber>&systemd-version;</productnumber>
14 <address>&systemd-url;</address>
17 <title>Systemd-&systemd-version;</title>
19 <indexterm zone="ch-system-systemd">
20 <primary sortas="a-systemd">systemd</primary>
23 <sect2 role="package">
26 <para>The systemd package contains programs for controlling the startup,
27 running, and shutdown of the system.</para>
30 <segtitle>&buildtime;</segtitle>
31 <segtitle>&diskspace;</segtitle>
34 <seg>&systemd-fin-sbu;</seg>
35 <seg>&systemd-fin-du;</seg>
40 <sect2 role="installation">
41 <title>Installation of systemd</title>
44 <para>First, apply a patch to fix the build with GCC-10 and fix a segfault:</para>
46 <screen><userinput remap="pre">patch -Np1 -i ../systemd-&systemd-version;-gcc_10-fixes-2.patch</userinput></screen>
49 <!-- For linux-5.11's API headers changing the rfkill_event structure -->
50 <para>First, apply a patch to fix some regressions and fix functionality
51 with future versions of the kernel:</para>
53 <screen><userinput remap="pre">patch -Np1 -i ../systemd-&systemd-version;-upstream_fixes-2.patch</userinput></screen>
55 <para>Remove tests that cannot be built in chroot:</para>
57 <screen><userinput remap="pre">sed '181,$ d' -i src/resolve/meson.build</userinput></screen>
59 <para>Remove an unneeded group,
60 <systemitem class="groupname">render</systemitem>, from the default udev
63 <screen><userinput remap="pre">sed -i 's/GROUP="render"/GROUP="video"/' rules.d/50-udev-default.rules.in</userinput></screen>
65 <para>Prepare systemd for compilation:</para>
67 <screen><userinput remap="configure">mkdir -p build
73 --localstatedir=/var \
78 -Dinstall-tests=false \
79 -Dkmod-path=/bin/kmod \
81 -Dmount-path=/bin/mount \
85 -Dsulogin-path=/sbin/sulogin \
87 -Dumount-path=/bin/umount \
94 -Ddocdir=/usr/share/doc/systemd-&systemd-version; \
95 ..</userinput></screen>
98 <title>The meaning of the meson options:</title>
101 <term><parameter>-D*-path=*</parameter></term>
103 <para>These switches provide the location of binaries needed by
104 systemd at runtime that have not yet been installed.</para>
109 <term><parameter>-Ddefault-dnssec=no</parameter></term>
111 <para>This switch turns off the experimental DNSSEC support.</para>
116 <term><parameter>-Dfirstboot=false</parameter></term>
118 <para>This switch prevents installation of systemd
119 services responsible for setting up the system for
120 the first time. They are not useful for LFS because
121 everything is done manually.</para>
126 <term><parameter>-Dinstall-tests=false</parameter></term>
128 <para>This switch prevents installation of the compiled tests.</para>
133 <term><parameter>-Dldconfig=false</parameter></term>
135 <para>This switch prevents installation of a systemd unit that runs
136 <command>ldconfig</command> at boot, which is not useful for source
137 distributions such as LFS and makes the boot time longer. Remove it
138 if the described feature is desired.</para>
143 <term><parameter>-Droot*</parameter></term>
145 <para>These switches ensure that core programs and
146 shared libraries are installed in subdirectories
147 of the root partition.</para>
152 <term><parameter>-Dsplit-usr=true</parameter></term>
154 <para>This switch ensures that systemd will work on
155 systems where /bin, /lib and /sbin directories are not
156 symlinks to their /usr counterparts.</para>
161 <term><parameter>-Dsysusers=false</parameter></term>
163 <para>This switch prevents installation of systemd
164 services responsible for setting up the
165 <filename>/etc/group</filename> and
166 <filename>/etc/passwd</filename> files. Both files
167 were created earlier in this chapter.</para>
172 <term><parameter>-Drpmmacrosdir=no</parameter></term>
174 <para>This switch disables installation of RPM Macros
175 for use with systemd because LFS does not support RPM.</para>
180 <term><parameter>-D{userdb,homed}=false</parameter></term>
182 <para>Remove two daemons that have dependencies that do not fit
183 the scope of LFS.</para>
188 <term><parameter>-Dman=false</parameter></term>
190 <para>Prevent the generation of man pages to avoid extra
191 dependencies. We will install pre-generated man pages for systemd
192 from a tarball later.</para>
197 <term><parameter>-Dmode=release</parameter></term>
199 <para>Disable some features considered experimental by upstream.
206 <para>Compile the package:</para>
208 <screen><userinput remap="make">LANG=en_US.UTF-8 ninja</userinput></screen>
210 <para>Install the package:</para>
212 <screen><userinput remap="install">LANG=en_US.UTF-8 ninja install</userinput></screen>
214 <para>Install the man pages:</para>
216 <screen><userinput remap="install">tar -xf ../../systemd-man-pages-&systemd-man-version;.tar.xz --strip-components=1 -C /usr/share/man</userinput></screen>
218 <para>Remove a useless directory:</para>
220 <screen><userinput remap="install">rm -rf /usr/lib/pam.d</userinput></screen>
222 <para>Create the <filename>/etc/machine-id</filename> file needed by
223 <command>systemd-journald</command>:</para>
225 <screen><userinput remap="adjust">systemd-machine-id-setup</userinput></screen>
227 <para>Setup the basic target structure:</para>
229 <screen><userinput remap="adjust">systemctl preset-all</userinput></screen>
231 <para>Disable a service that is known to cause problems with systems that
232 use a network configuration other than what is provided by
233 systemd-networkd:</para>
234 <!-- Observed halting startup with dhcpcd handling the primary NIC -->
236 <screen><userinput remap="adjust">systemctl disable systemd-time-wait-sync.service</userinput></screen>
238 <!-- dev: 50-pid-max.conf is not removed in BLFS, so I commented the following out.
239 If it causes any trouble, we can add this back and also copy it into BLFS -->
241 <para>Prevent systemd from resetting the maximum PID value which causes
242 some problems with packages and units in BLFS:</para>
244 <screen><userinput remap="adjust">rm -f /usr/lib/sysctl.d/50-pid-max.conf</userinput></screen>
249 <sect2 id="contents-systemd" role="content">
250 <title>Contents of systemd</title>
253 <segtitle>Installed programs</segtitle>
254 <segtitle>Installed libraries</segtitle>
255 <segtitle>Installed directories</segtitle>
258 <seg>bootctl, busctl, coredumpctl, halt (symlink to systemctl),
259 hostnamectl, init, journalctl, kernel-install, localectl, loginctl,
260 machinectl, networkctl, portablectl, poweroff (symlink to
261 systemctl), reboot (symlink to systemctl), resolvconf (symlink to
262 resolvectl), resolvectl, runlevel (symlink to systemctl), shutdown
263 (symlink to systemctl), systemctl, systemd-analyze,
264 systemd-ask-password, systemd-cat, systemd-cgls, systemd-cgtop,
265 systemd-delta, systemd-detect-virt, systemd-dissect, systemd-escape,
266 systemd-hwdb, systemd-id128, systemd-inhibit, systemd-machine-id-setup,
267 systemd-mount, systemd-notify, systemd-nspawn, systemd-path,
268 systemd-repart, systemd-resolve (symlink to resolvectl), systemd-run,
269 systemd-socket-activate, systemd-stdio-bridge, systemd-tmpfiles,
270 systemd-tty-ask-password-agent, systemd-umount (symlink to
271 systemd-mount), telinit (symlink to systemctl), timedatectl, and
273 <seg>libnss_myhostname.so.2, libnss_mymachines.so.2,
274 libnss_resolve.so.2, libnss_systemd.so.2,
275 libsystemd.so, libsystemd-shared-&systemd-version;.so (in /lib/systemd),
277 <seg>/etc/binfmt.d, /etc/init.d, /etc/kernel, /etc/modules-load.d,
278 /etc/sysctl.d, /etc/systemd, /etc/tmpfiles.d, /etc/udev,
279 /etc/xdg/systemd, /lib/systemd, /lib/udev, /usr/include/systemd,
280 /usr/lib/binfmt.d, /usr/lib/environment.d, /usr/lib/kernel,
281 /usr/lib/modules-load.d, /usr/lib/sysctl.d, /usr/lib/systemd,
283 /usr/share/doc/systemd-&systemd-version;, /usr/share/factory,
284 /usr/share/systemd, /var/lib/systemd, and /var/log/journal</seg>
289 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
290 <?dbfo list-presentation="list"?>
291 <?dbhtml list-presentation="table"?>
293 <varlistentry id="bootctl">
294 <term><command>bootctl</command></term>
296 <para>Is used to query the firmware and boot manager settings</para>
297 <indexterm zone="ch-system-systemd bootctl">
298 <primary sortas="b-bootctl">bootctl</primary>
303 <varlistentry id="busctl">
304 <term><command>busctl</command></term>
306 <para>Is used to introspect and monitor the D-Bus bus</para>
307 <indexterm zone="ch-system-systemd busctl">
308 <primary sortas="b-busctl">busctl</primary>
313 <varlistentry id="coredumpctl">
314 <term><command>coredumpctl</command></term>
316 <para>Is used to retrieve coredumps from the systemd journal</para>
317 <indexterm zone="ch-system-systemd coredumpctl">
318 <primary sortas="b-coredumpctl">coredumpctl</primary>
323 <varlistentry id="halt">
324 <term><command>halt</command></term>
326 <para>Normally invokes <command>shutdown</command> with the
327 <parameter>-h</parameter> option, except when already in run-level 0,
328 then it tells the kernel to halt the system; it notes in the
329 file <filename>/var/log/wtmp</filename> that the system is being
331 <indexterm zone="ch-system-systemd halt">
332 <primary sortas="b-halt">halt</primary>
337 <varlistentry id="hostnamectl">
338 <term><command>hostnamectl</command></term>
340 <para>Is used to query and change the system hostname and related
342 <indexterm zone="ch-system-systemd hostnamectl">
343 <primary sortas="b-hostnamectl">hostnamectl</primary>
348 <varlistentry id="init">
349 <term><command>init</command></term>
351 <para>Is the first process to be started when the kernel has initialized
352 the hardware which takes over the boot process and starts all
353 processes according to its configuration files. In this case, it starts
355 <indexterm zone="ch-system-systemd init">
356 <primary sortas="b-init">init</primary>
361 <varlistentry id="journalctl">
362 <term><command>journalctl</command></term>
364 <para>Is used to query the contents of the systemd journal</para>
365 <indexterm zone="ch-system-systemd journalctl">
366 <primary sortas="b-journalctl">journalctl</primary>
371 <varlistentry id="kernel-install">
372 <term><command>kernel-install</command></term>
374 <para>Is used to add and remove kernel and initramfs images to and
375 from /boot. In LFS, this is done manually</para>
376 <indexterm zone="ch-system-systemd kernel-install">
377 <primary sortas="b-kernel-install">kernel-install</primary>
382 <varlistentry id="localectl">
383 <term><command>localectl</command></term>
385 <para>Is used to query and change the system locale and keyboard layout
387 <indexterm zone="ch-system-systemd localectl">
388 <primary sortas="b-localectl">localectl</primary>
393 <varlistentry id="loginctl">
394 <term><command>loginctl</command></term>
396 <para>Is used to introspect and control the state of the systemd Login
398 <indexterm zone="ch-system-systemd loginctl">
399 <primary sortas="b-loginctl">loginctl</primary>
404 <varlistentry id="machinectl">
405 <term><command>machinectl</command></term>
407 <para>Is used to introspect and control the state of the systemd Virtual
408 Machine and Container Registration Manager</para>
409 <indexterm zone="ch-system-systemd machinectl">
410 <primary sortas="b-machinectl">machinectl</primary>
415 <varlistentry id="networkctl">
416 <term><command>networkctl</command></term>
418 <para>Is used to introspect and configure the state of the network
419 links configured by systemd-networkd</para>
420 <indexterm zone="ch-system-systemd networkctl">
421 <primary sortas="b-networkctl">networkctl</primary>
426 <varlistentry id="portablectl">
427 <term><command>portablectl</command></term>
429 <para>Is used to attach or detach portable services from the local
431 <indexterm zone="ch-system-systemd portablectl">
432 <primary sortas="b-portablectl">portablectl</primary>
437 <varlistentry id="poweroff">
438 <term><command>poweroff</command></term>
440 <para>Instructs the kernel to halt the system and switch off the computer
441 (see <command>halt</command>)</para>
442 <indexterm zone="ch-system-systemd poweroff">
443 <primary sortas="b-poweroff">poweroff</primary>
448 <varlistentry id="reboot">
449 <term><command>reboot</command></term>
451 <para>Instructs the kernel to reboot the system (see
452 <command>halt</command>)</para>
453 <indexterm zone="ch-system-systemd reboot">
454 <primary sortas="b-reboot">reboot</primary>
459 <varlistentry id="resolvconf">
460 <term><command>resolvconf</command></term>
462 <para>Registers DNS server and domain configuration with
463 <command>systemd-resolved</command></para>
464 <indexterm zone="ch-system-systemd resolvconf">
465 <primary sortas="b-resolvconf">resolvconf</primary>
470 <varlistentry id="resolvectl">
471 <term><command>resolvectl</command></term>
473 <para>Sends control commands to the network name resolution
474 manager, or resolves domain names, IPv4 and IPv6 addresses,
475 DNS records, and services</para>
476 <indexterm zone="ch-system-systemd resolvectl">
477 <primary sortas="b-resolvectl">resolvectl</primary>
482 <varlistentry id="runlevel">
483 <term><command>runlevel</command></term>
485 <para>Outputs the previous and the current run-level, as noted in the
486 last run-level record in <filename>/run/utmp</filename></para>
487 <indexterm zone="ch-system-systemd runlevel">
488 <primary sortas="b-runlevel">runlevel</primary>
493 <varlistentry id="shutdown">
494 <term><command>shutdown</command></term>
496 <para>Brings the system down in a safe and secure manner, signaling
497 all processes and notifying all logged-in users</para>
498 <indexterm zone="ch-system-systemd shutdown">
499 <primary sortas="b-shutdown">shutdown</primary>
504 <varlistentry id="systemctl">
505 <term><command>systemctl</command></term>
507 <para>Is used to introspect and control the state of the systemd system
508 and service manager</para>
509 <indexterm zone="ch-system-systemd systemctl">
510 <primary sortas="b-systemctl">systemctl</primary>
515 <varlistentry id="systemd-analyze">
516 <term><command>systemd-analyze</command></term>
518 <para>Is used to determine system startup performance of the current
519 boot, as well as identify troublesome systemd units</para>
520 <indexterm zone="ch-system-systemd systemd-analyze">
521 <primary sortas="b-systemd-analyze">systemd-analyze</primary>
526 <varlistentry id="systemd-ask-password">
527 <term><command>systemd-ask-password</command></term>
529 <para>Is used to query a system password or passphrase from the user,
530 using a question message specified on the command line</para>
531 <indexterm zone="ch-system-systemd systemd-ask-password">
532 <primary sortas="b-systemd-ask-password">systemd-ask-password</primary>
537 <varlistentry id="systemd-cat">
538 <term><command>systemd-cat</command></term>
540 <para>Is used to connect the STDOUT and STDERR outputs of a process
541 with the systemd journal
543 <indexterm zone="ch-system-systemd systemd-cat">
544 <primary sortas="b-systemd-cat">systemd-cat</primary>
549 <varlistentry id="systemd-cgls">
550 <term><command>systemd-cgls</command></term>
552 <para>Recursively shows the contents of the selected Linux control
553 group hierarchy in a tree</para>
554 <indexterm zone="ch-system-systemd systemd-cgls">
555 <primary sortas="b-systemd-cgls">systemd-cgls</primary>
560 <varlistentry id="systemd-cgtop">
561 <term><command>systemd-cgtop</command></term>
563 <para>Shows the top control groups of the local Linux control group
564 hierarchy, ordered by their CPU, memory and disk I/O load</para>
565 <indexterm zone="ch-system-systemd systemd-cgtop">
566 <primary sortas="b-systemd-cgtop">systemd-cgtop</primary>
571 <varlistentry id="systemd-delta">
572 <term><command>systemd-delta</command></term>
574 <para>Is used to identify and compare configuration files in
575 <filename class="directory">/etc</filename> that override default
576 counterparts in <filename class="directory">/usr</filename></para>
577 <indexterm zone="ch-system-systemd systemd-delta">
578 <primary sortas="b-systemd-delta">systemd-delta</primary>
583 <varlistentry id="systemd-detect-virt">
584 <term><command>systemd-detect-virt</command></term>
586 <para>Detects whether the system is being run in a virtual
587 environment, and adjusts udev accordingly</para>
588 <indexterm zone="ch-system-systemd systemd-detect-virt">
589 <primary sortas="b-systemd-detect-virt">systemd-detect-virt</primary>
594 <varlistentry id="systemd-dissect">
595 <term><command>systemd-dissect</command></term>
597 <para>Is used to inspect OS disk images</para>
598 <indexterm zone="ch-system-systemd systemd-dissect">
599 <primary sortas="b-systemd-dissect">systemd-dissect</primary>
604 <varlistentry id="systemd-escape">
605 <term><command>systemd-escape</command></term>
607 <para>Is used to escape strings for inclusion in systemd unit
609 <indexterm zone="ch-system-systemd systemd-escape">
610 <primary sortas="b-systemd-escape">systemd-escape</primary>
615 <varlistentry id="systemd-hwdb">
616 <term><command>systemd-hwdb</command></term>
618 <para>Is used to manage the hardware database (hwdb)</para>
619 <indexterm zone="ch-system-systemd systemd-hwdb">
620 <primary sortas="b-systemd-hwdb">systemd-hwdb</primary>
625 <varlistentry id="systemd-id128">
626 <term><command>systemd-id128</command></term>
628 <para>Generates and prints id128 strings</para>
629 <indexterm zone="ch-system-systemd systemd-id128">
630 <primary sortas="b-systemd-id128">systemd-id128</primary>
635 <varlistentry id="systemd-inhibit">
636 <term><command>systemd-inhibit</command></term>
638 <para>Is used to execute a program with a shutdown, sleep or idle
639 inhibitor lock taken, preventing an action such as a system shutdown
640 until the process is completed</para>
641 <indexterm zone="ch-system-systemd systemd-inhibit">
642 <primary sortas="b-systemd-inhibit">systemd-inhibit</primary>
647 <varlistentry id="systemd-machine-id-setup">
648 <term><command>systemd-machine-id-setup</command></term>
650 <para>Is used by system installer tools to initialize the machine ID
651 stored in <filename>/etc/machine-id</filename> at install time with a
652 randomly generated ID</para>
653 <indexterm zone="ch-system-systemd systemd-machine-id-setup">
654 <primary sortas="b-systemd-machine-id-setup">systemd-machine-id-setup</primary>
659 <varlistentry id="systemd-mount">
660 <term><command>systemd-mount</command></term>
662 <para>Is used to temporarily mount or automount disks</para>
663 <indexterm zone="ch-system-systemd systemd-mount">
664 <primary sortas="b-systemd-mount">systemd-mount</primary>
669 <varlistentry id="systemd-notify">
670 <term><command>systemd-notify</command></term>
672 <para>Is used by daemon scripts to notify the init system about status
674 <indexterm zone="ch-system-systemd systemd-notify">
675 <primary sortas="b-systemd-notify">systemd-notify</primary>
680 <varlistentry id="systemd-nspawn">
681 <term><command>systemd-nspawn</command></term>
683 <para>Is used to run a command or OS in a light-weight namespace
685 <indexterm zone="ch-system-systemd systemd-nspawn">
686 <primary sortas="b-systemd-nspawn">systemd-nspawn</primary>
691 <varlistentry id="systemd-path">
692 <term><command>systemd-path</command></term>
694 <para>Is used to query system and user paths</para>
695 <indexterm zone="ch-system-systemd systemd-path">
696 <primary sortas="b-systemd-path">systemd-path</primary>
701 <varlistentry id="systemd-repart">
702 <term><command>systemd-repart</command></term>
704 <para>Is used to grow and add partitions to a partition table when
705 systemd is used in an OS image (e.g. a container)</para>
706 <indexterm zone="ch-system-systemd systemd-repart">
707 <primary sortas="b-systemd-repart">systemd-repart</primary>
712 <varlistentry id="systemd-resolve">
713 <term><command>systemd-resolve</command></term>
715 <para>Is used to resolve domain names, IPV4 and IPv6 addresses, DNS
716 resource records, and services</para>
717 <indexterm zone="ch-system-systemd systemd-resolve">
718 <primary sortas="b-systemd-resolve">systemd-resolve</primary>
723 <varlistentry id="systemd-run">
724 <term><command>systemd-run</command></term>
726 <para>Is used to create and start a transient .service or a .scope
727 unit and run the specified command in it. This is useful for
728 validating systemd units</para>
729 <indexterm zone="ch-system-systemd systemd-run">
730 <primary sortas="b-systemd-run">systemd-run</primary>
735 <varlistentry id="systemd-socket-activate">
736 <term><command>systemd-socket-activate</command></term>
738 <para>Is used to listen on socket devices and launch a process upon
739 a successful connection to the socket</para>
740 <indexterm zone="ch-system-systemd systemd-socket-activate">
741 <primary sortas="b-systemd-socket-activate">systemd-socket-activate</primary>
746 <varlistentry id="systemd-tmpfiles">
747 <term><command>systemd-tmpfiles</command></term>
749 <para>Creates, deletes and cleans up volatile and temporary files and
750 directories, based on the configuration file format and location
752 <filename class="directory">tmpfiles.d</filename> directories</para>
753 <indexterm zone="ch-system-systemd systemd-tmpfiles">
754 <primary sortas="b-systemd-tmpfiles">systemd-tmpfiles</primary>
759 <varlistentry id="systemd-umount">
760 <term><command>systemd-umount</command></term>
762 <para>Unmounts mount points</para>
763 <indexterm zone="ch-system-systemd systemd-umount">
764 <primary sortas="b-systemd-umount">systemd-umount</primary>
769 <varlistentry id="systemd-tty-ask-password-agent">
770 <term><command>systemd-tty-ask-password-agent</command></term>
772 <para>Is used to list and/or process pending systemd password
774 <indexterm zone="ch-system-systemd systemd-tty-ask-password-agent">
775 <primary sortas="b-systemd-tty-ask-password-agent">systemd-tty-ask-password-agent</primary>
780 <varlistentry id="telinit">
781 <term><command>telinit</command></term>
783 <para>Tells <command>init</command> which run-level to change
785 <indexterm zone="ch-system-systemd telinit">
786 <primary sortas="b-telinit">telinit</primary>
791 <varlistentry id="timedatectl">
792 <term><command>timedatectl</command></term>
794 <para>Is used to query and change the system clock and its settings
796 <indexterm zone="ch-system-systemd timedatectl">
797 <primary sortas="b-timedatectl">timedatectl</primary>
802 <varlistentry id="udevadm">
803 <term><command>udevadm</command></term>
805 <para>Is a generic udev administration tool which controls the udevd
806 daemon, provides info from the Udev hardware database, monitors
807 uevents, waits for uevents to finish, tests udev configuration, and
808 triggers uevents for a given device</para>
809 <indexterm zone="ch-system-systemd udevadm">
810 <primary sortas="b-udevadm">udevadm</primary>
815 <varlistentry id="libsystemd">
816 <term><filename class="libraryfile">libsystemd</filename></term>
818 <para>Is the main systemd utility library</para>
819 <indexterm zone="ch-system-systemd libsystemd">
820 <primary sortas="c-libsystemd">libsystemd</primary>
825 <varlistentry id="libudev">
826 <term><filename class="libraryfile">libudev</filename></term>
828 <para>Is a library to access Udev device information</para>
829 <indexterm zone="ch-system-systemd libudev">
830 <primary sortas="c-libudev">libudev</primary>