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-ch6-sbu;</seg>
35 <seg>&systemd-ch6-du;</seg>
40 <sect2 role="installation">
41 <title>Installation of systemd</title>
43 <para>First, fix a build error when using Util-Linux built in
46 <screen><userinput remap="pre">sed -i "s:blkid/::" $(grep -rl "blkid/blkid.h")</userinput></screen>
48 <!-- Not needed as of 231. -renodr
49 <para>Fix a potential security issue with framebuffer devices:</para>
51 <screen><userinput remap="pre">sed -e 's@DRI and frame buffer@DRI@' \
52 -e '/SUBSYSTEM==\"graphics\", KERNEL==\"fb\*\"/d' \
53 -i src/login/70-uaccess.rules</userinput></screen>
56 <para>Disable two tests that always fail:</para>
58 <screen><userinput remap="pre">sed -e 's@test/udev-test.pl @@' \
59 -e 's@test-copy$(EXEEXT) @@' \
60 -i Makefile.in</userinput></screen>
62 <para>Rebuild generated files after modifying Makefile.am and
65 <screen><userinput remap="pre">autoreconf -fi</userinput></screen>
67 <para>Create a file to allow systemd to build when using Util-Linux
68 built in Chapter 5, to disable LTO by default, and to build without
71 <screen><userinput remap="pre">cat > config.cache << "EOF"
72 <literal>KILL=/bin/kill
74 UMOUNT_PATH=/bin/umount
77 BLKID_CFLAGS="-I/tools/include/blkid"
80 MOUNT_CFLAGS="-I/tools/include/libmount"
82 XSLTPROC="/usr/bin/xsltproc"</literal>
83 EOF</userinput></screen>
85 <para>LTO is disabled by default because it causes
86 <command>systemd</command> and other auxiliary programs to link to
87 <filename class="libraryfile">libgcc_s.so</filename>, slows the build down
88 and makes the compiled code larger.</para>
90 <para>Prepare systemd for compilation:</para>
92 <screen><userinput remap="configure">./configure --prefix=/usr \
94 --localstatedir=/var \
97 --with-rootlibdir=/lib \
103 --with-default-dnssec=no \
104 --docdir=/usr/share/doc/systemd-&systemd-version;</userinput></screen>
107 <title>The meaning of the configure options:</title>
110 <term><parameter>--config-cache</parameter></term>
112 <para>This switch tells the build system to use
113 the <filename>config.cache</filename> file which
114 was created earlier.</para>
119 <term><parameter>--with-root*</parameter></term>
121 <para>These switches ensure that core programs and
122 shared libraries are installed in the subdirectories
123 of the root partition.</para>
128 <term><parameter>--enable-split-usr</parameter></term>
130 <para>This switch ensures that systemd will work on
131 systems where /bin, /lib and /sbin directories are not
132 symlinks to their /usr counterparts.</para>
137 <term><parameter>--without-python</parameter></term>
139 <para>This switch prevents <command>configure</command>
140 from trying to use Python which isn't built
146 <term><parameter>--disable-firstboot</parameter></term>
148 <para>This switch prevents installation of systemd
149 services responsible for setting up the system for
150 the first time. They are not useful for LFS because
151 everything is done manually.</para>
156 <term><parameter>--disable-ldconfig</parameter></term>
158 <para>This switch prevents installation of a systemd
159 unit that runs <command>ldconfig</command> at
160 boot, making the boot time longer. Remove it if the
161 described feature is desired, even though it's not
162 useful for source distributions such as LFS.</para>
167 <term><parameter>--disable-sysusers</parameter></term>
169 <para>This switch prevents installation of systemd
170 services responsible for setting up the
171 <filename>/etc/group</filename> and
172 <filename>/etc/passwd</filename> files. Both files
173 were created early in this chapter.</para>
178 <term><parameter>--with-default-dnssec=no</parameter></term>
180 <para>This switch turns off the experimental DNSSEC suport.</para>
186 <para>Compile the package:</para>
188 <screen><userinput remap="make">make LIBRARY_PATH=/tools/lib</userinput></screen>
190 <para>This package has a test suite, but it can only be run after the
191 package has been installed.</para>
193 <para>Install the package:</para>
195 <screen><userinput remap="install">make LD_LIBRARY_PATH=/tools/lib install</userinput></screen>
197 <para>Move the NSS libraries to <filename class="directory">/lib</filename>:</para>
199 <screen><userinput remap="install">mv -v /usr/lib/libnss_{myhostname,mymachines,resolve}.so.2 /lib</userinput></screen>
201 <para>Remove an unnecessary directory:</para>
203 <screen><userinput remap="install">rm -rfv /usr/lib/rpm</userinput></screen>
205 <para>Create the Sysvinit compatibility symlinks, so systemd is used
206 as the default init system:</para>
208 <screen><userinput remap="install">for tool in runlevel reboot shutdown poweroff halt telinit; do
209 ln -sfv ../bin/systemctl /sbin/${tool}
211 ln -sfv ../lib/systemd/systemd /sbin/init</userinput></screen>
214 <para>Remove a reference to a non-existent group:</para>
216 <screen><userinput remap="install">sed -i "s:0775 root lock:0755 root root:g" /usr/lib/tmpfiles.d/legacy.conf</userinput></screen>
219 <para>Create the <filename>/etc/machine-id</filename> file needed by
220 <command>systemd-journald</command>:</para>
222 <screen><userinput remap="install">systemd-machine-id-setup</userinput></screen>
224 <para>Fix a broken symlink created by the systemd installation process:</para>
225 <screen><userinput remap="install">rm -v /etc/resolv.conf
226 ln -s ../lib/systemd/resolv.conf /etc/resolv.conf</userinput></screen>
228 <para>Since the testsuite largely depends on the host system kernel
229 configuration, some tests may fail. It also needs a modification in
230 order not to look for a program that will be installed by Util-Linux
231 package later in this chapter. To test the results, issue:</para>
233 <screen><userinput remap="test">sed -i "s:minix:ext4:g" src/test/test-path-util.c
234 make LD_LIBRARY_PATH=/tools/lib -k check</userinput></screen>
238 <sect2 id="contents-systemd" role="content">
239 <title>Contents of systemd</title>
242 <segtitle>Installed programs</segtitle>
243 <segtitle>Installed libraries</segtitle>
244 <segtitle>Installed directories</segtitle>
247 <seg>bootctl, busctl, coredumpctl, halt, hostnamectl, init, journalctl,
248 kernel-install, localectl, loginctl, machinectl, networkctl, poweroff,
249 reboot, runlevel, shutdown, systemctl, systemd-analyze,
250 systemd-ask-password, systemd-cat, systemd-cgls, systemd-cgtop,
251 systemd-delta, systemd-detect-virt, systemd-escape, systemd-hwdb,
252 systemd-inhibit, systemd-machine-id-setup, systemd-notify,
253 systemd-nspawn, systemd-path, systemd-resolve, systemd-run,
254 systemd-stdio-bridge, systemd-tmpfiles, systemd-tty-ask-password-agent,
255 telinit, timedatectl, and udevadm</seg>
256 <seg>libnss_myhostname.so.2, libnss_mymachines.so.2,
257 libnss_resolve.so.2, libsystemd.so, libsystemd-shared-231.so,
259 <seg>/etc/binfmt.d, /etc/init.d, /etc/kernel, /etc/modules-load.d,
260 /etc/sysctl.d, /etc/systemd, /etc/tmpfiles.d, /etc/udev,
261 /etc/xdg/systemd, /lib/systemd, /lib/udev, /usr/include/systemd,
262 /usr/lib/binfmt.d, /usr/lib/kernel, /usr/lib/modules-load.d,
263 /usr/lib/sysctl.d, /usr/lib/systemd, /usr/lib/tmpfiles.d,
264 /usr/share/doc/systemd-&systemd-version;, /usr/share/factory,
265 /usr/share/systemd, /var/lib/systemd, and /var/log/journal</seg>
270 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
271 <?dbfo list-presentation="list"?>
272 <?dbhtml list-presentation="table"?>
274 <varlistentry id="bootctl">
275 <term><command>bootctl</command></term>
277 <para>used to query the firmware and boot manager settings</para>
278 <indexterm zone="ch-system-systemd bootctl">
279 <primary sortas="b-bootctl">bootctl</primary>
284 <varlistentry id="busctl">
285 <term><command>busctl</command></term>
287 <para>Used to introspect and monitor the D-Bus bus</para>
288 <indexterm zone="ch-system-systemd busctl">
289 <primary sortas="b-busctl">busctl</primary>
294 <varlistentry id="coredumpctl">
295 <term><command>coredumpctl</command></term>
297 <para>Used to retrieve coredumps from the systemd Journal</para>
298 <indexterm zone="ch-system-systemd coredumpctl">
299 <primary sortas="b-coredumpctl">coredumpctl</primary>
304 <varlistentry id="halt">
305 <term><command>halt</command></term>
307 <para>Normally invokes <command>shutdown</command> with the
308 <parameter>-h</parameter> option, except when already in run-level 0,
309 then it tells the kernel to halt the system; it notes in the
310 file <filename>/var/log/wtmp</filename> that the system is being
312 <indexterm zone="ch-system-systemd halt">
313 <primary sortas="b-halt">halt</primary>
318 <varlistentry id="hostnamectl">
319 <term><command>hostnamectl</command></term>
321 <para>Used to query and change the system hostname and related
323 <indexterm zone="ch-system-systemd hostnamectl">
324 <primary sortas="b-hostnamectl">hostnamectl</primary>
329 <varlistentry id="init">
330 <term><command>init</command></term>
332 <para>The first process to be started when the kernel has initialized
333 the hardware which takes over the boot process and starts all the
334 proceses it is instructed to</para>
335 <indexterm zone="ch-system-systemd init">
336 <primary sortas="b-init">init</primary>
341 <varlistentry id="journalctl">
342 <term><command>journalctl</command></term>
344 <para>Used to query the contents of the systemd Journal</para>
345 <indexterm zone="ch-system-systemd journalctl">
346 <primary sortas="b-journalctl">journalctl</primary>
351 <varlistentry id="kernel-install">
352 <term><command>kernel-install</command></term>
354 <para>Used to add and remove kernel and initramfs images to and
356 <indexterm zone="ch-system-systemd kernel-install">
357 <primary sortas="b-kernel-install">kernel-install</primary>
362 <varlistentry id="localectl">
363 <term><command>localectl</command></term>
365 <para>Used to query and change the system locale and keyboard layout
367 <indexterm zone="ch-system-systemd localectl">
368 <primary sortas="b-localectl">localectl</primary>
373 <varlistentry id="loginctl">
374 <term><command>loginctl</command></term>
376 <para>Used to introspect and control the state of the systemd Login
378 <indexterm zone="ch-system-systemd loginctl">
379 <primary sortas="b-loginctl">loginctl</primary>
384 <varlistentry id="machinectl">
385 <term><command>machinectl</command></term>
387 <para>Used to introspect and control the state of the systemd Virtual
388 Machine and Container Registration Manager</para>
389 <indexterm zone="ch-system-systemd machinectl">
390 <primary sortas="b-machinectl">machinectl</primary>
395 <varlistentry id="networkctl">
396 <term><command>networkctl</command></term>
398 <para>Used to introspect the state of the network links as seen by
399 systemd-networkd</para>
400 <indexterm zone="ch-system-systemd networkctl">
401 <primary sortas="b-networkctl">networkctl</primary>
406 <varlistentry id="poweroff">
407 <term><command>poweroff</command></term>
409 <para>Tells the kernel to halt the system and switch off the computer
410 (see <command>halt</command>)</para>
411 <indexterm zone="ch-system-systemd poweroff">
412 <primary sortas="b-poweroff">poweroff</primary>
417 <varlistentry id="reboot">
418 <term><command>reboot</command></term>
420 <para>Tells the kernel to reboot the system (see
421 <command>halt</command>)</para>
422 <indexterm zone="ch-system-systemd reboot">
423 <primary sortas="b-reboot">reboot</primary>
428 <varlistentry id="runlevel">
429 <term><command>runlevel</command></term>
431 <para>Reports the previous and the current run-level, as noted in the
432 last run-level record in <filename>/var/run/utmp</filename></para>
433 <indexterm zone="ch-system-systemd runlevel">
434 <primary sortas="b-runlevel">runlevel</primary>
439 <varlistentry id="shutdown">
440 <term><command>shutdown</command></term>
442 <para>Brings the system down in a secure way, signaling all processes
443 and notifying all logged-in users</para>
444 <indexterm zone="ch-system-systemd shutdown">
445 <primary sortas="b-shutdown">shutdown</primary>
450 <varlistentry id="systemctl">
451 <term><command>systemctl</command></term>
453 <para>Used to introspect and control the state of the systemd system
454 and service manager</para>
455 <indexterm zone="ch-system-systemd systemctl">
456 <primary sortas="b-systemctl">systemctl</primary>
461 <varlistentry id="systemd-analyze">
462 <term><command>systemd-analyze</command></term>
464 <para>Used to determine system boot-up performance of the current
466 <indexterm zone="ch-system-systemd systemd-analyze">
467 <primary sortas="b-systemd-analyze">systemd-analyze</primary>
472 <varlistentry id="systemd-ask-password">
473 <term><command>systemd-ask-password</command></term>
475 <para>Used to query a system password or passphrase from the user,
476 using a question message specified on the command line</para>
477 <indexterm zone="ch-system-systemd systemd-ask-password">
478 <primary sortas="b-systemd-ask-password">systemd-ask-password</primary>
483 <varlistentry id="systemd-cat">
484 <term><command>systemd-cat</command></term>
486 <para>Used to connect STDOUT and STDERR of a process with the Journal
488 <indexterm zone="ch-system-systemd systemd-cat">
489 <primary sortas="b-systemd-cat">systemd-cat</primary>
494 <varlistentry id="systemd-cgls">
495 <term><command>systemd-cgls</command></term>
497 <para>Recursively shows the contents of the selected Linux control
498 group hierarchy in a tree</para>
499 <indexterm zone="ch-system-systemd systemd-cgls">
500 <primary sortas="b-systemd-cgls">systemd-cgls</primary>
505 <varlistentry id="systemd-cgtop">
506 <term><command>systemd-cgtop</command></term>
508 <para>Shows the top control groups of the local Linux control group
509 hierarchy, ordered by their CPU, memory and disk I/O load</para>
510 <indexterm zone="ch-system-systemd systemd-cgtop">
511 <primary sortas="b-systemd-cgtop">systemd-cgtop</primary>
516 <varlistentry id="systemd-delta">
517 <term><command>systemd-delta</command></term>
519 <para>Used to identify and compare configuration files in
520 <filename class="directory">/etc</filename> that override default
521 counterparts in <filename class="directory">/usr</filename></para>
522 <indexterm zone="ch-system-systemd systemd-delta">
523 <primary sortas="b-systemd-delta">systemd-delta</primary>
528 <varlistentry id="systemd-detect-virt">
529 <term><command>systemd-detect-virt</command></term>
531 <para>Detects execution in a virtualized environment</para>
532 <indexterm zone="ch-system-systemd systemd-detect-virt">
533 <primary sortas="b-systemd-detect-virt">systemd-detect-virt</primary>
538 <varlistentry id="systemd-escape">
539 <term><command>systemd-escape</command></term>
541 <para>Used to escape strings for inclusion in systemd unit
543 <indexterm zone="ch-system-systemd systemd-escape">
544 <primary sortas="b-systemd-escape">systemd-escape</primary>
549 <varlistentry id="systemd-hwdb">
550 <term><command>systemd-hwdb</command></term>
552 <para>Used to manage hardware database (hwdb)</para>
553 <indexterm zone="ch-system-systemd systemd-hwdb">
554 <primary sortas="b-systemd-hwdb">systemd-hwdb</primary>
559 <varlistentry id="systemd-inhibit">
560 <term><command>systemd-inhibit</command></term>
562 <para>Used to execute a program with a shutdown, sleep or idle
563 inhibitor lock taken</para>
564 <indexterm zone="ch-system-systemd systemd-inhibit">
565 <primary sortas="b-systemd-inhibit">systemd-inhibit</primary>
570 <varlistentry id="systemd-machine-id-setup">
571 <term><command>systemd-machine-id-setup</command></term>
573 <para>Used by system installer tools to initialize the machine ID
574 stored in <filename>/etc/machine-id</filename> at install time with a
575 randomly generated ID</para>
576 <indexterm zone="ch-system-systemd systemd-machine-id-setup">
577 <primary sortas="b-systemd-machine-id-setup">systemd-machine-id-setup</primary>
582 <varlistentry id="systemd-notify">
583 <term><command>systemd-notify</command></term>
585 <para>Used by daemon scripts to notify the init system about status
587 <indexterm zone="ch-system-systemd systemd-notify">
588 <primary sortas="b-systemd-notify">systemd-notify</primary>
593 <varlistentry id="systemd-nspawn">
594 <term><command>systemd-nspawn</command></term>
596 <para>Used to run a command or OS in a light-weight namespace
598 <indexterm zone="ch-system-systemd systemd-nspawn">
599 <primary sortas="b-systemd-nspawn">systemd-nspawn</primary>
604 <varlistentry id="systemd-path">
605 <term><command>systemd-path</command></term>
607 <para>Used to query system and user paths</para>
608 <indexterm zone="ch-system-systemd systemd-path">
609 <primary sortas="b-systemd-path">systemd-path</primary>
614 <varlistentry id="systemd-resolve">
615 <term><command>systemd-resolve</command></term>
617 <para>Used to resolve domain names, IPV4 and IPv6 addresses, DNS
618 resource records, and services</para>
619 <indexterm zone="ch-system-systemd systemd-resolve">
620 <primary sortas="b-systemd-resolve">systemd-resolve</primary>
625 <varlistentry id="systemd-run">
626 <term><command>systemd-run</command></term>
628 <para>Used to create and start a transient .service or a .scope unit
629 and run the specified command in it</para>
630 <indexterm zone="ch-system-systemd systemd-run">
631 <primary sortas="b-systemd-run">systemd-run</primary>
636 <!-- <varlistentry id="systemd-stdio-bridge">
637 <term><command>systemd-stdio-bridge</command></term>
639 <para>To be completed</para>
640 <indexterm zone="ch-system-systemd systemd-stdio-bridge">
641 <primary sortas="b-systemd-stdio-bridge">systemd-stdio-bridge</primary>
646 <varlistentry id="systemd-tmpfiles">
647 <term><command>systemd-tmpfiles</command></term>
649 <para>Creates, deletes and cleans up volatile and temporary files and
650 directories, based on the configuration file format and location
652 <filename class="directory">tmpfiles.d</filename> directories</para>
653 <indexterm zone="ch-system-systemd systemd-tmpfiles">
654 <primary sortas="b-systemd-tmpfiles">systemd-tmpfiles</primary>
659 <varlistentry id="systemd-tty-ask-password-agent">
660 <term><command>systemd-tty-ask-password-agent</command></term>
662 <para>Used to list or process pending systemd password requests</para>
663 <indexterm zone="ch-system-systemd systemd-tty-ask-password-agent">
664 <primary sortas="b-systemd-tty-ask-password-agent">systemd-tty-ask-password-agent</primary>
669 <varlistentry id="telinit">
670 <term><command>telinit</command></term>
672 <para>Tells <command>init</command> which run-level to change
674 <indexterm zone="ch-system-systemd telinit">
675 <primary sortas="b-telinit">telinit</primary>
680 <varlistentry id="timedatectl">
681 <term><command>timedatectl</command></term>
683 <para>Used to query and change the system clock and its settings
685 <indexterm zone="ch-system-systemd timedatectl">
686 <primary sortas="b-timedatectl">timedatectl</primary>
691 <varlistentry id="udevadm">
692 <term><command>udevadm</command></term>
694 <para>Generic Udev administration tool: controls the udevd daemon,
695 provides info from the Udev database, monitors uevents, waits for
696 uevents to finish, tests Udev configuration, and triggers uevents
697 for a given device</para>
698 <indexterm zone="ch-system-systemd udevadm">
699 <primary sortas="b-udevadm">udevadm</primary>
704 <varlistentry id="libsystemd">
705 <term><filename class="libraryfile">libsystemd</filename></term>
707 <para>systemd utility library</para>
708 <indexterm zone="ch-system-systemd libsystemd">
709 <primary sortas="c-libsystemd">libsystemd</primary>
714 <varlistentry id="libudev">
715 <term><filename class="libraryfile">libudev</filename></term>
717 <para>A library to access Udev device information</para>
718 <indexterm zone="ch-system-systemd libudev">
719 <primary sortas="c-libudev">libudev</primary>