10.63. Systemd-233

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

10.63.1. Installation of Systemd

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

Create a file to declare some variables

cat > config.cache << "EOF"
KILL="/bin/kill"
MOUNT_PATH="/bin/mount"
UMOUNT_PATH="/bin/umount"
SULOGIN="/sbin/sulogin"
XSLTPROC="/usr/bin/xsltproc"
cc_cv_LDFLAGS__Wl__fuse_ld_gold=no
EOF

Prepare systemd for compilation:

./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --libexecdir=/usr/lib \
    --docdir=/usr/share/doc/systemd-233 \
    --with-rootprefix="" \
    --with-rootlibdir=/lib \
    --enable-split-usr \
    --disable-firstboot \
    --disable-ldconfig \
    --disable-lto \
    --disable-sysusers \
    --with-default-dnssec=no \
    --with-kbd-loadkeys=/bin/loadkeys \
    --with-kbd-setfont=/bin/setfont \
    --with-dbuspolicydir=/etc/dbus-1/system.d \
    --with-dbussessionservicedir=/usr/share/dbus-1/services \
    --with-dbussystemservicedir=/usr/share/dbus-1/system-services \
    --config-cache

The meaning of the configure options:

--config-cache

Use the created config.cache.

--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-firstboot

This switch prevents installation of systemd services responsible for setting up the system for the first time. They are not useful for CLFS as everything is done manually.

--disable-ldconfig

This switch prevents installation of a systemd unit that runs ldconfig at boot, and increases boot time. While it may be not useful for source distributions like CLFS, this option may be removed.

--disable-lto

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

--disable-sysusers

This switch prevents install of systemd services which setup the previously created /etc/group and /etc/passwd files.

--with-dbus*

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

--with-default-dnssec=no

This switch turns off the experimental DNSSEC support.

Compile the package:

make

Prevent a broken test case from running:

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

To test the results, issue:

sed -i "s:minix:ext4:g" src/test/test-path-util.c
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-233

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

10.63.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=GIT-20170803
VERSION_ID=20170803

# End /etc/os-release
EOF

10.63.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-233, /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.