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