<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../../general.ent">
  %general-entities;
]>
<sect1 id="ch-system-systemd" role="wrap">
  <?dbhtml filename="systemd.html"?>

  <title>Systemd-&systemd-version;</title>

  <indexterm zone="ch-system-systemd">
    <primary sortas="a-systemd">Systemd</primary>
  </indexterm>

  <sect2 role="package">
    <title/>

    <para>The Systemd package is a system and service manager for Linux
    operating systems.</para>

  </sect2>

  <sect2 role="installation">
    <title>Installation of systemd</title>

    <para os="p1">Apply a patch so that compat <command>pkg-config</command>
    files get installed without installing compat libraries:</para>

<screen os="p2"><userinput>patch -Np1 -i ../&systemd-compat-patch;</userinput></screen>

    <para os="a">Prepare Systemd for compilation:</para>

<screen os="b"><userinput>./configure --prefix=/usr \
    --sysconfdir=/etc --localstatedir=/var \
    --libexecdir=/usr/lib --docdir=/usr/share/doc/systemd-&systemd-version; \
    --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</userinput></screen>

    <variablelist os="c">
      <title>The meaning of the configure options:</title>

      <varlistentry>
        <term><parameter>--with-root*</parameter></term>
        <listitem>
          <para>These switches ensure that core programs and
          shared libraries are installed in the subdirectories
          of the root partition.</para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><parameter>--enable-split-usr</parameter></term>
        <listitem>
          <para>This switch ensures that Systemd will work on
          systems where /bin, /lib and /sbin directories are not
          symlinks to their /usr counterparts.</para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><parameter>--disable-gudev --without-python</parameter></term>
        <listitem>
          <para>These switches disable optional features because
          LFS does not provide their dependencies.</para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><parameter>--with-dbus*</parameter></term>
        <listitem>
          <para>These switches ensure that D-Bus configuration files get
          installed to the correct locations.</para>
        </listitem>
      </varlistentry>
    </variablelist>

    <para os="d">Compile the package:</para>

<screen os="e"><userinput>make</userinput></screen>

    <para os="f">Prevent a broken test case from running:</para>

<screen os="g"><userinput remap="test">
sed -e "s:test/udev-test.pl::g" \
    -e "s:test-bus-cleanup\$(EXEEXT) ::g" \
    -e "s:test-bus-gvariant\$(EXEEXT) ::g" \
    -i Makefile</userinput></screen>

    <para os="h">Test the results, issue:</para>

<screen os="i"><userinput remap="test">make check</userinput></screen>

    <para os="j">Install the package:</para>

<screen os="k"><userinput>make install</userinput></screen>

    <para os="l">Install man pages and documentation files that are not
    installed by default:</para>

