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">
|
---|
5 | %general-entities;
|
---|
6 |
|
---|
7 | <!-- <!ENTITY systemd-download-http "http://anduin.linuxfromscratch.org/LFS/systemd-&systemd-version;-&systemd-stable;.tar.xz"> For whenever we move to a stable snapshot for backports -->
|
---|
8 | <!ENTITY systemd-download-http "https://github.com/systemd/systemd/archive/v&systemd-version;/systemd-&systemd-version;.tar.gz">
|
---|
9 | <!ENTITY systemd-download-ftp " ">
|
---|
10 | <!ENTITY systemd-md5sum "8e8adf909c255914dfc10709bd372e69">
|
---|
11 | <!ENTITY systemd-size "10 MB">
|
---|
12 | <!ENTITY systemd-buildsize "287 MB (with tests)">
|
---|
13 | <!ENTITY systemd-time "2.5 SBU (with tests)">
|
---|
14 |
|
---|
15 | ]>
|
---|
16 |
|
---|
17 | <sect1 id="systemd" xreflabel="Systemd-&systemd-version;" revision="systemd">
|
---|
18 | <?dbhtml filename="systemd.html"?>
|
---|
19 |
|
---|
20 | <sect1info>
|
---|
21 | <date>$Date$</date>
|
---|
22 | </sect1info>
|
---|
23 |
|
---|
24 | <title>Systemd-&systemd-version;</title>
|
---|
25 | <!-- Whenever we switch back to stable backports, make sure to add the systemd-stable reference back. -->
|
---|
26 |
|
---|
27 | <indexterm zone="systemd">
|
---|
28 | <primary sortas="a-systemd">systemd</primary>
|
---|
29 | </indexterm>
|
---|
30 |
|
---|
31 | <sect2 role="package">
|
---|
32 | <title>Introduction to systemd</title>
|
---|
33 |
|
---|
34 | <para>
|
---|
35 | While <application>systemd</application> was installed when
|
---|
36 | building LFS, there are many features provided by the package that
|
---|
37 | were not included in the initial installation because
|
---|
38 | <application>Linux-PAM</application> was not yet installed.
|
---|
39 | The <application>systemd</application> package needs to be
|
---|
40 | rebuilt to provide a working <command>systemd-logind</command> service,
|
---|
41 | which provides many additional features for dependent packages.
|
---|
42 | </para>
|
---|
43 |
|
---|
44 | &lfs110a_checked;
|
---|
45 |
|
---|
46 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
47 | <itemizedlist spacing="compact">
|
---|
48 | <listitem>
|
---|
49 | <para>
|
---|
50 | Download (HTTP): <ulink url="&systemd-download-http;"/>
|
---|
51 | </para>
|
---|
52 | </listitem>
|
---|
53 | <listitem>
|
---|
54 | <para>
|
---|
55 | Download (FTP): <ulink url="&systemd-download-ftp;"/>
|
---|
56 | </para>
|
---|
57 | </listitem>
|
---|
58 | <listitem>
|
---|
59 | <para>
|
---|
60 | Download MD5 sum: &systemd-md5sum;
|
---|
61 | </para>
|
---|
62 | </listitem>
|
---|
63 | <listitem>
|
---|
64 | <para>
|
---|
65 | Download size: &systemd-size;
|
---|
66 | </para>
|
---|
67 | </listitem>
|
---|
68 | <listitem>
|
---|
69 | <para>
|
---|
70 | Estimated disk space required: &systemd-buildsize;
|
---|
71 | </para>
|
---|
72 | </listitem>
|
---|
73 | <listitem>
|
---|
74 | <para>
|
---|
75 | Estimated build time: &systemd-time;
|
---|
76 | </para>
|
---|
77 | </listitem>
|
---|
78 | </itemizedlist>
|
---|
79 |
|
---|
80 | <bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
81 | <itemizedlist spacing="compact">
|
---|
82 | <listitem>
|
---|
83 | <para>
|
---|
84 | Required patch:
|
---|
85 | <ulink url="&patch-root;/systemd-&systemd-version;-upstream_fixes-1.patch"/>
|
---|
86 | </para>
|
---|
87 | </listitem>
|
---|
88 | </itemizedlist>
|
---|
89 |
|
---|
90 | <bridgehead renderas="sect3">systemd Dependencies</bridgehead>
|
---|
91 |
|
---|
92 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
93 | <para role="required">
|
---|
94 | <xref linkend="Jinja2"/> and
|
---|
95 | <xref linkend="linux-pam"/>
|
---|
96 | </para>
|
---|
97 |
|
---|
98 | <bridgehead renderas="sect4">Recommended Runtime Dependencies</bridgehead>
|
---|
99 | <para role="recommended">
|
---|
100 | <xref role="runtime" linkend="polkit"/>
|
---|
101 | </para>
|
---|
102 |
|
---|
103 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
104 | <para role="optional">
|
---|
105 | <xref linkend="btrfs-progs"/>, <!-- homed may support it, see the C.E.-->
|
---|
106 | <xref linkend="curl"/>,
|
---|
107 | <xref linkend="cryptsetup"/>,
|
---|
108 | <xref linkend="git"/>,
|
---|
109 | <xref linkend="gnutls"/>,
|
---|
110 | <xref linkend="iptables"/>,
|
---|
111 | <xref linkend="libgcrypt"/>,
|
---|
112 | <xref linkend="libidn2"/>,
|
---|
113 | <xref linkend="libpwquality"/>,
|
---|
114 | <xref linkend="libseccomp"/>,
|
---|
115 | <xref linkend="libxkbcommon"/>,
|
---|
116 | <xref linkend="make-ca"/>,
|
---|
117 | <xref linkend="p11-kit"/>,
|
---|
118 | <xref linkend="pcre2"/>,
|
---|
119 | <xref linkend="qemu"/>,
|
---|
120 | <xref linkend="qrencode"/>,
|
---|
121 | <xref linkend="rsync"/>,
|
---|
122 | <xref linkend="valgrind"/>,
|
---|
123 | <xref linkend="zsh"/> (for the zsh completions),
|
---|
124 | <ulink url="https://sourceforge.net/projects/gnu-efi/">gnu-efi</ulink>,
|
---|
125 | <ulink url="https://www.kernel.org/pub/linux/utils/kernel/kexec/">kexec-tools</ulink>,
|
---|
126 | <ulink url="https://sourceware.org/elfutils/">libdw</ulink>,
|
---|
127 | <ulink url="https://developers.yubico.com/libfido2/">libfido2</ulink>,
|
---|
128 | <ulink url="https://www.gnu.org/software/libmicrohttpd/">libmicrohttpd</ulink>,
|
---|
129 | <ulink url="http://lz4.github.io/lz4/">lz4</ulink>,
|
---|
130 | <!--<ulink url="http://fukuchi.org/works/qrencode/">qrencode</ulink>,-->
|
---|
131 | <ulink url="https://sourceforge.net/projects/linuxquota/">quota-tools</ulink>,
|
---|
132 | <ulink url="https://pypi.python.org/pypi/Sphinx">Sphinx</ulink>, and
|
---|
133 | <ulink url="https://tpm2-tss.readthedocs.io/en/latest/">tpm2-tss</ulink>
|
---|
134 | </para>
|
---|
135 |
|
---|
136 | <bridgehead renderas="sect4">Optional (to rebuild the manual pages)</bridgehead>
|
---|
137 | <para role="optional">
|
---|
138 | <xref linkend="DocBook"/>,
|
---|
139 | <xref linkend="docbook-xsl"/>,
|
---|
140 | <xref linkend="libxslt"/>, and
|
---|
141 | <xref linkend="lxml"/> (to build the index of systemd manual pages)
|
---|
142 | </para>
|
---|
143 |
|
---|
144 | <para condition="html" role="usernotes">User Notes:
|
---|
145 | <ulink url="&blfs-wiki;/systemd"/>
|
---|
146 | </para>
|
---|
147 | </sect2>
|
---|
148 |
|
---|
149 | <sect2 role="installation">
|
---|
150 | <title>Installation of systemd</title>
|
---|
151 |
|
---|
152 | <para>
|
---|
153 | Apply a patch to fix a security vulnerability:
|
---|
154 | </para>
|
---|
155 |
|
---|
156 | <screen><userinput remap="pre">patch -Np1 -i ../systemd-&systemd-version;-upstream_fixes-1.patch</userinput></screen>
|
---|
157 |
|
---|
158 | <para>
|
---|
159 | Remove two unneeded groups,
|
---|
160 | <systemitem class="groupname">render</systemitem> and
|
---|
161 | <systemitem class="groupname">sgx</systemitem>, from the default udev
|
---|
162 | rules:
|
---|
163 | </para>
|
---|
164 |
|
---|
165 | <screen><userinput remap="pre">sed -i -e 's/GROUP="render"/GROUP="video"/' \
|
---|
166 | -e 's/GROUP="sgx", //' rules.d/50-udev-default.rules.in</userinput></screen>
|
---|
167 |
|
---|
168 | <para>
|
---|
169 | Fix a problem with meson version 0.60 and higher:
|
---|
170 | </para>
|
---|
171 |
|
---|
172 | <screen><userinput remap="pre">sed -i 's/+ want_libfuzzer.*$/and want_libfuzzer/' meson.build</userinput></screen>
|
---|
173 |
|
---|
174 | <para>
|
---|
175 | Fix a problem when building with kernel headers from linux-5.14 and later:
|
---|
176 | </para>
|
---|
177 |
|
---|
178 | <screen><userinput remap="pre">sed -i '/ARPHRD_CAN/a#define ARPHRD_MCTP 290' src/basic/linux/if_arp.h</userinput></screen>
|
---|
179 |
|
---|
180 | <para>
|
---|
181 | Rebuild <application>systemd</application> by running the
|
---|
182 | following commands:
|
---|
183 | </para>
|
---|
184 |
|
---|
185 | <screen><userinput>mkdir build &&
|
---|
186 | cd build &&
|
---|
187 |
|
---|
188 | meson --prefix=/usr \
|
---|
189 | --buildtype=release \
|
---|
190 | -Dblkid=true \
|
---|
191 | -Ddefault-dnssec=no \
|
---|
192 | -Dfirstboot=false \
|
---|
193 | -Dinstall-tests=false \
|
---|
194 | -Dldconfig=false \
|
---|
195 | -Dman=auto \
|
---|
196 | -Dsysusers=false \
|
---|
197 | -Drpmmacrosdir=no \
|
---|
198 | -Db_lto=false \
|
---|
199 | -Dhomed=false \
|
---|
200 | -Duserdb=false \
|
---|
201 | -Dmode=release \
|
---|
202 | -Dpamconfdir=/etc/pam.d \
|
---|
203 | -Ddocdir=/usr/share/doc/systemd-&systemd-version; \
|
---|
204 | .. &&
|
---|
205 |
|
---|
206 | ninja</userinput></screen>
|
---|
207 | <!-- Regarding homed and userdb, see the note below in Command Explanations-->
|
---|
208 |
|
---|
209 | <note>
|
---|
210 | <para>
|
---|
211 | For the best test results, make sure you run the testsuite from
|
---|
212 | a system that is booted by the same
|
---|
213 | <application>systemd</application> version you are rebuilding.
|
---|
214 | </para>
|
---|
215 | </note>
|
---|
216 |
|
---|
217 | <para>
|
---|
218 | To test the results, issue:
|
---|
219 | <command>PATH+=:/usr/sbin ninja test</command>.
|
---|
220 | <!-- One test named test-repart needs sfdisk, which is in /usr/sbin. -->
|
---|
221 | </para>
|
---|
222 |
|
---|
223 | <!--
|
---|
224 | <warning>
|
---|
225 | <para>
|
---|
226 | Installing the package will overwrite all files installed by
|
---|
227 | <application>systemd</application> in LFS. It is critical that
|
---|
228 | nothing uses either <application>systemd</application> or
|
---|
229 | <application>Udev</application> libraries during the installation.
|
---|
230 | The best way to ensure that these libraries are not being used is to
|
---|
231 | run the installation in rescue mode. To switch to rescue mode,
|
---|
232 | run the following command as the
|
---|
233 | <systemitem class="username">root</systemitem> user (from a TTY):
|
---|
234 | </para>
|
---|
235 |
|
---|
236 | <screen role="root"><userinput>systemctl isolate rescue.target</userinput></screen>
|
---|
237 | </warning>
|
---|
238 | Nobody has reported problems with this in years. Let's comment it. -->
|
---|
239 |
|
---|
240 | <para>
|
---|
241 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
242 | </para>
|
---|
243 |
|
---|
244 | <screen role="root"><userinput>ninja install</userinput></screen>
|
---|
245 | <!-- No longer needed as of systemd-244.
|
---|
246 | <para>
|
---|
247 | Remove a configuration file that causes some problems with PID files:
|
---|
248 | </para>
|
---|
249 |
|
---|
250 | <screen role="root"><userinput>rm -fv /etc/sysctl.d/50-pid-max.conf</userinput></screen>
|
---|
251 | -->
|
---|
252 | </sect2>
|
---|
253 |
|
---|
254 | <sect2 role="commands">
|
---|
255 | <title>Command Explanations</title>
|
---|
256 |
|
---|
257 | <!-- Not needed with the patch
|
---|
258 | <para>
|
---|
259 | <parameter>-Dc_args=-Wno-format-overflow</parameter>: Prevents an error
|
---|
260 | when building with <application>GCC 10</application>. The default is
|
---|
261 | <option>-Werror=format-overflow</option>,
|
---|
262 | which generates false positives. This switch may be used with previous
|
---|
263 | versions of GCC too.
|
---|
264 | </para>
|
---|
265 | -->
|
---|
266 |
|
---|
267 | <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
|
---|
268 | href="../../xincludes/meson-buildtype-release.xml"/>
|
---|
269 |
|
---|
270 | <para>
|
---|
271 | <parameter>-Dpamconfdir=/etc/pam.d</parameter>: Forces the PAM files to
|
---|
272 | be installed in /etc/pam.d rather than /usr/lib/pam.d.
|
---|
273 | </para>
|
---|
274 |
|
---|
275 | <para>
|
---|
276 | <parameter>-Duserdb=false</parameter>: Removes a daemon that does not
|
---|
277 | offer any use under a BLFS configuration. If you wish to enable the
|
---|
278 | <application>userdbd</application> daemon, replace "false" with "true"
|
---|
279 | in the above meson command.
|
---|
280 | </para>
|
---|
281 |
|
---|
282 | <para>
|
---|
283 | <parameter>-Dhomed=false</parameter>: Removes a daemon that does not offer
|
---|
284 | any use under a traditional BLFS configuration, especially using accounts
|
---|
285 | created with useradd. To enable systemd-homed, first ensure that you have
|
---|
286 | <xref linkend="cryptsetup"/> and <xref linkend="libpwquality"/>, and then
|
---|
287 | change "false" to "true" in the above meson command.
|
---|
288 | </para>
|
---|
289 |
|
---|
290 | <!-- EDITORS NOTE: Explanation on removing userdbd and homed:
|
---|
291 | In BLFS, we do not fully support disk encryption. We offer instructions for
|
---|
292 | building 'cryptsetup' as a dependency, but we do not offer instructions for
|
---|
293 | actually configuring it. In addition, we generally do not include
|
---|
294 | functionality that could potentially conflict with other packages, or that
|
---|
295 | is not of any use to us (in an enterprise configuration using Thin Clients
|
---|
296 | or laptops with LUKS encryption, it could make sense though, but that isn't
|
---|
297 | the configuration that we natively support).
|
---|
298 |
|
---|
299 | A few of the complications of systemd-homed include:
|
---|
300 | - SSH Logins
|
---|
301 | - Disk Space Assignments
|
---|
302 | - UID Assignments (chown() on login)
|
---|
303 | (See https://cfp.all-systems-go.io/media/homed-asg2019.pdf)
|
---|
304 |
|
---|
305 | In an article I read when systemd-homed was originally unveiled, I remember
|
---|
306 | reading about systemd-homed causing problems with OpenSSH Private Key Auth
|
---|
307 | because the user would have to login at the console in order to unlock
|
---|
308 | their home directory, thus allowing the private key to be unlocked and
|
---|
309 | processed by OpenSSH. Since BLFS does not fully support encrypted disks,
|
---|
310 | and because systemd-homed is incompatible with our usage of useradd /
|
---|
311 | traditional UNIX users and groups, I advise that we take the following
|
---|
312 | approach to avoid any confusion:
|
---|
313 |
|
---|
314 | - Leave the added Short Descriptions for homectl and userdbctl
|
---|
315 | - Add the above command explanations and restore the previous behavior
|
---|
316 |
|
---|
317 | Should we decide to enable homed by default anytime in the future,
|
---|
318 | let's move cryptsetup to recommended or required.
|
---|
319 |
|
---|
320 | I would be open to discussing this after the next systemd version when
|
---|
321 | systemd-homed has matured a bit more. -renodr -->
|
---|
322 |
|
---|
323 | </sect2>
|
---|
324 |
|
---|
325 | <sect2 role="configuration">
|
---|
326 | <title>Configuring systemd</title>
|
---|
327 |
|
---|
328 | <para>
|
---|
329 | The <filename>/etc/pam.d/system-session</filename> file needs to
|
---|
330 | be modified and a new file needs to be created in order for
|
---|
331 | <command>systemd-logind</command> to work correctly. Run the following
|
---|
332 | commands as the <systemitem class="username">root</systemitem> user:
|
---|
333 | </para>
|
---|
334 |
|
---|
335 | <screen role="root"><userinput>grep 'pam_systemd' /etc/pam.d/system-session ||
|
---|
336 | cat >> /etc/pam.d/system-session << "EOF"
|
---|
337 | <literal># Begin Systemd addition
|
---|
338 |
|
---|
339 | session required pam_loginuid.so
|
---|
340 | session optional pam_systemd.so
|
---|
341 |
|
---|
342 | # End Systemd addition</literal>
|
---|
343 | EOF
|
---|
344 |
|
---|
345 | cat > /etc/pam.d/systemd-user << "EOF"
|
---|
346 | <literal># Begin /etc/pam.d/systemd-user
|
---|
347 |
|
---|
348 | account required pam_access.so
|
---|
349 | account include system-account
|
---|
350 |
|
---|
351 | session required pam_env.so
|
---|
352 | session required pam_limits.so
|
---|
353 | session required pam_unix.so
|
---|
354 | session required pam_loginuid.so
|
---|
355 | session optional pam_keyinit.so force revoke
|
---|
356 | session optional pam_systemd.so
|
---|
357 |
|
---|
358 | auth required pam_deny.so
|
---|
359 | password required pam_deny.so
|
---|
360 |
|
---|
361 | # End /etc/pam.d/systemd-user</literal>
|
---|
362 | EOF</userinput></screen>
|
---|
363 |
|
---|
364 | <!--
|
---|
365 | <para>
|
---|
366 | At this point, you should reload the systemd daemon, and reenter
|
---|
367 | multi-user mode with the following commands (as the
|
---|
368 | <systemitem class="username">root</systemitem> user). If a desktop
|
---|
369 | manager is installed and you wish to reenter the graphical mode,
|
---|
370 | replace <userinput>multi-user.target</userinput> with
|
---|
371 | <userinput>graphical.target</userinput>:
|
---|
372 | </para>
|
---|
373 |
|
---|
374 | <screen role="root"><userinput>systemctl daemon-reexec
|
---|
375 | systemctl start multi-user.target</userinput></screen>-->
|
---|
376 |
|
---|
377 | <warning>
|
---|
378 | <para>
|
---|
379 | If upgrading from a previous version of systemd and an
|
---|
380 | initrd is used for system boot, you should generate a new initrd before
|
---|
381 | rebooting the system.
|
---|
382 | </para>
|
---|
383 | </warning>
|
---|
384 |
|
---|
385 | </sect2>
|
---|
386 |
|
---|
387 | <sect2 role="content">
|
---|
388 | <title>Contents</title>
|
---|
389 |
|
---|
390 | <para>
|
---|
391 | A list of the installed files, along with their short
|
---|
392 | descriptions can be found at
|
---|
393 | <ulink url="&lfs-root;/chapter08/systemd.html#contents-systemd"/>.
|
---|
394 | </para>
|
---|
395 |
|
---|
396 | <para>
|
---|
397 | Listed below are the newly installed libraries and directories
|
---|
398 | along with short descriptions.
|
---|
399 | </para>
|
---|
400 |
|
---|
401 | <segmentedlist>
|
---|
402 | <segtitle>Installed Programs</segtitle>
|
---|
403 | <segtitle>Installed Libraries</segtitle>
|
---|
404 | <segtitle>Installed Directories</segtitle>
|
---|
405 |
|
---|
406 | <seglistitem>
|
---|
407 | <seg>
|
---|
408 | <!-- maybe userdbd/userdbctl can go in LFS, try at next time -->
|
---|
409 | homectl (if <xref linkend="cryptsetup"/> is installed)
|
---|
410 | and userdbctl (optionally)
|
---|
411 | </seg>
|
---|
412 | <seg>
|
---|
413 | pam_systemd.so
|
---|
414 | (in <filename class="directory">/lib/security</filename>)
|
---|
415 | </seg>
|
---|
416 | <seg>
|
---|
417 | None
|
---|
418 | </seg>
|
---|
419 | </seglistitem>
|
---|
420 | </segmentedlist>
|
---|
421 |
|
---|
422 | <variablelist>
|
---|
423 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
424 | <?dbfo list-presentation="list"?>
|
---|
425 | <?dbhtml list-presentation="table"?>
|
---|
426 |
|
---|
427 | <varlistentry id="homectl">
|
---|
428 | <term><command>homectl</command></term>
|
---|
429 | <listitem>
|
---|
430 | <para>
|
---|
431 | is a tool to create, remove, change, or inspect a home directory
|
---|
432 | managed by <command>systemd-homed</command>; note that it's
|
---|
433 | useless for the classic UNIX users and home directories which
|
---|
434 | we are using in LFS/BLFS book
|
---|
435 | </para>
|
---|
436 | <indexterm zone="systemd homectl">
|
---|
437 | <primary sortas="b-homectl">homectl</primary>
|
---|
438 | </indexterm>
|
---|
439 | </listitem>
|
---|
440 | </varlistentry>
|
---|
441 |
|
---|
442 | <varlistentry id="userdbctl">
|
---|
443 | <term><command>userdbctl</command></term>
|
---|
444 | <listitem>
|
---|
445 | <para>
|
---|
446 | inspects users, groups, and group memberships
|
---|
447 | </para>
|
---|
448 | <indexterm zone="systemd userdbctl">
|
---|
449 | <primary sortas="b-userdbctl">userdbctl</primary>
|
---|
450 | </indexterm>
|
---|
451 | </listitem>
|
---|
452 | </varlistentry>
|
---|
453 |
|
---|
454 | <varlistentry id="pam_systemd">
|
---|
455 | <term><filename class="libraryfile">pam_systemd.so</filename></term>
|
---|
456 | <listitem>
|
---|
457 | <para>
|
---|
458 | is a PAM module used to register user sessions with the
|
---|
459 | <application>systemd</application> login manager,
|
---|
460 | <command>systemd-logind</command>
|
---|
461 | </para>
|
---|
462 | <indexterm zone="systemd pam_systemd">
|
---|
463 | <primary sortas="c-pam_systemd">pam_systemd.so</primary>
|
---|
464 | </indexterm>
|
---|
465 | </listitem>
|
---|
466 | </varlistentry>
|
---|
467 |
|
---|
468 | </variablelist>
|
---|
469 |
|
---|
470 | </sect2>
|
---|
471 |
|
---|
472 | </sect1>
|
---|