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 <!-- Not needed as of 232... anyone notice a pattern here? -renodr
63 <para>Apply a patch to fix a security issue:</para>
65 <screen><userinput remap="pre">patch -Np1 -i ../systemd-231-security_fix-1.patch</userinput></screen>
68 <para>Create a file to allow systemd to build when using Util-Linux
69 built in Chapter 5, to disable LTO by default, and to build without
72 <screen><userinput remap="pre">cat > config.cache << "EOF"
73 <literal>KILL=/bin/kill
75 UMOUNT_PATH=/bin/umount
78 BLKID_CFLAGS="-I/tools/include/blkid"
81 MOUNT_CFLAGS="-I/tools/include/libmount"
83 SULOGIN="/sbin/sulogin"
85 XSLTPROC="/usr/bin/xsltproc"</literal>
86 EOF</userinput></screen>
88 <para>LTO is disabled by default because it causes
89 <command>systemd</command> and other auxiliary programs to link to
90 <filename class="libraryfile">libgcc_s.so</filename>, slows the build down
91 and makes the compiled code larger.</para>
93 <para>Prepare systemd for compilation:</para>
95 <screen><userinput remap="configure">./configure --prefix=/usr \
97 --localstatedir=/var \
100 --with-rootlibdir=/lib \
102 --disable-firstboot \
106 --with-default-dnssec=no \
107 --docdir=/usr/share/doc/systemd-&systemd-version;</userinput></screen>
110 <title>The meaning of the configure options:</title>
113 <term><parameter>--config-cache</parameter></term>
115 <para>This switch tells the build system to use
116 the <filename>config.cache</filename> file which
117 was created earlier.</para>
122 <term><parameter>--with-root*</parameter></term>
124 <para>These switches ensure that core programs and
125 shared libraries are installed in the subdirectories
126 of the root partition.</para>
131 <term><parameter>--enable-split-usr</parameter></term>
133 <para>This switch ensures that systemd will work on
134 systems where /bin, /lib and /sbin directories are not
135 symlinks to their /usr counterparts.</para>
140 <term><parameter>--without-python</parameter></term>
142 <para>This switch prevents <command>configure</command>
143 from trying to use Python which isn't built
149 <term><parameter>--disable-firstboot</parameter></term>
151 <para>This switch prevents installation of systemd
152 services responsible for setting up the system for
153 the first time. They are not useful for LFS because
154 everything is done manually.</para>
159 <term><parameter>--disable-ldconfig</parameter></term>
161 <para>This switch prevents installation of a systemd
162 unit that runs <command>ldconfig</command> at
163 boot, making the boot time longer. Remove it if the
164 described feature is desired, even though it's not
165 useful for source distributions such as LFS.</para>
170 <term><parameter>--disable-sysusers</parameter></term>
172 <para>This switch prevents installation of systemd
173 services responsible for setting up the
174 <filename>/etc/group</filename> and
175 <filename>/etc/passwd</filename> files. Both files
176 were created early in this chapter.</para>
181 <term><parameter>--with-default-dnssec=no</parameter></term>
183 <para>This switch turns off the experimental DNSSEC suport.</para>
189 <para>Fix a generated file:</para>
191 <screen><userinput remap="pre">sed -i s/size_t/GPERF_LEN_TYPE/ src/resolve/dns_type-from-name.h</userinput></screen>
193 <para>Compile the package:</para>
195 <screen><userinput remap="make">make LD_LIBRARY_PATH=/tools/lib</userinput></screen>
197 <para>This package has a test suite, but it can only be run after the
198 package has been installed.</para>
200 <para>Install the package:</para>
202 <screen><userinput remap="install">make LD_LIBRARY_PATH=/tools/lib install</userinput></screen>
204 <!-- These get installed into /lib now by default.
205 <para>Move the NSS libraries to <filename class="directory">/lib</filename>:</para>
207 <screen><userinput remap="install">mv -v /usr/lib/libnss_{myhostname,mymachines,resolve}.so.2 /lib</userinput></screen>
210 <para>Remove an unnecessary directory:</para>
212 <screen><userinput remap="install">rm -rfv /usr/lib/rpm</userinput></screen>
214 <para>Create the Sysvinit compatibility symlinks, so systemd is used
215 as the default init system:</para>
217 <screen><userinput remap="install">for tool in runlevel reboot shutdown poweroff halt telinit; do
218 ln -sfv ../bin/systemctl /sbin/${tool}
220 ln -sfv ../lib/systemd/systemd /sbin/init</userinput></screen>
223 <para>Remove a reference to a non-existent group:</para>
225 <screen><userinput remap="install">sed -i "s:0775 root lock:0755 root root:g" /usr/lib/tmpfiles.d/legacy.conf</userinput></screen>
228 <para>Create the <filename>/etc/machine-id</filename> file needed by
229 <command>systemd-journald</command>:</para>
231 <screen><userinput remap="install">systemd-machine-id-setup</userinput></screen>
233 <para>Since the testsuite largely depends on the host system kernel
234 configuration, some tests may fail. It also needs a modification in
235 order not to look for a program that will be installed by Util-Linux
236 package later in this chapter. To test the results, issue:</para>
238 <screen><userinput remap="test">sed -i "s:minix:ext4:g" src/test/test-path-util.c
239 make LD_LIBRARY_PATH=/tools/lib -k check</userinput></screen>
243 <sect2 id="contents-systemd" role="content">
244 <title>Contents of systemd</title>
247 <segtitle>Installed programs</segtitle>
248 <segtitle>Installed libraries</segtitle>
249 <segtitle>Installed directories</segtitle>
252 <seg>bootctl, busctl, coredumpctl, halt, hostnamectl, init, journalctl,
253 kernel-install, localectl, loginctl, machinectl, networkctl, poweroff,
254 reboot, runlevel, shutdown, systemctl, systemd-analyze,
255 systemd-ask-password, systemd-cat, systemd-cgls, systemd-cgtop,
256 systemd-delta, systemd-detect-virt, systemd-escape, systemd-hwdb,
257 systemd-inhibit, systemd-machine-id-setup, systemd-mount,
258 systemd-notify, systemd-nspawn, systemd-path, systemd-resolve,
259 systemd-run, systemd-socket-activate,
260 systemd-stdio-bridge, systemd-tmpfiles, systemd-tty-ask-password-agent,
261 telinit, timedatectl, and udevadm</seg>
262 <seg>libnss_myhostname.so.2, libnss_mymachines.so.2,
263 libnss_resolve.so.2, libnss_systemd.so.2,
264 libsystemd.so, libsystemd-shared-231.so,
266 <seg>/etc/binfmt.d, /etc/init.d, /etc/kernel, /etc/modules-load.d,
267 /etc/sysctl.d, /etc/systemd, /etc/tmpfiles.d, /etc/udev,
268 /etc/xdg/systemd, /lib/systemd, /lib/udev, /usr/include/systemd,
269 /usr/lib/binfmt.d, /usr/lib/kernel, /usr/lib/modules-load.d,
270 /usr/lib/sysctl.d, /usr/lib/systemd, /usr/lib/tmpfiles.d,
271 /usr/share/doc/systemd-&systemd-version;, /usr/share/factory,
272 /usr/share/systemd, /var/lib/systemd, and /var/log/journal</seg>
277 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
278 <?dbfo list-presentation="list"?>
279 <?dbhtml list-presentation="table"?>
281 <varlistentry id="bootctl">
282 <term><command>bootctl</command></term>
284 <para>used to query the firmware and boot manager settings</para>
285 <indexterm zone="ch-system-systemd bootctl">
286 <primary sortas="b-bootctl">bootctl</primary>
291 <varlistentry id="busctl">
292 <term><command>busctl</command></term>
294 <para>Used to introspect and monitor the D-Bus bus</para>
295 <indexterm zone="ch-system-systemd busctl">
296 <primary sortas="b-busctl">busctl</primary>
301 <varlistentry id="coredumpctl">
302 <term><command>coredumpctl</command></term>
304 <para>Used to retrieve coredumps from the systemd Journal</para>
305 <indexterm zone="ch-system-systemd coredumpctl">
306 <primary sortas="b-coredumpctl">coredumpctl</primary>
311 <varlistentry id="halt">
312 <term><command>halt</command></term>
314 <para>Normally invokes <command>shutdown</command> with the
315 <parameter>-h</parameter> option, except when already in run-level 0,
316 then it tells the kernel to halt the system; it notes in the
317 file <filename>/var/log/wtmp</filename> that the system is being
319 <indexterm zone="ch-system-systemd halt">
320 <primary sortas="b-halt">halt</primary>
325 <varlistentry id="hostnamectl">
326 <term><command>hostnamectl</command></term>
328 <para>Used to query and change the system hostname and related
330 <indexterm zone="ch-system-systemd hostnamectl">
331 <primary sortas="b-hostnamectl">hostnamectl</primary>
336 <varlistentry id="init">
337 <term><command>init</command></term>
339 <para>The first process to be started when the kernel has initialized
340 the hardware which takes over the boot process and starts all the
341 proceses it is instructed to</para>
342 <indexterm zone="ch-system-systemd init">
343 <primary sortas="b-init">init</primary>
348 <varlistentry id="journalctl">
349 <term><command>journalctl</command></term>
351 <para>Used to query the contents of the systemd Journal</para>
352 <indexterm zone="ch-system-systemd journalctl">
353 <primary sortas="b-journalctl">journalctl</primary>
358 <varlistentry id="kernel-install">
359 <term><command>kernel-install</command></term>
361 <para>Used to add and remove kernel and initramfs images to and
363 <indexterm zone="ch-system-systemd kernel-install">
364 <primary sortas="b-kernel-install">kernel-install</primary>
369 <varlistentry id="localectl">
370 <term><command>localectl</command></term>
372 <para>Used to query and change the system locale and keyboard layout
374 <indexterm zone="ch-system-systemd localectl">
375 <primary sortas="b-localectl">localectl</primary>
380 <varlistentry id="loginctl">
381 <term><command>loginctl</command></term>
383 <para>Used to introspect and control the state of the systemd Login
385 <indexterm zone="ch-system-systemd loginctl">
386 <primary sortas="b-loginctl">loginctl</primary>
391 <varlistentry id="machinectl">
392 <term><command>machinectl</command></term>
394 <para>Used to introspect and control the state of the systemd Virtual
395 Machine and Container Registration Manager</para>
396 <indexterm zone="ch-system-systemd machinectl">
397 <primary sortas="b-machinectl">machinectl</primary>
402 <varlistentry id="networkctl">
403 <term><command>networkctl</command></term>
405 <para>Used to introspect the state of the network links as seen by
406 systemd-networkd</para>
407 <indexterm zone="ch-system-systemd networkctl">
408 <primary sortas="b-networkctl">networkctl</primary>
413 <varlistentry id="poweroff">
414 <term><command>poweroff</command></term>
416 <para>Tells the kernel to halt the system and switch off the computer
417 (see <command>halt</command>)</para>
418 <indexterm zone="ch-system-systemd poweroff">
419 <primary sortas="b-poweroff">poweroff</primary>
424 <varlistentry id="reboot">
425 <term><command>reboot</command></term>
427 <para>Tells the kernel to reboot the system (see
428 <command>halt</command>)</para>
429 <indexterm zone="ch-system-systemd reboot">
430 <primary sortas="b-reboot">reboot</primary>
435 <varlistentry id="runlevel">
436 <term><command>runlevel</command></term>
438 <para>Reports the previous and the current run-level, as noted in the
439 last run-level record in <filename>/var/run/utmp</filename></para>
440 <indexterm zone="ch-system-systemd runlevel">
441 <primary sortas="b-runlevel">runlevel</primary>
446 <varlistentry id="shutdown">
447 <term><command>shutdown</command></term>
449 <para>Brings the system down in a secure way, signaling all processes
450 and notifying all logged-in users</para>
451 <indexterm zone="ch-system-systemd shutdown">
452 <primary sortas="b-shutdown">shutdown</primary>
457 <varlistentry id="systemctl">
458 <term><command>systemctl</command></term>
460 <para>Used to introspect and control the state of the systemd system
461 and service manager</para>
462 <indexterm zone="ch-system-systemd systemctl">
463 <primary sortas="b-systemctl">systemctl</primary>
468 <varlistentry id="systemd-analyze">
469 <term><command>systemd-analyze</command></term>
471 <para>Used to determine system boot-up performance of the current
473 <indexterm zone="ch-system-systemd systemd-analyze">
474 <primary sortas="b-systemd-analyze">systemd-analyze</primary>
479 <varlistentry id="systemd-ask-password">
480 <term><command>systemd-ask-password</command></term>
482 <para>Used to query a system password or passphrase from the user,
483 using a question message specified on the command line</para>
484 <indexterm zone="ch-system-systemd systemd-ask-password">
485 <primary sortas="b-systemd-ask-password">systemd-ask-password</primary>
490 <varlistentry id="systemd-cat">
491 <term><command>systemd-cat</command></term>
493 <para>Used to connect STDOUT and STDERR of a process with the Journal
495 <indexterm zone="ch-system-systemd systemd-cat">
496 <primary sortas="b-systemd-cat">systemd-cat</primary>
501 <varlistentry id="systemd-cgls">
502 <term><command>systemd-cgls</command></term>
504 <para>Recursively shows the contents of the selected Linux control
505 group hierarchy in a tree</para>
506 <indexterm zone="ch-system-systemd systemd-cgls">
507 <primary sortas="b-systemd-cgls">systemd-cgls</primary>
512 <varlistentry id="systemd-cgtop">
513 <term><command>systemd-cgtop</command></term>
515 <para>Shows the top control groups of the local Linux control group
516 hierarchy, ordered by their CPU, memory and disk I/O load</para>
517 <indexterm zone="ch-system-systemd systemd-cgtop">
518 <primary sortas="b-systemd-cgtop">systemd-cgtop</primary>
523 <varlistentry id="systemd-delta">
524 <term><command>systemd-delta</command></term>
526 <para>Used to identify and compare configuration files in
527 <filename class="directory">/etc</filename> that override default
528 counterparts in <filename class="directory">/usr</filename></para>
529 <indexterm zone="ch-system-systemd systemd-delta">
530 <primary sortas="b-systemd-delta">systemd-delta</primary>
535 <varlistentry id="systemd-detect-virt">
536 <term><command>systemd-detect-virt</command></term>
538 <para>Detects execution in a virtualized environment</para>
539 <indexterm zone="ch-system-systemd systemd-detect-virt">
540 <primary sortas="b-systemd-detect-virt">systemd-detect-virt</primary>
545 <varlistentry id="systemd-escape">
546 <term><command>systemd-escape</command></term>
548 <para>Used to escape strings for inclusion in systemd unit
550 <indexterm zone="ch-system-systemd systemd-escape">
551 <primary sortas="b-systemd-escape">systemd-escape</primary>
556 <varlistentry id="systemd-hwdb">
557 <term><command>systemd-hwdb</command></term>
559 <para>Used to manage hardware database (hwdb)</para>
560 <indexterm zone="ch-system-systemd systemd-hwdb">
561 <primary sortas="b-systemd-hwdb">systemd-hwdb</primary>
566 <varlistentry id="systemd-inhibit">
567 <term><command>systemd-inhibit</command></term>
569 <para>Used to execute a program with a shutdown, sleep or idle
570 inhibitor lock taken</para>
571 <indexterm zone="ch-system-systemd systemd-inhibit">
572 <primary sortas="b-systemd-inhibit">systemd-inhibit</primary>
577 <varlistentry id="systemd-machine-id-setup">
578 <term><command>systemd-machine-id-setup</command></term>
580 <para>Used by system installer tools to initialize the machine ID
581 stored in <filename>/etc/machine-id</filename> at install time with a
582 randomly generated ID</para>
583 <indexterm zone="ch-system-systemd systemd-machine-id-setup">
584 <primary sortas="b-systemd-machine-id-setup">systemd-machine-id-setup</primary>
589 <varlistentry id="systemd-mount">
590 <term><command>systemd-mount</command></term>
592 <para>is a tool to temporarily mount or auto-mount a drive.</para>
593 <indexterm zone="ch-system-systemd systemd-mount">
594 <primary sortas="b-systemd-mount">systemd-mount</primary>
599 <varlistentry id="systemd-notify">
600 <term><command>systemd-notify</command></term>
602 <para>Used by daemon scripts to notify the init system about status
604 <indexterm zone="ch-system-systemd systemd-notify">
605 <primary sortas="b-systemd-notify">systemd-notify</primary>
610 <varlistentry id="systemd-nspawn">
611 <term><command>systemd-nspawn</command></term>
613 <para>Used to run a command or OS in a light-weight namespace
615 <indexterm zone="ch-system-systemd systemd-nspawn">
616 <primary sortas="b-systemd-nspawn">systemd-nspawn</primary>
621 <varlistentry id="systemd-path">
622 <term><command>systemd-path</command></term>
624 <para>Used to query system and user paths</para>
625 <indexterm zone="ch-system-systemd systemd-path">
626 <primary sortas="b-systemd-path">systemd-path</primary>
631 <varlistentry id="systemd-resolve">
632 <term><command>systemd-resolve</command></term>
634 <para>Used to resolve domain names, IPV4 and IPv6 addresses, DNS
635 resource records, and services</para>
636 <indexterm zone="ch-system-systemd systemd-resolve">
637 <primary sortas="b-systemd-resolve">systemd-resolve</primary>
642 <varlistentry id="systemd-run">
643 <term><command>systemd-run</command></term>
645 <para>Used to create and start a transient .service or a .scope unit
646 and run the specified command in it</para>
647 <indexterm zone="ch-system-systemd systemd-run">
648 <primary sortas="b-systemd-run">systemd-run</primary>
653 <!-- <varlistentry id="systemd-stdio-bridge">
654 <term><command>systemd-stdio-bridge</command></term>
656 <para>To be completed</para>
657 <indexterm zone="ch-system-systemd systemd-stdio-bridge">
658 <primary sortas="b-systemd-stdio-bridge">systemd-stdio-bridge</primary>
663 <varlistentry id="systemd-socket-activate">
664 <term><command>systemd-socket-activate</command></term>
666 <para>is a tool to listen on socket devices and launch a process upon
668 <indexterm zone="ch-system-systemd systemd-socket-activate">
669 <primary sortas="b-systemd-socket-activate">systemd-socket-activate</primary>
674 <varlistentry id="systemd-tmpfiles">
675 <term><command>systemd-tmpfiles</command></term>
677 <para>Creates, deletes and cleans up volatile and temporary files and
678 directories, based on the configuration file format and location
680 <filename class="directory">tmpfiles.d</filename> directories</para>
681 <indexterm zone="ch-system-systemd systemd-tmpfiles">
682 <primary sortas="b-systemd-tmpfiles">systemd-tmpfiles</primary>
687 <varlistentry id="systemd-tty-ask-password-agent">
688 <term><command>systemd-tty-ask-password-agent</command></term>
690 <para>Used to list or process pending systemd password requests</para>
691 <indexterm zone="ch-system-systemd systemd-tty-ask-password-agent">
692 <primary sortas="b-systemd-tty-ask-password-agent">systemd-tty-ask-password-agent</primary>
697 <varlistentry id="telinit">
698 <term><command>telinit</command></term>
700 <para>Tells <command>init</command> which run-level to change
702 <indexterm zone="ch-system-systemd telinit">
703 <primary sortas="b-telinit">telinit</primary>
708 <varlistentry id="timedatectl">
709 <term><command>timedatectl</command></term>
711 <para>Used to query and change the system clock and its settings
713 <indexterm zone="ch-system-systemd timedatectl">
714 <primary sortas="b-timedatectl">timedatectl</primary>
719 <varlistentry id="udevadm">
720 <term><command>udevadm</command></term>
722 <para>Generic Udev administration tool: controls the udevd daemon,
723 provides info from the Udev database, monitors uevents, waits for
724 uevents to finish, tests Udev configuration, and triggers uevents
725 for a given device</para>
726 <indexterm zone="ch-system-systemd udevadm">
727 <primary sortas="b-udevadm">udevadm</primary>
732 <varlistentry id="libsystemd">
733 <term><filename class="libraryfile">libsystemd</filename></term>
735 <para>systemd utility library</para>
736 <indexterm zone="ch-system-systemd libsystemd">
737 <primary sortas="c-libsystemd">libsystemd</primary>
742 <varlistentry id="libudev">
743 <term><filename class="libraryfile">libudev</filename></term>
745 <para>A library to access Udev device information</para>
746 <indexterm zone="ch-system-systemd libudev">
747 <primary sortas="c-libudev">libudev</primary>