Index: general/sysutils/systemd.xml
===================================================================
--- general/sysutils/systemd.xml	(revision f852e706e250ecb22863707b18cf286edf1466d1)
+++ general/sysutils/systemd.xml	(revision f852e706e250ecb22863707b18cf286edf1466d1)
@@ -0,0 +1,327 @@
+<?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;
+
+  <!ENTITY systemd-download-http "http://anduin.linuxfromscratch.org/sources/other/systemd/systemd-&systemd-version;.tar.xz">
+  <!ENTITY systemd-download-ftp  " ">
+  <!ENTITY systemd-md5sum        "7fd9c7b1296104ccc0b8aee4be3d3c23">
+  <!ENTITY systemd-size          "3,748 KB">
+  <!ENTITY systemd-buildsize     "1.0 GB">
+  <!ENTITY systemd-time          "4.9 SBU">
+
+]>
+
+<sect1 id="systemd" xreflabel="Systemd-&systemd-version;" revision="systemd">
+  <?dbhtml filename="systemd.html"?>
+
+  <sect1info>
+    <othername>$LastChangedBy$</othername>
+    <date>$Date$</date>
+  </sect1info>
+
+  <title>Systemd-&systemd-version;</title>
+
+  <indexterm zone="systemd">
+    <primary sortas="a-systemd">systemd</primary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title>Introduction to systemd</title>
+
+    <para>
+      While <application>systemd</application> was installed when
+      building LFS, there are many features provided by the package that
+      were not included in the initial installation becasue
+      <application>Linux-PAM</application> was not yet installed.
+      The <application>systemd</application> package needs to be
+      rebuilt to provide a working <command>systemd-logind</command> service,
+      which provides many additonal features for dependent packages.
+    </para>
+    
+    &lfs79_checked;&gcc6_checked;
+
+    <bridgehead renderas="sect3">Package Information</bridgehead>
+    <itemizedlist spacing="compact">
+      <listitem>
+        <para>Download (HTTP): <ulink url="&systemd-download-http;"/></para>
+      </listitem>
+      <listitem>
+        <para>Download (FTP): <ulink url="&systemd-download-ftp;"/></para>
+      </listitem>
+      <listitem>
+        <para>Download MD5 sum: &systemd-md5sum;</para>
+      </listitem>
+      <listitem>
+        <para>Download size: &systemd-size;</para>
+      </listitem>
+      <listitem>
+        <para>Estimated disk space required: &systemd-buildsize;</para>
+      </listitem>
+      <listitem>
+        <para>Estimated build time: &systemd-time;</para>
+      </listitem>
+    </itemizedlist>
+
+    <bridgehead renderas="sect3">systemd Dependencies</bridgehead>
+
+    <bridgehead renderas="sect4">Required</bridgehead>
+    <para role="required">
+      <xref linkend="linux-pam"/>
+    </para>
+
+    <bridgehead renderas="sect4">Recommended Runtime Dependency</bridgehead>
+    <para role="recommended">
+      <xref linkend="polkit"/>
+    </para>
+
+    <bridgehead renderas="sect4">Optional</bridgehead>
+    <para role="optional">
+      <xref linkend="cacerts"/>,
+      <xref linkend="curl"/>,
+      <xref linkend="elfutils"/>,
+      <xref linkend="gnutls"/>,
+      <xref linkend="iptables"/>,
+      <xref linkend="libgcrypt"/>,
+      <xref linkend="libidn"/>,
+      <xref linkend="libxkbcommon"/>,
+      <xref linkend="python2"/> or
+      <xref linkend="python3"/>,
+      <xref linkend="qemu"/>,
+      <xref linkend="valgrind"/>,
+      <ulink url="https://www.kernel.org/pub/linux/utils/cryptsetup/">cryptsetup</ulink>,
+      <ulink url="http://sourceforge.net/projects/gnu-efi/">gnu-efi</ulink>,
+      <ulink url="https://www.kernel.org/pub/linux/utils/kernel/kexec/">kexec-tools</ulink>,
+      <ulink url="https://www.gnu.org/software/libmicrohttpd/">libmicrohttpd</ulink>,
+      <ulink url="http://sourceforge.net/projects/libseccomp/">libseccomp</ulink>,
+      <ulink url="http://lxml.de/">lxml</ulink> (Python Module),
+      <ulink url="https://code.google.com/p/lz4/">lz4</ulink>,
+      <ulink url="http://fukuchi.org/works/qrencode/">qrencode</ulink>,
+      <ulink url="http://sourceforge.net/projects/linuxquota/">quota-tools</ulink> and
+      <ulink url="https://pypi.python.org/pypi/Sphinx">Sphinx</ulink>
+    </para>
+
+    <note>
+      <para>
+        In order to build the <application>systemd</application>
+        <application>Python</application> module, the
+        <application>lxml</application> package
+        needs to be installed for the corresponding
+        <application>Python</application> version (2 or 3).
+        Note that <command>configure</command> defaults to
+        <application>Python 2</application>. In order to build
+        the module for <application>Python 3</application>,
+        make sure you pass the <envar>PYTHON=python3</envar>
+        environment variable to the <command>configure</command>
+        command below.
+      </para>
+    </note>
+
+    <bridgehead renderas="sect4">Optional (to rebuild the manual pages)</bridgehead>
+    <para role="optional">
+      <xref linkend="DocBook"/>,
+      <xref linkend="docbook-xsl"/> and
+      <xref linkend="libxslt"/>
+    </para>
+
+    <para condition="html" role="usernotes">User Notes:
+      <ulink url="&blfs-wiki;/systemd"/>
+    </para>
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of systemd</title>
+
+    <para>First, fix a potential security issue with framebuffer
+    devices:</para>
+
+<screen><userinput>sed -e 's@DRI and frame buffer@DRI@' \
+    -e '/SUBSYTEM==\"graphics\", KERNEL==\"fb\*\"/d' \
+    -i  src/login/70-uaccess.rules</userinput></screen>
+
+    <para>
+      Disable two tests that always fail:
+    </para>
+
+<screen><userinput>sed -e 's:test/udev-test.pl ::g'  \
+    -e 's:test-copy$(EXEEXT) ::g' \
+    -i Makefile.in</userinput></screen>
+
+    <para>
+      Rebuild <application>systemd</application> by running the
+      following commands:
+    </para>
+
+<screen><userinput>cc_cv_CFLAGS__flto=no                \
+./configure --prefix=/usr            \
+            --sysconfdir=/etc        \
+            --localstatedir=/var     \
+            --with-rootprefix=       \
+            --with-rootlibdir=/lib   \
+            --enable-split-usr       \
+            --disable-firstboot      \
+            --disable-ldconfig       \
+            --disable-sysusers       \
+            --without-python         \
+            --with-default-dnssec=no \
+            --docdir=/usr/share/doc/systemd-&systemd-version; &amp;&amp;
+make</userinput></screen>
+
+    <note>
+      <para>
+        For the best results, make sure you run the testsuite from
+        a system that is booted by the same
+        <application>systemd</application> version you are rebuilding.
+      </para>
+    </note>
+
+    <para>
+      To test the results, issue: <command>make -k check</command>.
+    </para>
+
+    <warning>
+      <para>
+        Installing the package will overwrite all files installed by
+        <application>systemd</application> in LFS. It is critical that
+        nothing uses either <application>systemd</application> or
+        <application>Udev</application> libraries during the installation.
+        The best way to ensure that these libraries are not being used is to
+        run the installation in rescue mode. To switch to rescue mode,
+        run the following command as the
+        <systemitem class="username">root</systemitem> user (from a TTY):
+      </para>
+
+<screen role="root"><userinput>systemctl start rescue.target</userinput></screen>
+    </warning>
+
+   <para>
+     Now, as the <systemitem class="username">root</systemitem> user:
+   </para>
+
+<screen role="root"><userinput>make install</userinput></screen>
+
+    <para>
+      Move NSS libraries to <filename class="directory">/lib</filename>
+      by running the following command as the <systemitem
+      class="username">root</systemitem> user:
+    </para>
+
+<screen role="root"><userinput>mv -v /usr/lib/libnss_{myhostname,mymachines,resolve}.so.2 /lib</userinput></screen>
+
+    <para>
+      Remove an unnecessary directory by running the following command
+      as the <systemitem class="username">root</systemitem> user:
+    </para>
+
+<screen role="root"><userinput>rm -rfv /usr/lib/rpm</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="configuration">
+    <title>Configuring systemd</title>
+
+    <para>
+      The <filename>/etc/pam.d/system-sesion</filename> file needs to
+      be modified and a new file needs to be created in order for
+      <command>systemd-logind</command> to work correctly. Run the following
+      commands as the <systemitem class="username">root</systemitem> user:
+    </para>
+
+<screen role="root"><userinput>cat &gt;&gt; /etc/pam.d/system-session &lt;&lt; "EOF"
+<literal># Begin Systemd addition
+    
+session   required    pam_loginuid.so
+session   optional    pam_systemd.so
+
+# End Systemd addition</literal>
+EOF
+
+cat &gt; /etc/pam.d/systemd-user &lt;&lt; "EOF"
+<literal># 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  include  system-session
+
+auth     required pam_deny.so
+password required pam_deny.so
+
+# End /etc/pam.d/systemd-user</literal>
+EOF</userinput></screen>
+
+    <para>
+      At this point, you should reload the systemd daemon, and reenter
+      multi-user mode with the following commands (as the
+      <systemitem class="username">root</systemitem> user):
+    </para>
+
+<screen role="root"><userinput>systemctl daemon-reload
+systemctl start multi-user.target</userinput></screen>
+
+    <warning><para>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.</para></warning>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title>Contents</title>
+
+      <para>
+        A list of the installed files, along with their short
+        descriptions can be found at
+        <ulink url="&lfs-root;/chapter06/systemd.html#contents-systemd"/>.
+      </para>
+
+      <para>
+        Listed below are the newly installed libraries and directories
+        along with short descriptions.
+      </para>
+
+    <segmentedlist>
+      <segtitle>Installed Programs</segtitle>
+      <segtitle>Installed Libraries</segtitle>
+      <segtitle>Installed Directories</segtitle>
+
+      <seglistitem>
+        <seg>
+          None
+        </seg>
+        <seg>
+          pam_systemd.so
+          (in <filename class="directory">/lib/security</filename>)
+        </seg>
+        <seg>
+          None
+        </seg>
+      </seglistitem>
+    </segmentedlist>
+
+    <variablelist>
+      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
+      <?dbfo list-presentation="list"?>
+      <?dbhtml list-presentation="table"?>
+
+      <varlistentry id="pam_systemd">
+        <term><filename class="libraryfile">pam_systemd.so</filename></term>
+        <listitem>
+          <para>
+            is a PAM module used to register user sessions with the
+            <application>systemd</application> login manager,
+            <command>systemd-logind</command>.
+          </para>
+          <indexterm zone="systemd pam_systemd">
+            <primary sortas="c-pam_systemd">pam_systemd.so</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+  </sect2>
+
+</sect1>
Index: general/sysutils/sysutils.xml
===================================================================
--- general/sysutils/sysutils.xml	(revision 116f53b518efa37dd85be9c8f7b56998dabbf8a6)
+++ general/sysutils/sysutils.xml	(revision f852e706e250ecb22863707b18cf286edf1466d1)
@@ -45,4 +45,8 @@
 <!--  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="strigi.xml"/> -->
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="sysstat.xml"/>
+
+  <!-- systemd only -->
+  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="systemd.xml"/>
+
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="udisks.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="udisks2.xml"/>
