Introduction to systemd

While systemd was installed when building LFS, there are many features provided by the package that were not included in the initial installation because Linux-PAM was not yet installed. The systemd package needs to be rebuilt to provide a working systemd-logind service, which provides many additional features for dependent packages.

This package is known to build and work properly using an LFS-7.10 platform.

Package Information

systemd Dependencies



Recommended Runtime Dependency


Certificate Authority Certificates, cURL-7.50.1, elfutils-0.167, GnuTLS-3.5.3, Iptables-1.6.0, libgcrypt-1.7.3, libidn-1.33, libxkbcommon-0.6.1, Python-2.7.12 or Python-3.5.2, qemu-2.6.1, Valgrind-3.11.0, zsh-5.2 (for the zsh completions), cryptsetup, gnu-efi, kexec-tools, libmicrohttpd, libseccomp, lxml (Python Module), lz4, qrencode, quota-tools and Sphinx



In order to build the systemd Python module, the lxml package needs to be installed for the corresponding Python version (2 or 3). Note that configure defaults to Python 2. In order to build the module for Python 3, make sure you pass the PYTHON=python3 environment variable to the configure command below.

Optional (to rebuild the manual pages)

docbook-xml-4.5, docbook-xsl-1.79.1 and libxslt-1.1.29

User Notes:

Installation of systemd

Disable two tests that always fail:

sed -e 's:test/ ::g'  \
    -e 's:test-copy$(EXEEXT) ::g' \

Rebuild systemd by running the following commands:

cc_cv_CFLAGS__flto=no               \
XSLTPROC="/usr/bin/xsltproc"         \
./configure --prefix=/usr            \
            --sysconfdir=/etc        \
            --localstatedir=/var     \
            --with-rootprefix=       \
            --with-rootlibdir=/lib   \
            --enable-split-usr       \
            --disable-firstboot      \
            --disable-ldconfig       \
            --disable-sysusers       \
            --without-python         \
            --with-default-dnssec=no \
            --docdir=/usr/share/doc/systemd-231 &&


For the best results, make sure you run the testsuite from a system that is booted by the same systemd version you are rebuilding.

To test the results, issue: make -k check.



Installing the package will overwrite all files installed by systemd in LFS. It is critical that nothing uses either systemd or Udev 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 root user (from a TTY):

systemctl start

Now, as the root user:

make install

Move the NSS libraries to /lib by running the following command as the root user:

mv -v /usr/lib/libnss_{myhostname,mymachines,resolve}.so.2 /lib

Remove an unnecessary directory by running the following command as the root user:

rm -rfv /usr/lib/rpm

Configuring systemd

The /etc/pam.d/system-sesion file needs to be modified and a new file needs to be created in order for systemd-logind to work correctly. Run the following commands as the root user:

cat >> /etc/pam.d/system-session << "EOF"
# Begin Systemd addition
session   required
session   optional

# End Systemd addition

cat > /etc/pam.d/systemd-user << "EOF"
# Begin /etc/pam.d/systemd-user

account  required
account  include  system-account

session  required
session  required
session  include  system-session

auth     required
password required

# End /etc/pam.d/systemd-user

At this point, you should reload the systemd daemon, and reenter multi-user mode with the following commands (as the root user):

systemctl daemon-reload
systemctl start


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.


A list of the installed files, along with their short descriptions can be found at ../../../../lfs/view/7.10/chapter06/systemd.html#contents-systemd.

Listed below are the newly installed libraries and directories along with short descriptions.

Installed Programs: None
Installed Libraries: (in /lib/security)
Installed Directories: None

Short Descriptions

is a PAM module used to register user sessions with the systemd login manager, systemd-logind.

Last updated on 2016-08-28 02:28:15 -0700