Systemd-229

Introduction to systemd

Even though systemd was built in LFS, there are some features provided by the package that some BLFS packages need, but their dependencies didn't fit into LFS.

The main reason why systemd needs to be rebuilt is that some packages expect working systemd-logind service which requires a PAM module from the systemd source that couldn't be built in LFS.

This package is known to build and work properly using an LFS-systemd platform using systemd-229 source.

Package Information

systemd Dependencies

Required

Linux-PAM-1.2.1

Recommended Runtime Dependency

Optional

Certificate Authority Certificates, cURL-7.47.1, elfutils-0.165, GnuTLS-3.4.9, Iptables-1.6.0, libgcrypt-1.6.5, libidn-1.32, libxkbcommon-0.5.0, Python-2.7.11 or Python-3.5.1, qemu-2.5.0, Valgrind-3.11.0, cryptsetup, gnu-efi, kexec-tools, libmicrohttpd, libseccomp, lxml (Python Module), lz4, qrencode, quota-tools and Sphinx

[Note]

Note

In order to build the systemd Python module, 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.28

User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/systemd

Installation of systemd

First, apply the required patch:

patch -Np1 -i ../systemd-229-compat-1.patch &&
autoreconf -fi

Disable two tests that always fail:

sed -e 's:test/udev-test.pl ::g'  \
    -e 's:test-copy$(EXEEXT) ::g' \
    -i Makefile.in

Rebuild systemd by running the following commands:

cc_cv_CFLAGS__flto=no              \
./configure --prefix=/usr          \
            --sysconfdir=/etc      \
            --localstatedir=/var   \
            --with-rootprefix=     \
            --with-rootlibdir=/lib \
            --enable-split-usr     \
            --disable-firstboot    \
            --disable-ldconfig     \
            --disable-sysusers     \
            --without-python       \
            --docdir=/usr/share/doc/systemd-229 &&
make
[Note]

Note

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.

[Warning]

Warning

Installing the package will override all files installed by systemd in LFS. It is critical that nothing uses either systemd or Udev libraries or programs during the installation phrase. Best way to achieve that is to do the installation in the rescue mode. To switch to the rescue mode, issue the following command as the root user from a TTY:

systemctl start rescue.target

Now, as the root user:

make install

Move 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. To accomplish that, run the following commands as the root user:

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

# End Systemd addition
EOF

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

account  required pam_access.so
account  include  system-account

session  required pam_env.so
session  required pam_limits.so
session  include  system-session

auth     required pam_deny.so
password required pam_deny.so

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

At this point it would be a nice idea to reboot to test if the reinstallation was successful.

Contents

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

Below are listed newly installed libraries and directories along with short descriptions.

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

Short Descriptions

pam_systemd.so

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

Last updated on 2016-02-13 02:21:51 -0600