<screen os="m"><userinput>for section in 1 3 5 7 8
do
  install -v -m644 man/*.${section} /usr/share/man/man${section}
done
install -v -m644 man/*.html /usr/share/doc/systemd-&systemd-version;</userinput></screen>

    <para os="n">Move NSS myhostname library to <filename class="directory">/lib
</filename>:</para>

<screen os="o"><userinput>mv -v /usr/lib/libnss_myhostname.so.2 /lib</userinput></screen>

    <para os="p">Remove an unnecessary directory:</para>

<screen os="q"><userinput>rm -rfv /usr/lib/rpm</userinput></screen>

    <para os="r">Create symlinks for backwards-compatibility with Sysvinit:</para>

<screen os="s"><userinput>for tool in runlevel reboot shutdown poweroff halt telinit; do
  ln -sfv ../bin/systemctl /sbin/$tool
done
ln -sfv ../lib/systemd/systemd /sbin/init</userinput></screen>

    <para os="t">Modify a configuration file which references a group that
    doesn't exist:</para>

<screen os="u"><userinput>sed -i "s@root lock@root root@g" /usr/lib/tmpfiles.d/legacy.conf</userinput></screen>

  </sect2>

  <sect2 id="conf-systemd" role="configuration">
    <title>Configuring Systemd</title>

    <indexterm zone="conf-systemd">
      <primary sortas="a-systemd">systemd</primary>
    <secondary>configuring</secondary></indexterm>

    <indexterm zone="conf-systemd">
      <primary sortas="e-/etc/os-release">/etc/os-release</primary>
    </indexterm>

    <para>Create <filename>/etc/machine-id</filename> which is needed
    by Journald:</para>

<screen><userinput>systemd-machine-id-setup</userinput></screen>

    <para>Create a file to identify the operating system.
    <command>systemd</command> will use this file on boot to put information
    on the screen.</para>

<screen><userinput>cat &gt; /etc/os-release &lt;&lt; "EOF"
# Begin /etc/os-release

NAME=Cross-LFS
ID=clfs

PRETTY_NAME=Cross Linux From Scratch
ANSI_COLOR=0;33

VERSION=&version;
VERSION_ID=&versionid;

# End /etc/os-release
EOF</userinput></screen>

  </sect2>

  <sect2 id="contents-systemd" role="content">
    <title>Contents of Systemd</title>

    <segmentedlist>
      <segtitle>Installed programs</segtitle>
      <segtitle>Installed libraries</segtitle>
      <segtitle>Installed directories</segtitle>

      <seglistitem>
        <seg>systemctl, systemd, systemd-ask-password, systemd-cgls,
        systemd-notify, systemd-tty-ask-password-agent</seg>
        <seg>pam_systemd</seg>
        <seg>/lib/systemd, /etc/systemd, /etc/tmpfiles.d,
        /usr/share/systemd</seg>
      </seglistitem>
    </segmentedlist>

    <variablelist>
      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
      <?dbfo list-presentation="list"?>
      <?dbhtml list-presentation="table"?>

      <varlistentry id="systemctl">
        <term><command>systemctl</command></term>
        <listitem>
          <para>Control the Systemd system and service manager</para>
          <indexterm zone="ch-system-systemd systemctl">
            <primary sortas="b-systemctl">systemctl</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="systemd">
        <term><command>systemd</command></term>
        <listitem>
          <para>System and service manager for Linux</para>
          <indexterm zone="ch-system-systemd systemd">
            <primary sortas="b-systemd">systemd</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="systemd-ask-password">
        <term><command>systemd-ask-password</command></term>
        <listitem>
          <para>Queries the user for a system passphrase, via the
          TTY or an UI agent.</para>
          <indexterm zone="ch-system-systemd systemd-ask-password">
            <primary sortas="b-systemd-ask-password">systemd-ask-password</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="systemd-cgls">
        <term><command>systemd-cgls</command></term>
        <listitem>
          <para>Recursively shows control group contents</para>
          <indexterm zone="ch-system-systemd systemd-cgls">
            <primary sortas="b-systemd-cgls">systemd-cgls</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="systemd-notify">
        <term><command>systemd-notify</command></term>
        <listitem>
          <para>Notify init system about start-up completion and other daemon
          status changes</para>
          <indexterm zone="ch-system-systemd systemd-notify">
            <primary sortas="b-systemd-notify">systemd-notify</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="systemd-tty-ask-password-agent">
        <term><command>systemd-tty-ask-password-agent</command></term>
        <listitem>
          <para>Process system password requests</para>
          <indexterm zone="ch-system-systemd systemd-tty-ask-password-agent">
            <primary sortas="b-systemd-tty-ask-password-agent">systemd-tty-ask-password-agent</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="pam_systemd">
        <term><filename class="libraryfile">pam_systemd</filename></term>
        <listitem>
          <para>Register user sessions in the Systemd control group
          hierarchy</para>
          <indexterm zone="ch-system-systemd pam_systemd">
            <primary sortas="c-pam_systemd">pam_systemd</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="lib-systemd">
        <term><filename class="directory">/lib/systemd</filename></term>
        <listitem>
          <para>Location of system units and configurations</para>
          <indexterm zone="ch-system-systemd lib-systemd">
            <primary sortas="e-/lib/systemd">/lib/systemd</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="etc-systemd">
        <term><filename class="directory">/etc/systemd</filename></term>
        <listitem>
          <para>Location of user units and configurations</para>
          <indexterm zone="ch-system-systemd etc-systemd">
            <primary sortas="e-/etc/systemd">/etc/systemd</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="etc-tmpfilesd">
        <term><filename class="directory">/etc/tmpfiles.d</filename></term>
        <listitem>
          <para>Configuration for creation, deletion and cleaning of temporary
          and volatile files</para>
          <indexterm zone="ch-system-systemd etc-tmpfilesd">
            <primary sortas="e-/etc/tmpfiles.d">/etc/tmpfiles.d</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="usr-share-systemd">
        <term><filename class="directory">/usr/share/systemd</filename></term>
        <listitem>
          <para>Location of session unit files</para>
          <indexterm zone="ch-system-systemd usr-share-systemd">
            <primary sortas="e-/usr/share/systemd">/usr/share/systemd</primary>
          </indexterm>
        </listitem>
      </varlistentry>

    </variablelist>

  </sect2>

</sect1>
