%general-entities; ]> Systemd-&systemd-version; systemd 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. &lfs113_checked; Package Information Download (HTTP): Download (FTP): Download MD5 sum: &systemd-md5sum; Download size: &systemd-size; Estimated disk space required: &systemd-buildsize; Estimated build time: &systemd-time; systemd Dependencies Recommended is not strictly required to build systemd, but the main reason to rebuild systemd in BLFS (it's already built in LFS anyway) is for the systemd-logind daemon and the pam_systemd.so PAM module. is required for them. All packages in BLFS book with a dependency on systemd expects it has been rebuilt with . and (runtime) Optional , , , , , , , , , , , , , , , , , , , (for the zsh completions), gnu-efi, kexec-tools, libbpf, libdw, libfido2, libmicrohttpd, lz4, quota-tools, and tpm2-tss Optional (to rebuild the manual pages) , , , and (to build the index of systemd manual pages) Installation of systemd Remove several inappropriate uses of the pure attribute that cause runtime issues when the package is built with gcc-13 or later: sed '/bus_message_type_from_string/s/_pure_//' \ -i src/libsystemd/sd-bus/bus-internal.h && sed '/devt_hash_func/s/_pure_//' \ -i src/basic/hash-funcs.h && sed '/job_get_timeout/s/_pure_//' \ -i src/core/job.h Remove two unneeded groups, render and sgx, from the default udev rules: sed -i -e 's/GROUP="render"/GROUP="video"/' \ -e 's/GROUP="sgx", //' rules.d/50-udev-default.rules.in Rebuild systemd by running the following commands: mkdir build && cd build && meson setup .. \ --prefix=/usr \ --buildtype=release \ -Ddefault-dnssec=no \ -Dfirstboot=false \ -Dinstall-tests=false \ -Dldconfig=false \ -Dman=auto \ -Dsysusers=false \ -Drpmmacrosdir=no \ -Dhomed=false \ -Duserdb=false \ -Dmode=release \ -Dpam=true \ -Dpamconfdir=/etc/pam.d \ -Ddev-kvm-mode=0660 \ -Ddocdir=/usr/share/doc/systemd-&systemd-version; && ninja For the best test results, make sure you run the test suite from a system that is booted by the same systemd version you are rebuilding. To test the results, issue: ninja test. The test named test-stat-util and test-netlink are known to fail if some kernel features are not enabled. If the test suite is ran as the &root; user, some other tests may fail because they depend on various kernel configuration options. Now, as the root user: ninja install Command Explanations -Dpamconfdir=/etc/pam.d: Forces the PAM files to be installed in /etc/pam.d rather than /usr/lib/pam.d. -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: Removes 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 and installed, 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: grep 'pam_systemd' /etc/pam.d/system-session || 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 required pam_unix.so session required pam_loginuid.so session optional pam_keyinit.so force revoke session optional pam_systemd.so auth required pam_deny.so password required pam_deny.so # End /etc/pam.d/systemd-user EOF 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. Contents A list of the installed files, along with their short descriptions can be found at . Listed below are the newly installed programs along with short descriptions. Installed Programs homectl (optional), systemd-cryptenroll (if is installed), and userdbctl (optional) Short Descriptions homectl 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 homectl systemd-cryptenroll Is used to enroll or remove a system from full disk encryption, as well as set and query private keys and recovery keys systemd-cryptenroll userdbctl inspects users, groups, and group memberships userdbctl pam_systemd.so is a PAM module used to register user sessions with the systemd login manager, systemd-logind pam_systemd.so