2016-06-02 13:39:31 +08:00
<?xml version="1.0" encoding="ISO-8859-1"?>
< !DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../../general.ent">
%general-entities;
2018-12-29 06:18:36 +08:00
<!-- <!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 -->
<!ENTITY systemd-download-http "https://github.com/systemd/systemd/archive/v&systemd-version;/systemd-&systemd-version;.tar.gz">
2016-06-02 13:39:31 +08:00
<!ENTITY systemd-download-ftp " ">
2020-12-06 03:29:55 +08:00
<!ENTITY systemd-md5sum "b0d6e603b814908acc69db29bbfb023c">
<!ENTITY systemd-size "9.4 MB">
<!ENTITY systemd-buildsize "273 MB (with tests)">
<!ENTITY systemd-time "2.1 SBU (with tests)">
2016-06-02 13:39:31 +08:00
]>
2018-12-29 06:18:36 +08:00
<sect1 id= "systemd" xreflabel= "Systemd-&systemd-version;" revision= "systemd" >
2016-06-02 13:39:31 +08:00
<?dbhtml filename="systemd.html"?>
<sect1info >
<othername > $LastChangedBy$</othername>
<date > $Date$</date>
</sect1info>
2018-12-29 06:18:36 +08:00
<title > Systemd-&systemd-version; </title>
<!-- Whenever we switch back to stable backports, make sure to add the systemd - stable reference back. -->
2016-06-02 13:39:31 +08:00
<indexterm zone= "systemd" >
<primary sortas= "a-systemd" > systemd</primary>
</indexterm>
<sect2 role= "package" >
<title > Introduction to systemd</title>
<para >
While <application > systemd</application> was installed when
building LFS, there are many features provided by the package that
2016-08-28 17:28:15 +08:00
were not included in the initial installation because
2016-06-02 13:39:31 +08:00
<application > Linux-PAM</application> was not yet installed.
The <application > systemd</application> package needs to be
rebuilt to provide a working <command > systemd-logind</command> service,
2016-08-28 17:28:15 +08:00
which provides many additional features for dependent packages.
2016-06-02 13:39:31 +08:00
</para>
2020-08-18 12:24:30 +08:00
&lfs10_checked;
2016-06-02 13:39:31 +08:00
<bridgehead renderas= "sect3" > Package Information</bridgehead>
<itemizedlist spacing= "compact" >
<listitem >
2020-03-19 18:00:16 +08:00
<para >
Download (HTTP): <ulink url= "&systemd-download-http;" />
</para>
2016-06-02 13:39:31 +08:00
</listitem>
<listitem >
2020-03-19 18:00:16 +08:00
<para >
Download (FTP): <ulink url= "&systemd-download-ftp;" />
</para>
2016-06-02 13:39:31 +08:00
</listitem>
<listitem >
2020-03-19 18:00:16 +08:00
<para >
Download MD5 sum: &systemd-md5sum;
</para>
2016-06-02 13:39:31 +08:00
</listitem>
<listitem >
2020-03-19 18:00:16 +08:00
<para >
Download size: &systemd-size;
</para>
2016-06-02 13:39:31 +08:00
</listitem>
<listitem >
2020-03-19 18:00:16 +08:00
<para >
Estimated disk space required: &systemd-buildsize;
</para>
2016-06-02 13:39:31 +08:00
</listitem>
<listitem >
2020-03-19 18:00:16 +08:00
<para >
Estimated build time: &systemd-time;
</para>
2016-06-02 13:39:31 +08:00
</listitem>
</itemizedlist>
2020-03-20 10:02:29 +08:00
2019-01-12 01:05:56 +08:00
<bridgehead renderas= "sect3" > Additional Downloads</bridgehead>
<itemizedlist spacing= "compact" >
<listitem >
<para >
Required patch:
2020-12-06 03:29:55 +08:00
<ulink url= "&patch-root;/systemd-&systemd-version;-upstream_fixes-1.patch" />
2019-01-12 01:05:56 +08:00
</para>
</listitem>
</itemizedlist>
2020-03-20 10:02:29 +08:00
2016-06-02 13:39:31 +08:00
<bridgehead renderas= "sect3" > systemd Dependencies</bridgehead>
<bridgehead renderas= "sect4" > Required</bridgehead>
<para role= "required" >
<xref linkend= "linux-pam" />
</para>
2017-07-12 02:43:32 +08:00
<bridgehead renderas= "sect4" > Recommended Runtime Dependencies</bridgehead>
2016-06-02 13:39:31 +08:00
<para role= "recommended" >
2017-10-16 02:23:25 +08:00
<xref role= "runtime" linkend= "polkit" />
2016-06-02 13:39:31 +08:00
</para>
<bridgehead renderas= "sect4" > Optional</bridgehead>
<para role= "optional" >
2020-03-21 12:35:03 +08:00
<xref linkend= "btrfs-progs" /> <!-- homed may support it, see the C.E. -->
2016-06-02 13:39:31 +08:00
<xref linkend= "curl" /> ,
2018-12-01 06:22:17 +08:00
<xref linkend= "cryptsetup" /> ,
2018-08-11 04:58:19 +08:00
<xref linkend= "git" /> ,
2016-06-02 13:39:31 +08:00
<xref linkend= "gnutls" /> ,
<xref linkend= "iptables" /> ,
<xref linkend= "libgcrypt" /> ,
2017-09-19 03:32:04 +08:00
<xref linkend= "libidn2" /> ,
2020-03-20 10:02:29 +08:00
<xref linkend= "libpwquality" /> ,
2017-09-30 16:46:14 +08:00
<xref linkend= "libseccomp" /> ,
2016-06-02 13:39:31 +08:00
<xref linkend= "libxkbcommon" /> ,
2018-12-01 06:22:17 +08:00
<xref linkend= "make-ca" /> ,
2019-10-10 11:19:42 +08:00
<xref linkend= "pcre2" /> ,
2016-06-02 13:39:31 +08:00
<xref linkend= "qemu" /> ,
<xref linkend= "valgrind" /> ,
2016-08-12 10:11:43 +08:00
<xref linkend= "zsh" /> (for the zsh completions),
2016-06-02 13:39:31 +08:00
<ulink url= "http://sourceforge.net/projects/gnu-efi/" > gnu-efi</ulink> ,
<ulink url= "https://www.kernel.org/pub/linux/utils/kernel/kexec/" > kexec-tools</ulink> ,
2020-12-06 03:29:55 +08:00
<ulink url= "https://developers.yubico.com/libfido2/" > libfido2</ulink> ,
2016-06-02 13:39:31 +08:00
<ulink url= "https://www.gnu.org/software/libmicrohttpd/" > libmicrohttpd</ulink> ,
2017-03-10 11:08:07 +08:00
<ulink url= "http://lz4.github.io/lz4/" > lz4</ulink> ,
2016-06-02 13:39:31 +08:00
<ulink url= "http://fukuchi.org/works/qrencode/" > qrencode</ulink> ,
<ulink url= "http://sourceforge.net/projects/linuxquota/" > quota-tools</ulink> and
<ulink url= "https://pypi.python.org/pypi/Sphinx" > Sphinx</ulink>
</para>
<bridgehead renderas= "sect4" > Optional (to rebuild the manual pages)</bridgehead>
<para role= "optional" >
<xref linkend= "DocBook" /> ,
2019-01-21 03:51:28 +08:00
<xref linkend= "docbook-xsl" /> ,
<xref linkend= "libxslt" /> , and
<xref linkend= "lxml" /> (to build the index of systemd manual pages)
2016-06-02 13:39:31 +08:00
</para>
<para condition= "html" role= "usernotes" > User Notes:
<ulink url= "&blfs-wiki;/systemd" />
</para>
</sect2>
<sect2 role= "installation" >
<title > Installation of systemd</title>
2020-08-12 08:55:24 +08:00
2020-03-19 18:00:16 +08:00
<para >
2020-12-06 03:29:55 +08:00
Apply a patch to fix regressions in systemd-networkd and segmentation
faults in systemctl:
2020-03-19 18:00:16 +08:00
</para>
2019-08-08 21:50:26 +08:00
2020-12-06 03:29:55 +08:00
<screen > <userinput remap= "pre" > patch -Np1 -i ../systemd-&systemd-version; -upstream_fixes-1.patch</userinput> </screen>
2020-01-07 07:16:28 +08:00
2020-03-19 18:00:16 +08:00
<para >
Remove an unneeded group,
<systemitem class= "groupname" > render</systemitem> , from the default udev
rules:
</para>
2017-12-22 14:54:12 +08:00
2019-12-06 02:46:53 +08:00
<screen > <userinput remap= "pre" > sed -i 's/GROUP="render", //' rules.d/50-udev-default.rules.in</userinput> </screen>
2017-12-22 14:54:12 +08:00
2016-06-02 13:39:31 +08:00
<para >
Rebuild <application > systemd</application> by running the
following commands:
</para>
2018-04-02 01:51:19 +08:00
<screen > <userinput > mkdir build & &
cd build & &
2020-05-10 04:50:03 +08:00
meson --prefix=/usr \
-Dblkid=true \
-Dbuildtype=release \
-Ddefault-dnssec=no \
-Dfirstboot=false \
-Dinstall-tests=false \
-Dldconfig=false \
-Dman=auto \
-Drootprefix= \
-Drootlibdir=/lib \
-Dsplit-usr=true \
-Dsysusers=false \
-Drpmmacrosdir=no \
-Db_lto=false \
-Dhomed=false \
-Duserdb=false \
2020-12-06 03:29:55 +08:00
-Dmode=release \
-Dpamconfdir=/etc/pam.d \
2020-08-20 02:09:48 +08:00
-Ddocdir=/usr/share/doc/systemd-&systemd-version; \
2020-05-10 04:50:03 +08:00
.. & &
2018-04-02 01:51:19 +08:00
2017-10-08 10:08:26 +08:00
ninja</userinput> </screen>
2020-03-21 12:35:03 +08:00
<!-- Regarding homed and userdb, see the note below in Command Explanations -->
2016-06-02 13:39:31 +08:00
<note >
<para >
2018-04-02 01:51:19 +08:00
For the best test results, make sure you run the testsuite from
2016-06-02 13:39:31 +08:00
a system that is booted by the same
<application > systemd</application> version you are rebuilding.
</para>
</note>
<para >
2020-03-19 18:00:16 +08:00
To test the results, issue: <command > ninja test</command> . <!-- One test,
<filename > udev-test</filename> (test 273) fails due to changes in
the Linux 5.3+ kernel. It does not affect the package's
functionality. NO LONGER APPLICABLE AS OF 244 -->
2016-06-02 13:39:31 +08:00
</para>
2020-04-04 02:04:47 +08:00
<!--
2016-06-02 13:39:31 +08:00
<warning >
<para >
Installing the package will overwrite all files installed by
<application > systemd</application> in LFS. It is critical that
nothing uses either <application > systemd</application> or
<application > Udev</application> libraries during the installation.
The best way to ensure that these libraries are not being used is to
run the installation in rescue mode. To switch to rescue mode,
run the following command as the
<systemitem class= "username" > root</systemitem> user (from a TTY):
</para>
2020-03-14 13:25:02 +08:00
<screen role= "root" > <userinput > systemctl isolate rescue.target</userinput> </screen>
2016-06-02 13:39:31 +08:00
</warning>
2020-04-04 02:04:47 +08:00
Nobody has reported problems with this in years. Let's comment it. -->
2016-06-02 13:39:31 +08:00
<para >
Now, as the <systemitem class= "username" > root</systemitem> user:
</para>
2017-10-08 10:08:26 +08:00
<screen role= "root" > <userinput > ninja install</userinput> </screen>
2020-01-24 10:17:29 +08:00
<!-- No longer needed as of systemd - 244.
2020-03-19 18:00:16 +08:00
<para >
Remove a configuration file that causes some problems with PID files:
</para>
2019-10-09 01:35:35 +08:00
<screen role= "root" > <userinput > rm -fv /etc/sysctl.d/50-pid-max.conf</userinput> </screen>
2020-01-24 10:17:29 +08:00
-->
2016-06-02 13:39:31 +08:00
</sect2>
2020-03-21 12:35:03 +08:00
<sect2 role= "commands" >
<title > Command Explanations</title>
2020-06-04 10:35:17 +08:00
<!-- Not needed with the patch
2020-05-10 04:50:03 +08:00
<para >
<parameter > -Dc_args=-Wno-format-overflow</parameter> : Prevents an error
when building with <application > GCC 10</application> . The default is
<option > -Werror=format-overflow</option> ,
which generates false positives. This switch may be used with previous
versions of GCC too.
</para>
2020-06-04 10:35:17 +08:00
-->
2020-05-10 04:50:03 +08:00
2020-12-06 03:29:55 +08:00
<para >
<parameter > -Dpamconfdir=/etc/pam.d</parameter> : Forces the PAM files to
be installed in /etc/pam.d rather than /usr/lib/pam.d.
</para>
2020-03-21 12:35:03 +08:00
<para >
<parameter > -Duserdb=false</parameter> : Removes a daemon that does not
offer any use under a BLFS configuration. If you wish to enable the
<application > userdbd</application> daemon, replace "false" with "true"
in the above meson command.
</para>
<para >
<parameter > -Dhomed=false</parameter> : Remove a daemon that does not offer
any use under a traditional BLFS configuration, especially using accounts
created with useradd. To enable systemd-homed, first ensure that you have
<xref linkend= "cryptsetup" /> and <xref linkend= "libpwquality" /> , and then
change "false" to "true" in the above meson command.
</para>
<!-- EDITORS NOTE: Explanation on removing userdbd and homed:
In BLFS, we do not fully support disk encryption. We offer instructions for
building 'cryptsetup' as a dependency, but we do not offer instructions for
actually configuring it. In addition, we generally do not include
functionality that could potentially conflict with other packages, or that
is not of any use to us (in an enterprise configuration using Thin Clients
or laptops with LUKS encryption, it could make sense though, but that isn't
the configuration that we natively support).
A few of the complications of systemd-homed include:
- SSH Logins
- Disk Space Assignments
- UID Assignments (chown() on login)
(See https://cfp.all-systems-go.io/media/homed-asg2019.pdf)
In an article I read when systemd-homed was originally unveiled, I remember
reading about systemd-homed causing problems with OpenSSH Private Key Auth
because the user would have to login at the console in order to unlock
their home directory, thus allowing the private key to be unlocked and
processed by OpenSSH. Since BLFS does not fully support encrypted disks,
and because systemd-homed is incompatible with our usage of useradd /
traditional UNIX users and groups, I advise that we take the following
approach to avoid any confusion:
- Leave the added Short Descriptions for homectl and userdbctl
- Add the above command explanations and restore the previous behavior
Should we decide to enable homed by default anytime in the future,
let's move cryptsetup to recommended or required.
I would be open to discussing this after the next systemd version when
systemd-homed has matured a bit more. -renodr -->
</sect2>
2016-06-02 13:39:31 +08:00
<sect2 role= "configuration" >
<title > Configuring systemd</title>
<para >
2017-04-05 22:05:08 +08:00
The <filename > /etc/pam.d/system-session</filename> file needs to
2016-06-02 13:39:31 +08:00
be modified and a new file needs to be created in order for
<command > systemd-logind</command> to work correctly. Run the following
commands as the <systemitem class= "username" > root</systemitem> user:
</para>
<screen role= "root" > <userinput > cat > > /etc/pam.d/system-session < < "EOF"
<literal > # Begin Systemd addition
2018-12-14 15:32:06 +08:00
session required pam_loginuid.so
session optional pam_systemd.so
2016-06-02 13:39:31 +08:00
# End Systemd addition</literal>
EOF
cat > /etc/pam.d/systemd-user < < "EOF"
<literal > # Begin /etc/pam.d/systemd-user
2018-12-14 15:32:06 +08:00
account required pam_access.so
account include system-account
2016-06-02 13:39:31 +08:00
2018-12-14 15:32:06 +08:00
session required pam_env.so
session required pam_limits.so
session required pam_unix.so
session required pam_loginuid.so
session optional pam_keyinit.so force revoke
session optional pam_systemd.so
2016-06-02 13:39:31 +08:00
2018-12-14 15:32:06 +08:00
auth required pam_deny.so
password required pam_deny.so
2016-06-02 13:39:31 +08:00
# End /etc/pam.d/systemd-user</literal>
EOF</userinput> </screen>
2020-04-04 02:04:47 +08:00
<!--
2016-06-02 13:39:31 +08:00
<para >
At this point, you should reload the systemd daemon, and reenter
multi-user mode with the following commands (as the
2020-03-14 13:25:02 +08:00
<systemitem class= "username" > root</systemitem> user). If a desktop
manager is installed and you wish to reenter the graphical mode,
replace <userinput > multi-user.target</userinput> with
<userinput > graphical.target</userinput> :
2016-06-02 13:39:31 +08:00
</para>
2020-03-14 13:25:02 +08:00
<screen role= "root" > <userinput > systemctl daemon-reexec
2020-04-04 02:04:47 +08:00
systemctl start multi-user.target</userinput> </screen> -->
2016-06-02 13:39:31 +08:00
2020-03-19 18:00:16 +08:00
<warning >
<para >
If upgrading from a previous version of systemd and an
initrd is used for system boot, you should generate a new initrd before
rebooting the system.
</para>
</warning>
2016-06-02 13:39:31 +08:00
</sect2>
<sect2 role= "content" >
<title > Contents</title>
<para >
A list of the installed files, along with their short
descriptions can be found at
2020-08-21 20:19:40 +08:00
<ulink url= "&lfs-root;/chapter08/systemd.html#contents-systemd" /> .
2016-06-02 13:39:31 +08:00
</para>
<para >
Listed below are the newly installed libraries and directories
along with short descriptions.
</para>
<segmentedlist >
<segtitle > Installed Programs</segtitle>
<segtitle > Installed Libraries</segtitle>
<segtitle > Installed Directories</segtitle>
<seglistitem >
<seg >
2020-03-20 10:45:12 +08:00
<!-- maybe userdbd/userdbctl can go in LFS, try at next time -->
homectl (if <xref linkend= "cryptsetup" /> is installed)
2020-03-21 12:35:03 +08:00
and userdbctl (optionally)
2016-06-02 13:39:31 +08:00
</seg>
<seg >
pam_systemd.so
(in <filename class= "directory" > /lib/security</filename> )
</seg>
<seg >
None
</seg>
</seglistitem>
</segmentedlist>
<variablelist >
<bridgehead renderas= "sect3" > Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
2020-03-20 10:45:12 +08:00
<varlistentry id= "homectl" >
<term > <command > homectl</command> </term>
<listitem >
<para >
is a tool to create, remove, change, or inspect a home directory
managed by <command > systemd-homed</command> ; note that it's
useless for the classic UNIX users and home directories which
we are using in LFS/BLFS book
</para>
<indexterm zone= "systemd homectl" >
<primary sortas= "b-homectl" > homectl</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id= "userdbctl" >
<term > <command > userdbctl</command> </term>
<listitem >
<para >
2020-08-12 08:55:24 +08:00
inspects users, groups, and group memberships
2020-03-20 10:45:12 +08:00
</para>
<indexterm zone= "systemd userdbctl" >
<primary sortas= "b-userdbctl" > userdbctl</primary>
</indexterm>
</listitem>
</varlistentry>
2016-06-02 13:39:31 +08:00
<varlistentry id= "pam_systemd" >
<term > <filename class= "libraryfile" > pam_systemd.so</filename> </term>
<listitem >
<para >
is a PAM module used to register user sessions with the
<application > systemd</application> login manager,
<command > systemd-logind</command> .
</para>
<indexterm zone= "systemd pam_systemd" >
<primary sortas= "c-pam_systemd" > pam_systemd.so</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>