10.64. Systemd-213

The systemd package is a system and service manager for Linux operating systems.

10.64.1. Installation of Systemd

Systemd 209 merged several libraries into libsystemd, but some packages that use systemd still expect those separate libraries. Apply a patch to allow backwards compatibility with these packages by installing Pkg-config files for the old libraries:

patch -Np1 -i ../systemd-213-compat-1.patch

Prevent the Makefile from trying to run setcap on systemd-detect-virt, which will fail if the kernel or file system does not support extended capabilities:

sed -i '/virt-install-hook /d' Makefile.in

The timesyncd.conf file contains a reference to a non-existent timesyncd.conf(5) man page. Remove that reference to avoid possible confusion:

sed -i '/timesyncd.conf/d' src/timesync/timesyncd.conf.in

By default, systemd-fsck will run /sbin/fsck with the -l option, which applies an flock on the file system being checked. This can conflict with an flock that systemd itself puts on the file system, which could result in problems booting. fsck will be fixed to avoid this problem in a future release of Util-linux, but for now we will work around the issue by simply preventing systemd-fsck from using -l:

sed -i '/-l/d' src/fsck/fsck.c

Prepare systemd for compilation:

./configure --prefix=/usr \
    --sysconfdir=/etc --localstatedir=/var \
    --libexecdir=/usr/lib --docdir=/usr/share/doc/systemd-213 \
    --with-rootprefix="" --with-rootlibdir=/lib \
    --enable-split-usr --disable-gudev --with-kbd-loadkeys=/bin/loadkeys \
    --with-kbd-setfont=/bin/setfont --with-dbuspolicydir=/etc/dbus-1/system.d \
    --with-dbusinterfacedir=/usr/share/dbus-1/interfaces \
    --with-dbussessionservicedir=/usr/share/dbus-1/services \
    --with-dbussystemservicedir=/usr/share/dbus-1/system-services \
    cc_cv_CFLAGS__flto=no

The meaning of the configure options:

--with-root*

These switches ensure that core programs and shared libraries are installed in the subdirectories of the root partition.

--enable-split-usr

This switch ensures that systemd will work on systems where /bin, /lib and /sbin directories are not symlinks to their /usr counterparts.

--disable-gudev

This switch prevents systemd from building libgudev as it requires Glib, which is not installed in CLFS.

--with-dbus*

These switches ensure that D-Bus configuration files get installed to the correct locations.

cc_cv_CFLAGS__flto=no

This prevents the build system from using GCC's Link-time optimization (LTO), to ensure that systemd's binaries will not try to link to libgcc_s.

Compile the package:

make

Prevent a broken test case from running:

sed -e "s:test/udev-test.pl::g" \
    -e "s:test-bus-cleanup\$(EXEEXT) ::g" \
    -e "s:test-bus-gvariant\$(EXEEXT) ::g" \
    -i Makefile

To test the results, issue:

make check

Install the package:

make install

Install documentation files that are not installed by default:

install -v -m644 man/*.html /usr/share/doc/systemd-213

Move the nss_myhostname library to /lib:

mv -v /usr/lib/libnss_myhostname.so.2 /lib

Remove an unnecessary directory:

rm -rfv /usr/lib/rpm

Create symlinks for backwards-compatibility with Sysvinit:

for tool in runlevel reboot shutdown poweroff halt telinit; do
  ln -sfv ../bin/systemctl /sbin/$tool
done
ln -sfv ../lib/systemd/systemd /sbin/init

Modify a configuration file which references a group that doesn't exist:

sed -i "s@root lock@root root@g" /usr/lib/tmpfiles.d/legacy.conf

10.64.2. Configuring Systemd

Create /etc/machine-id which is needed by Journald:

systemd-machine-id-setup

Create a file to identify the operating system. systemd will use this file on boot to put information on the screen.

cat > /etc/os-release << "EOF"
# Begin /etc/os-release

NAME=Cross-LFS
ID=clfs

PRETTY_NAME=Cross Linux From Scratch
ANSI_COLOR=0;33

VERSION=3.0.0-SYSTEMD
VERSION_ID=20141018

# End /etc/os-release
EOF

10.64.3. Contents of Systemd

Installed programs: bootctl, busctl, halt (link to systemctl), hostnamectl, init (link to systemd), journalctl, kernel-install, localectl, loginctl, machinectl, poweroff (link to systemctl), reboot (link to systemctl), runlevel (link to systemctl), shutdown (link to systemctl), systemctl, systemd, system-analyze, systemd-ask-password, systemd-cat, systemd-cgls, systemd-cgtop, systemd-coredumpctl, systemd-delta, systemd-detect-virt, systemd-inhibit, systemd-machine-id-setup, systemd-notify, systemd-nspawn, systemd-run, systemd-stdio-bridge (link to systemd-bus-proxyd), systemd-tmpfiles, systemd-tty-ask-password-agent, telinit (link to systemctl), timedatectl, udevadm
Installed libraries: libnss_myhostname.so, libsystemd.so, libudev.so
Installed directories: /etc/binfmt.d, /etc/init.d, /etc/kernel, /etc/modules-load.d, /etc/sysctl.d, /etc/systemd, /etc/tmpfiles.d, /etc/udev, /etc/xdg/systemd, /lib/systemd, /lib/udev, /usr/include/systemd, /usr/lib/binfmt.d, /usr/lib/kernel, /usr/lib/modules-load.d, /usr/lib/sysctl.d, /usr/lib/systemd, /usr/share/doc-systemd-213, /usr/share/systemd, /usr/share/zsh, /var/lib/systemd

Short Descriptions

bootctl

Controls the firmware and boot manager settings

busctl

Introspects and monitors the D-Bus bus

halt

Halts, powers off, or reboots the machine

hostnamectl

Controls the system hostname

init

systemd system and service manager

journalctl

Queries the systemd journal

kernel-install

Adds and removes kernel and initramfs images to and from /boot

localectl

Controls the system locale and keyboard layout settings

loginctl

Controls the systemd login manager

machinectl

Controls the systemd machine manager

poweroff

Halts, powers off, or reboots the machine

reboot

Halts, powers off, or reboots the machine

runlevel

Prints previous and current SysV runlevel

shutdown

Halts, powers off, or reboots the machine

systemctl

Control the systemd system and service manager

systemd

System and service manager for Linux

systemd-analyze

Analyzes system boot-up permformance

systemd-ask-password

Queries the user for a system passphrase, via the TTY or an UI agent.

systemd-cat

Connects a pipeline or program's output with the journal

systemd-cgls

Recursively shows control group contents

systemd-cgtop

Shows top control groups by resource usage

systemd-coredumpctl

Retrieves coredumps from the journal

systemd-delta

Finds overridden configuration files

systemd-detect-virt

Detects execution in a virtual environment

systemd-inhibit

Executes a program with an inhibition lock taken

systemd-machine-id-setup

Initializes the machine ID in /etc/machine-id

systemd-notify

Notifies init system about start-up completion and other daemon status changes

systemd-nspawn

Spawns a namespace container for debugging, testing, and building

systemd-run

Runs programs in transient scope or service units

systemd-stdio-bridge

Connects stdio or a socket to a given bus address

systemd-tmpfiles

Creates, deletes, and cleans up volatile and temporary files

systemd-tty-ask-password-agent

Process system password requests

telinit

Tells init which run-level to change to

timedatectl

Controls the system time and date

udevadm

Udev management tool

libnss_myhostname

Plugin for the GNU Name Service Switch (NSS) functionality of Glibc, provding hostname resolution for the locally configured system hostname

libsystemd

Support library for systemd

libudev

A library interface to Udev device information.