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">
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, create a file to allow systemd to build when using Util-Linux
44 built in Chapter
5 and disable LTO by default:
</para>
46 <screen><userinput remap=
"pre">cat
> config.cache
<< "EOF"
47 <literal>KILL=/bin/kill
50 BLKID_CFLAGS=
"-I/tools/include/blkid"
51 cc_cv_CFLAGS__flto=no
</literal>
52 EOF
</userinput></screen>
54 <para>LTO is disabled by default because it causes
<command>systemd
</command>
55 and other auxiliary programs to link to
<filename
56 class=
"libraryfile">libgcc_s.so
</filename>, slows the build down and makes the
57 compiled code larger.
</para>
59 <para>Additionally, fix a build error when using Util-Linux built in
62 <screen><userinput remap=
"pre">sed -i
"s:blkid/::" $(grep -rl
"blkid/blkid.h")
</userinput></screen>
64 <para>Apply a patch so that compat
<command>pkg-config
</command> files get
65 installed without installing compat libs which are useless on LFS:
</para>
67 <screen><userinput remap=
"pre">patch -Np1 -i ../&systemd-compat-patch;
</userinput></screen>
69 <para>Prepare systemd for compilation:
</para>
71 <screen><userinput remap=
"configure">./configure --prefix=/usr \
73 --localstatedir=/var \
76 --with-rootlibdir=/lib \
83 --docdir=/usr/share/doc/systemd-&systemd-version; \
84 --with-dbuspolicydir=/etc/dbus-
1/system.d \
85 --with-dbusinterfacedir=/usr/share/dbus-
1/interfaces \
86 --with-dbussessionservicedir=/usr/share/dbus-
1/services \
87 --with-dbussystemservicedir=/usr/share/dbus-
1/system-services
</userinput></screen>
90 <title>The meaning of the configure options:
</title>
93 <term><parameter>--config-cache
</parameter></term>
95 <para>This switch tells the build system to use
96 the
<filename>config.cache
</filename> file which
97 was created earlier.
</para>
102 <term><parameter>--with-root*
</parameter></term>
104 <para>These switches ensure that core programs and
105 shared libraries are installed in the subdirectories
106 of the root partition.
</para>
111 <term><parameter>--enable-split-usr
</parameter></term>
113 <para>This switch ensures that systemd will work on
114 systems where /bin, /lib and /sbin directories are not
115 symlinks to their /usr counterparts.
</para>
120 <term><parameter>--disable-gudev --without-python
</parameter></term>
122 <para>These switches disable optional features because
123 LFS does not provide their dependencies.
</para>
128 <term><parameter>--disable-firstboot
</parameter></term>
130 <para>This switch prevents installation of systemd
131 services responsible for setting up the system for
132 the first time. They are not useful for LFS because
133 everything is done manually.
</para>
138 <term><parameter>--disable-ldconfig
</parameter></term>
140 <para>This switch prevents installation of a systemd
141 unit that runs
<command>ldconfig
</command> at
142 boot, making the boot time longer. Remove it if the
143 described feature is desired, even though it's not
144 useful for source distributions such as LFS.
</para>
149 <term><parameter>--disable-sysusers
</parameter></term>
151 <para>This switch prevents installation of systemd
152 services responsible for setting up the
153 <filename>/etc/group
</filename> and
154 <filename>/etc/passwd
</filename> files. Both files
155 were created early in this chapter.
</para>
160 <term><parameter>--with-dbus*
</parameter></term>
162 <para>These switches ensure that D-Bus configuration files
163 get installed in the correct locations.
</para>
169 <para>Compile the package:
</para>
171 <screen><userinput remap=
"make">make LIBRARY_PATH=/tools/lib
</userinput></screen>
173 <para>If you are going to run the test suite, first prevent a few test
174 cases from running because they fail in a chroot environment:
</para>
176 <screen><userinput remap=
"test">sed -e
"s:test/udev-test.pl::g" \
177 -e
"s:test-bus-cleanup\$(EXEEXT) ::g" \
178 -e
"s:test-bus-gvariant\$(EXEEXT) ::g" \
179 -e
"s:test-dhcp6-client\$(EXEEXT) ::g" \
180 -e
"s:test-journal-flush\$(EXEEXT) ::g" \
181 -e
"s:test-path-util\$(EXEEXT) ::g" \
182 -e
"s:test-sched-prio\$(EXEEXT) ::g" \
183 -e
"s:test-strv\$(EXEEXT) ::g" \
184 -i Makefile
</userinput></screen>
186 <para>To test the results, issue:
</para>
188 <screen><userinput remap=
"test">make check
</userinput></screen>
190 <para>Install the package:
</para>
192 <screen><userinput remap=
"install">make LD_LIBRARY_PATH=/tools/lib install
</userinput></screen>
194 <para>Move NSS libraries to
<filename class=
"directory">/lib
</filename>:
</para>
196 <screen><userinput remap=
"install">mv -v /usr/lib/libnss_{myhostname,mymachines,resolve}.so
.2 /lib
</userinput></screen>
198 <para>Remove an unnecessary directory:
</para>
200 <screen><userinput remap=
"install">rm -rfv /usr/lib/rpm
</userinput></screen>
202 <para>Create the Sysvinit compatibility symlinks, so systemd is used
203 as the default init system:
</para>
205 <screen><userinput remap=
"install">for tool in runlevel reboot shutdown poweroff halt telinit; do
206 ln -sfv ../bin/systemctl /sbin/${tool}
208 ln -sfv ../lib/systemd/systemd /sbin/init
</userinput></screen>
210 <para>Remove a reference to a non-existent group:
</para>
212 <screen><userinput remap=
"install">sed -i
"s:0775 root lock:0755 root root:g" /usr/lib/tmpfiles.d/legacy.conf
</userinput></screen>
214 <para>Create the
<filename>/etc/machine-id
</filename> file needed by
217 <screen><userinput remap=
"install">systemd-machine-id-setup
</userinput></screen>
221 <sect2 id=
"contents-systemd" role=
"content">
222 <title>Contents of systemd
</title>
225 <segtitle>Installed programs
</segtitle>
226 <segtitle>Installed libraries
</segtitle>
227 <segtitle>Installed directories
</segtitle>
230 <seg>bootctl, busctl, coredumpctl, halt, hostnamectl, init, journalctl,
231 kernel-install, localectl, loginctl, machinectl, networkctl, poweroff,
232 reboot, runlevel, shutdown, systemctl, systemd-analyze,
233 systemd-ask-password, systemd-cat, systemd-cgls, systemd-cgtop,
234 systemd-delta, systemd-detect-virt, systemd-escape,
<!-- systemd-firstboot, -->
235 systemd-inhibit, systemd-machine-id-setup, systemd-notify, systemd-nspawn,
236 systemd-path, systemd-run, systemd-stdio-bridge,
<!-- systemd-sysusers, -->
237 systemd-tmpfiles, systemd-tty-ask-password-agent, telinit, timedatectl,
239 <seg>libnss_myhostname.so
.2, libnss_mymachines.so
.2, libnss_resolve.so
.2,
240 libsystemd.so, libudev.so
</seg>
241 <seg>/etc/binfmt.d, /etc/init.d, /etc/kernel, /etc/modules-load.d,
242 /etc/sysctl.d, /etc/systemd, /etc/tmpfiles.d, /etc/udev,
243 /etc/xdg/systemd, /lib/systemd, /lib/udev, /usr/include/systemd,
244 /usr/lib/binfmt.d, /usr/lib/kernel, /usr/lib/modules-load.d,
245 /usr/lib/sysctl.d, /usr/lib/systemd,
<!-- /usr/lib/sysusers.d, -->
246 /usr/lib/tmpfiles.d, /usr/share/doc/systemd-&systemd-version;,
247 /usr/share/factory, /usr/share/systemd, /var/lib/systemd,
248 /var/log/journal
</seg>
253 <bridgehead renderas=
"sect3">Short Descriptions
</bridgehead>
254 <?dbfo list-presentation=
"list"?>
255 <?dbhtml list-presentation=
"table"?>
257 <varlistentry id=
"bootctl">
258 <term><command>bootctl
</command></term>
260 <para>used to query the firmware and boot manager settings.
</para>
261 <indexterm zone=
"ch-system-systemd bootctl">
262 <primary sortas=
"b-bootctl">bootctl
</primary>
267 <varlistentry id=
"busctl">
268 <term><command>busctl
</command></term>
270 <para>Used to introspect and monitor the D-Bus bus.
</para>
271 <indexterm zone=
"ch-system-systemd busctl">
272 <primary sortas=
"b-busctl">busctl
</primary>
277 <varlistentry id=
"coredumpctl">
278 <term><command>coredumpctl
</command></term>
280 <para>Used to retrieve coredumps from the systemd Journal
</para>
281 <indexterm zone=
"ch-system-systemd coredumpctl">
282 <primary sortas=
"b-coredumpctl">coredumpctl
</primary>
287 <varlistentry id=
"halt">
288 <term><command>halt
</command></term>
290 <para>Normally invokes
<command>shutdown
</command> with the
291 <parameter>-h
</parameter> option, except when already in run-level
0,
292 then it tells the kernel to halt the system; it notes in the
293 file
<filename>/var/log/wtmp
</filename> that the system is being
295 <indexterm zone=
"ch-system-systemd halt">
296 <primary sortas=
"b-halt">halt
</primary>
301 <varlistentry id=
"hostnamectl">
302 <term><command>hostnamectl
</command></term>
304 <para>Used to query and change the system hostname and related
306 <indexterm zone=
"ch-system-systemd hostnamectl">
307 <primary sortas=
"b-hostnamectl">hostnamectl
</primary>
312 <varlistentry id=
"init">
313 <term><command>init
</command></term>
315 <para>The first process to be started when the kernel has initialized
316 the hardware which takes over the boot process and starts all the
317 proceses it is instructed to.
</para>
318 <indexterm zone=
"ch-system-systemd init">
319 <primary sortas=
"b-init">init
</primary>
324 <varlistentry id=
"journalctl">
325 <term><command>journalctl
</command></term>
327 <para>Used to query the contents of the systemd Journal.
</para>
328 <indexterm zone=
"ch-system-systemd journalctl">
329 <primary sortas=
"b-journalctl">journalctl
</primary>
334 <varlistentry id=
"kernel-install">
335 <term><command>kernel-install
</command></term>
337 <para>Used to add and remove kernel and initramfs images to and
339 <indexterm zone=
"ch-system-systemd kernel-install">
340 <primary sortas=
"b-kernel-install">kernel-install
</primary>
345 <varlistentry id=
"localectl">
346 <term><command>localectl
</command></term>
348 <para>Used to query and change the system locale and keyboard layout
350 <indexterm zone=
"ch-system-systemd localectl">
351 <primary sortas=
"b-localectl">localectl
</primary>
356 <varlistentry id=
"loginctl">
357 <term><command>loginctl
</command></term>
359 <para>Used to introspect and control the state of the systemd Login
361 <indexterm zone=
"ch-system-systemd loginctl">
362 <primary sortas=
"b-loginctl">loginctl
</primary>
367 <varlistentry id=
"machinectl">
368 <term><command>machinectl
</command></term>
370 <para>Used to introspect and control the state of the systemd Virtual
371 Machine and Container Registration Manager
</para>
372 <indexterm zone=
"ch-system-systemd machinectl">
373 <primary sortas=
"b-machinectl">machinectl
</primary>
378 <varlistentry id=
"poweroff">
379 <term><command>poweroff
</command></term>
381 <para>Tells the kernel to halt the system and switch off the computer
382 (see
<command>halt
</command>).
</para>
383 <indexterm zone=
"ch-system-systemd poweroff">
384 <primary sortas=
"b-poweroff">poweroff
</primary>
389 <varlistentry id=
"reboot">
390 <term><command>reboot
</command></term>
392 <para>Tells the kernel to reboot the system (see
393 <command>halt
</command>).
</para>
394 <indexterm zone=
"ch-system-systemd reboot">
395 <primary sortas=
"b-reboot">reboot
</primary>
400 <varlistentry id=
"runlevel">
401 <term><command>runlevel
</command></term>
403 <para>Reports the previous and the current run-level, as noted in the
404 last run-level record in
<filename>/var/run/utmp
</filename>.
</para>
405 <indexterm zone=
"ch-system-systemd runlevel">
406 <primary sortas=
"b-runlevel">runlevel
</primary>
411 <varlistentry id=
"shutdown">
412 <term><command>shutdown
</command></term>
414 <para>Brings the system down in a secure way, signaling all processes
415 and notifying all logged-in users.
</para>
416 <indexterm zone=
"ch-system-systemd shutdown">
417 <primary sortas=
"b-shutdown">shutdown
</primary>
422 <varlistentry id=
"systemctl">
423 <term><command>systemctl
</command></term>
425 <para>Used to introspect and control the state of the systemd system and
426 service manager.
</para>
427 <indexterm zone=
"ch-system-systemd systemctl">
428 <primary sortas=
"b-systemctl">systemctl
</primary>
433 <varlistentry id=
"systemd-analyze">
434 <term><command>systemd-analyze
</command></term>
436 <para>Used to determine system boot-up performance of the current boot.
438 <indexterm zone=
"ch-system-systemd systemd-analyze">
439 <primary sortas=
"b-systemd-analyze">systemd-analyze
</primary>
444 <varlistentry id=
"systemd-ask-password">
445 <term><command>systemd-ask-password
</command></term>
447 <para>Used to query a system password or passphrase from the user, using a
448 question message specified on the command line.
</para>
449 <indexterm zone=
"ch-system-systemd systemd-ask-password">
450 <primary sortas=
"b-systemd-ask-password">systemd-ask-password
</primary>
455 <varlistentry id=
"systemd-cat">
456 <term><command>systemd-cat
</command></term>
458 <para>Used to connect STDOUT and STDERR of a process with the Journal.
460 <indexterm zone=
"ch-system-systemd systemd-cat">
461 <primary sortas=
"b-systemd-cat">systemd-cat
</primary>
466 <varlistentry id=
"systemd-cgls">
467 <term><command>systemd-cgls
</command></term>
469 <para>Recursively shows the contents of the selected Linux control group
470 hierarchy in a tree.
</para>
471 <indexterm zone=
"ch-system-systemd systemd-cgls">
472 <primary sortas=
"b-systemd-cgls">systemd-cgls
</primary>
477 <varlistentry id=
"systemd-cgtop">
478 <term><command>systemd-cgtop
</command></term>
480 <para>Shows the top control groups of the local Linux control group hierarchy,
481 ordered by their CPU, memory and disk I/O load.
</para>
482 <indexterm zone=
"ch-system-systemd systemd-cgtop">
483 <primary sortas=
"b-systemd-cgtop">systemd-cgtop
</primary>
488 <varlistentry id=
"systemd-delta">
489 <term><command>systemd-delta
</command></term>
491 <para>Used to identify and compare configuration files in
492 <filename class=
"directory">/etc
</filename> that override default
493 counterparts in
<filename class=
"directory">/usr
</filename>.
</para>
494 <indexterm zone=
"ch-system-systemd systemd-delta">
495 <primary sortas=
"b-systemd-delta">systemd-delta
</primary>
500 <varlistentry id=
"systemd-detect-virt">
501 <term><command>systemd-detect-virt
</command></term>
503 <para>Detects execution in a virtualized environment.
</para>
504 <indexterm zone=
"ch-system-systemd systemd-detect-virt">
505 <primary sortas=
"b-systemd-detect-virt">systemd-detect-virt
</primary>
510 <varlistentry id=
"systemd-escape">
511 <term><command>systemd-escape
</command></term>
513 <para>Used to escape strings for inclusion in systemd unit names.
</para>
514 <indexterm zone=
"ch-system-systemd systemd-escape">
515 <primary sortas=
"b-systemd-escape">systemd-escape
</primary>
520 <!-- <varlistentry id="systemd-firstboot">
521 <term><command>systemd-firstboot</command></term>
523 <para>Initializes the most basic system settings interactively on the
525 <indexterm zone="ch-system-systemd systemd-firstboot">
526 <primary sortas="b-systemd-firstboot">systemd-firstboot</primary>
531 <varlistentry id=
"systemd-inhibit">
532 <term><command>systemd-inhibit
</command></term>
534 <para>Used to execute a program with a shutdown, sleep or idle inhibitor lock
536 <indexterm zone=
"ch-system-systemd systemd-inhibit">
537 <primary sortas=
"b-systemd-inhibit">systemd-inhibit
</primary>
542 <varlistentry id=
"systemd-machine-id-setup">
543 <term><command>systemd-machine-id-setup
</command></term>
545 <para>Used by system installer tools to initialize the machine ID stored in
546 <filename>/etc/machine-id
</filename> at install time with a randomly
548 <indexterm zone=
"ch-system-systemd systemd-machine-id-setup">
549 <primary sortas=
"b-systemd-machine-id-setup">systemd-machine-id-setup
</primary>
554 <varlistentry id=
"systemd-notify">
555 <term><command>systemd-notify
</command></term>
557 <para>Used by daemon scripts to notify the init system about status changes.
559 <indexterm zone=
"ch-system-systemd systemd-notify">
560 <primary sortas=
"b-systemd-notify">systemd-notify
</primary>
565 <varlistentry id=
"systemd-nspawn">
566 <term><command>systemd-nspawn
</command></term>
568 <para>Used to run a command or OS in a light-weight namespace container.
</para>
569 <indexterm zone=
"ch-system-systemd systemd-nspawn">
570 <primary sortas=
"b-systemd-nspawn">systemd-nspawn
</primary>
575 <varlistentry id=
"systemd-path">
576 <term><command>systemd-path
</command></term>
578 <para>Used to query system and user paths.
</para>
579 <indexterm zone=
"ch-system-systemd systemd-path">
580 <primary sortas=
"b-systemd-path">systemd-path
</primary>
585 <varlistentry id=
"systemd-run">
586 <term><command>systemd-run
</command></term>
588 <para>Used to create and start a transient .service or a .scope unit and
589 run the specified command in it.
</para>
590 <indexterm zone=
"ch-system-systemd systemd-run">
591 <primary sortas=
"b-systemd-run">systemd-run
</primary>
596 <!-- <varlistentry id="systemd-stdio-bridge">
597 <term><command>systemd-stdio-bridge</command></term>
599 <para>To be completed</para>
600 <indexterm zone="ch-system-systemd systemd-stdio-bridge">
601 <primary sortas="b-systemd-stdio-bridge">systemd-stdio-bridge</primary>
606 <!-- <varlistentry id="systemd-sysusers">
607 <term><command>systemd-sysusers</command></term>
609 <para>Creates system users and groups, based on the file format and location
610 specified in <filename class="directory">sysusers.d</filename>.</para>
611 <indexterm zone="ch-system-systemd systemd-sysusers">
612 <primary sortas="b-systemd-sysusers">systemd-sysusers</primary>
617 <varlistentry id=
"systemd-tmpfiles">
618 <term><command>systemd-tmpfiles
</command></term>
620 <para>Creates, deletes and cleans up volatile and temporary files and directories,
621 based on the configuration file format and location specified in
622 <filename class=
"directory">tmpfiles.d
</filename> directories.
</para>
623 <indexterm zone=
"ch-system-systemd systemd-tmpfiles">
624 <primary sortas=
"b-systemd-tmpfiles">systemd-tmpfiles
</primary>
629 <varlistentry id=
"systemd-tty-ask-password-agent">
630 <term><command>systemd-tty-ask-password-agent
</command></term>
632 <para>Used to list or process pending systemd password requests
</para>
633 <indexterm zone=
"ch-system-systemd systemd-tty-ask-password-agent">
634 <primary sortas=
"b-systemd-tty-ask-password-agent">systemd-tty-ask-password-agent
</primary>
639 <varlistentry id=
"telinit">
640 <term><command>telinit
</command></term>
642 <para>Tells
<command>init
</command> which run-level to change to.
</para>
643 <indexterm zone=
"ch-system-systemd telinit">
644 <primary sortas=
"b-telinit">telinit
</primary>
649 <varlistentry id=
"timedatectl">
650 <term><command>timedatectl
</command></term>
652 <para>Used to query and change the system clock and its settings.
654 <indexterm zone=
"ch-system-systemd timedatectl">
655 <primary sortas=
"b-timedatectl">timedatectl
</primary>
660 <varlistentry id=
"udevadm">
661 <term><command>udevadm
</command></term>
663 <para>Generic Udev administration tool: controls the udevd daemon,
664 provides info from the Udev database, monitors uevents, waits for
665 uevents to finish, tests Udev configuration, and triggers uevents
666 for a given device.
</para>
667 <indexterm zone=
"ch-system-systemd udevadm">
668 <primary sortas=
"b-udevadm">udevadm
</primary>
673 <varlistentry id=
"libsystemd">
674 <term><filename class=
"libraryfile">libsystemd
</filename></term>
676 <para>systemd utility library.
</para>
677 <indexterm zone=
"ch-system-systemd libsystemd">
678 <primary sortas=
"c-libsystemd">libsystemd
</primary>
683 <varlistentry id=
"libudev">
684 <term><filename class=
"libraryfile">libudev
</filename></term>
686 <para>A library to access Udev device information.
</para>
687 <indexterm zone=
"ch-system-systemd libudev">
688 <primary sortas=
"c-libudev">libudev
</primary>