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.

本パッケージは LFS-10.0 において正しくビルドでき動作することが確認されています。

Package Information

systemd Dependencies



Recommended Runtime Dependencies


btrfs-progs-5.7 cURL-7.71.1, cryptsetup-2.3.3, git-2.28.0, GnuTLS-3.6.14, iptables-1.8.5, libgcrypt-1.8.6, libidn2-2.3.0, libpwquality-1.4.2, libseccomp-2.5.0, libxkbcommon-0.10.0, make-ca-1.7, pcre2-10.35, qemu-5.1.0, Valgrind-3.16.1, zsh-5.8 (for the zsh completions), gnu-efi, kexec-tools, libmicrohttpd, lz4, qrencode, quota-tools and Sphinx

Optional (to rebuild the manual pages)

docbook-xml-4.5, docbook-xsl-1.79.2, libxslt-1.1.34, and lxml-4.5.2 (to build the index of systemd manual pages)

User Notes:

Installation of systemd

Remove an unneeded group, render, from the default udev rules:

sed -i 's/GROUP="render", //' rules.d/

Rebuild systemd by running the following commands:

mkdir build &&
cd    build &&

meson --prefix=/usr                 \
      --sysconfdir=/etc             \
      --localstatedir=/var          \
      -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                \
      -Ddocdir=/usr/share/doc/systemd-246 \
      ..                            &&



For the best test 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: ninja test.

Now, as the root user:

ninja install

Command Explanations

-Duserdb=false: Removes a daemon that does not offer any use under a BLFS configuration. If you wish to enable the userdbd daemon, replace "false" with "true" in the above meson command.

-Dhomed=false: 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 cryptsetup-2.3.3 and libpwquality-1.4.2, and then change "false" to "true" in the above meson command.

Configuring systemd

The /etc/pam.d/system-session 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  required
session  required
session  optional force revoke
session  optional

auth     required
password required

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


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

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

Installed Programs: homectl (if cryptsetup-2.3.3 is installed) and userdbctl (optionally)
Installed Libraries: (in /lib/security)
Installed Directories: None

Short Descriptions


is a tool to create, remove, change, or inspect a home directory managed by systemd-homed; note that it's useless for the classic UNIX users and home directories which we are using in LFS/BLFS book


inspects users, groups, and group memberships

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

最終更新日: 2020-08-21 21:19:40 +0900