aboutsummaryrefslogtreecommitdiffstats
path: root/chapter09
diff options
context:
space:
mode:
authorBruce Dubbs <bdubbs@linuxfromscratch.org>2020-06-07 20:16:00 +0000
committerBruce Dubbs <bdubbs@linuxfromscratch.org>2020-06-07 20:16:00 +0000
commitfcc027677da55c41dcaea045f5b9ff8b088e6495 (patch)
tree42500a7858959695b971e7f28f1d0bf33185db2e /chapter09
parentd53fefab5a6772fef606392a61608fc290e6a7ae (diff)
Initial commit of alternative cross LFS
git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/cross2@11897 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
Diffstat (limited to 'chapter09')
-rw-r--r--chapter09/bootscripts.xml331
-rw-r--r--chapter09/chapter09.xml36
-rw-r--r--chapter09/clock.xml104
-rw-r--r--chapter09/consoled.xml139
-rw-r--r--chapter09/etcshells.xml49
-rw-r--r--chapter09/getcounted.xml20
-rw-r--r--chapter09/inputrc.xml82
-rw-r--r--chapter09/introduction.xml225
-rw-r--r--chapter09/introductiond.xml73
-rw-r--r--chapter09/locale.xml152
-rw-r--r--chapter09/network.xml247
-rw-r--r--chapter09/networkd.xml335
-rw-r--r--chapter09/profile.xml162
-rw-r--r--chapter09/reboot.xml113
-rw-r--r--chapter09/symlinks.xml256
-rw-r--r--chapter09/systemd-custom.xml313
-rw-r--r--chapter09/theend.xml84
-rw-r--r--chapter09/udev.xml342
-rw-r--r--chapter09/usage.xml710
-rw-r--r--chapter09/whatnow.xml92
20 files changed, 3550 insertions, 315 deletions
diff --git a/chapter09/bootscripts.xml b/chapter09/bootscripts.xml
new file mode 100644
index 000000000..5c2b28d7c
--- /dev/null
+++ b/chapter09/bootscripts.xml
@@ -0,0 +1,331 @@
+<?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-config-bootscripts" role="wrap" revision="sysv">
+ <?dbhtml filename="bootscripts.html"?>
+
+ <sect1info condition="script">
+ <productname>bootscripts</productname>
+ <productnumber>&lfs-bootscripts-version;</productnumber>
+ <address>&lfs-bootscripts-url;</address>
+ </sect1info>
+
+ <title>LFS-Bootscripts-&lfs-bootscripts-version;</title>
+
+ <indexterm zone="ch-config-bootscripts">
+ <primary sortas="a-Bootscripts">Bootscripts</primary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <para>The LFS-Bootscripts package contains a set of scripts to start/stop
+ the LFS system at bootup/shutdown.
+ The configuration files and procedures needed to
+ customize the boot process are described in the following sections.</para>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&lfs-bootscripts-ch7-sbu;</seg>
+ <seg>&lfs-bootscripts-ch7-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of LFS-Bootscripts</title>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+ </sect2>
+
+ <sect2 id="contents-bootscripts" role="content">
+ <title>Contents of LFS-Bootscripts</title>
+ <segmentedlist>
+ <segtitle>Installed scripts</segtitle>
+ <segtitle>Installed directories</segtitle>
+
+ <seglistitem>
+ <seg>checkfs, cleanfs, console, functions, halt, ifdown,
+ ifup, localnet, modules, mountfs, mountvirtfs, network, rc, reboot,
+ sendsignals, setclock, ipv4-static, swap, sysctl, sysklogd, template,
+ udev, and udev_retry</seg>
+ <seg>/etc/rc.d, /etc/init.d (symbolic link), /etc/sysconfig,
+ /lib/services, /lib/lsb (symbolic link)</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ <variablelist>
+ <bridgehead renderas="sect3">Short Descriptions</bridgehead>
+ <?dbfo list-presentation="list"?>
+ <?dbhtml list-presentation="table"?>
+
+ <varlistentry id="checkfs-bootscripts">
+ <term><command>checkfs</command></term>
+ <listitem>
+ <para>Checks the integrity of the file systems before they are mounted
+ (with the exception of journal and network based file systems)</para>
+ <indexterm zone="ch-config-bootscripts checkfs-bootscripts">
+ <primary sortas="d-checkfs">checkfs</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="cleanfs-bootscripts">
+ <term><command>cleanfs</command></term>
+ <listitem>
+ <para>Removes files that should not be preserved between reboots, such
+ as those in <filename class="directory">/var/run/</filename> and
+ <filename class="directory">/var/lock/</filename>; it re-creates
+ <filename>/var/run/utmp</filename> and removes the possibly present
+ <filename>/etc/nologin</filename>, <filename>/fastboot</filename>, and
+ <filename>/forcefsck</filename> files</para>
+ <indexterm zone="ch-config-bootscripts cleanfs-bootscripts">
+ <primary sortas="d-cleanfs">cleanfs</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="console-bootscripts">
+ <term><command>console</command></term>
+ <listitem>
+ <para>Loads the correct keymap table for the desired keyboard layout;
+ it also sets the screen font</para>
+ <indexterm zone="ch-config-bootscripts console-bootscripts">
+ <primary sortas="d-console">console</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="functions-bootscripts">
+ <term><command>functions</command></term>
+ <listitem>
+ <para>Contains common functions, such as error and status checking,
+ that are used by several bootscripts</para>
+ <indexterm zone="ch-config-bootscripts functions-bootscripts">
+ <primary sortas="d-functions">functions</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="halt-bootscripts">
+ <term><command>halt</command></term>
+ <listitem>
+ <para>Halts the system</para>
+ <indexterm zone="ch-config-bootscripts halt-bootscripts">
+ <primary sortas="d-halt">halt</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="ifdown-bootscripts">
+ <term><command>ifdown</command></term>
+ <listitem>
+ <para>Stops a network device</para>
+ <indexterm zone="ch-config-bootscripts ifdown-bootscripts">
+ <primary sortas="d-ifdown">ifdown</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="ifup-bootscripts">
+ <term><command>ifup</command></term>
+ <listitem>
+ <para>Initializes a network device</para>
+ <indexterm zone="ch-config-bootscripts ifup-bootscripts">
+ <primary sortas="d-ifup">ifup</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="localnet-bootscripts">
+ <term><command>localnet</command></term>
+ <listitem>
+ <para>Sets up the system's hostname and local loopback device</para>
+ <indexterm zone="ch-config-bootscripts localnet-bootscripts">
+ <primary sortas="d-localnet">localnet</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="modules-bootscripts">
+ <term><command>modules</command></term>
+ <listitem>
+ <para>Loads kernel modules listed in
+ <filename>/etc/sysconfig/modules</filename>, using arguments
+ that are also given there</para>
+ <indexterm zone="ch-config-bootscripts modules-bootscripts">
+ <primary sortas="d-modules">modules</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="mountfs-bootscripts">
+ <term><command>mountfs</command></term>
+ <listitem>
+ <para>Mounts all file systems, except ones that are marked
+ <emphasis>noauto</emphasis> or are network based</para>
+ <indexterm zone="ch-config-bootscripts mountfs-bootscripts">
+ <primary sortas="d-mountfs">mountfs</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="mountvirtfs-bootscripts">
+ <term><command>mountvirtfs</command></term>
+ <listitem>
+ <para>Mounts virtual kernel file systems, such as <systemitem
+ class="filesystem">proc</systemitem></para>
+ <indexterm zone="ch-config-bootscripts mountvirtfs-bootscripts">
+ <primary sortas="d-mountvirtfs">mountvirtfs</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="network-bootscripts">
+ <term><command>network</command></term>
+ <listitem>
+ <para>Sets up network interfaces, such as network cards, and sets up
+ the default gateway (where applicable)</para>
+ <indexterm zone="ch-config-bootscripts network-bootscripts">
+ <primary sortas="d-network">network</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="rc-bootscripts">
+ <term><command>rc</command></term>
+ <listitem>
+ <para>The master run-level control script; it is responsible for
+ running all the other bootscripts one-by-one, in a sequence determined
+ by the name of the symbolic links being processed</para>
+ <indexterm zone="ch-config-bootscripts rc-bootscripts">
+ <primary sortas="d-rc">rc</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="reboot-bootscripts">
+ <term><command>reboot</command></term>
+ <listitem>
+ <para>Reboots the system</para>
+ <indexterm zone="ch-config-bootscripts reboot-bootscripts">
+ <primary sortas="d-reboot">reboot</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="sendsignals-bootscripts">
+ <term><command>sendsignals</command></term>
+ <listitem>
+ <para>Makes sure every process is terminated before the system reboots
+ or halts</para>
+ <indexterm zone="ch-config-bootscripts sendsignals-bootscripts">
+ <primary sortas="d-sendsignals">sendsignals</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="setclock-bootscripts">
+ <term><command>setclock</command></term>
+ <listitem>
+ <para>Resets the kernel clock to local time in case the hardware clock
+ is not set to UTC time</para>
+ <indexterm zone="ch-config-bootscripts setclock-bootscripts">
+ <primary sortas="d-setclock">setclock</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="ipv4-static-bootscripts">
+ <term><command>ipv4-static</command></term>
+ <listitem>
+ <para>Provides the functionality needed to assign a static Internet
+ Protocol (IP) address to a network interface</para>
+ <indexterm zone="ch-config-bootscripts ipv4-static-bootscripts">
+ <primary sortas="d-ipv4-static">ipv4-static</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="swap-bootscripts">
+ <term><command>swap</command></term>
+ <listitem>
+ <para>Enables and disables swap files and partitions</para>
+ <indexterm zone="ch-config-bootscripts swap-bootscripts">
+ <primary sortas="d-swap">swap</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="sysctl-bootscripts">
+ <term><command>sysctl</command></term>
+ <listitem>
+ <para>Loads system configuration values from
+ <filename>/etc/sysctl.conf</filename>, if that file exists,
+ into the running kernel</para>
+ <indexterm zone="ch-config-bootscripts sysctl-bootscripts">
+ <primary sortas="d-sysctl">sysctl</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="sysklogd-bootscripts">
+ <term><command>sysklogd</command></term>
+ <listitem>
+ <para>Starts and stops the system and kernel log daemons</para>
+ <indexterm zone="ch-config-bootscripts sysklogd-bootscripts">
+ <primary sortas="d-sysklogd">sysklogd</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="template-bootscripts">
+ <term><command>template</command></term>
+ <listitem>
+ <para>A template to create custom bootscripts for other
+ daemons</para>
+ <indexterm zone="ch-config-bootscripts template-bootscripts">
+ <primary sortas="d-template">template</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="udev-bootscripts">
+ <term><command>udev</command></term>
+ <listitem>
+ <para>Prepares the <filename class="directory">/dev</filename>
+ directory and starts Udev</para>
+ <indexterm zone="ch-config-bootscripts udev-bootscripts">
+ <primary sortas="d-udev">udev</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="udev-retry-bootscripts">
+ <term><command>udev_retry</command></term>
+ <listitem>
+ <para>Retries failed udev uevents, and copies generated rules
+ files from <filename class="directory">/run/udev</filename> to
+ <filename class="directory">/etc/udev/rules.d</filename> if required</para>
+ <indexterm zone="ch-config-bootscripts udev-retry-bootscripts">
+ <primary sortas="d-udev-retry">udev_retry</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter09/chapter09.xml b/chapter09/chapter09.xml
index c8deeb388..499e66a6f 100644
--- a/chapter09/chapter09.xml
+++ b/chapter09/chapter09.xml
@@ -5,15 +5,39 @@
%general-entities;
]>
-<chapter id="chapter-finalizing" xreflabel="Chapter&nbsp;9">
+<chapter id="chapter-config" xreflabel="Chapter&nbsp;9">
<?dbhtml dir="chapter09"?>
<?dbhtml filename="chapter09.html"?>
- <title>The End</title>
+ <title>System Configuration</title>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="theend.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="getcounted.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="reboot.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="whatnow.xml"/>
+ <!-- sysv -->
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduction.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bootscripts.xml"/>
+
+ <!-- systemd -->
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introductiond.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="networkd.xml"/>
+
+ <!-- common -->
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="udev.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="symlinks.xml"/>
+
+ <!-- sysv -->
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="network.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="usage.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="profile.xml"/>
+
+ <!-- systemd -->
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="clock.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="consoled.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="locale.xml"/>
+
+ <!-- common -->
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="inputrc.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="etcshells.xml"/>
+
+ <!-- systemd -->
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="systemd-custom.xml"/>
</chapter>
diff --git a/chapter09/clock.xml b/chapter09/clock.xml
new file mode 100644
index 000000000..872ba677c
--- /dev/null
+++ b/chapter09/clock.xml
@@ -0,0 +1,104 @@
+<?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-config-clock" revision="systemd">
+ <?dbhtml filename="clock.html"?>
+
+ <title>Configuring the system clock</title>
+
+ <indexterm zone="ch-config-clock">
+ <primary sortas="d-clock">clock</primary>
+ <secondary>configuring</secondary></indexterm>
+
+ <para>This section discusses how to configure the
+ <command>systemd-timedated</command> system service, which configures
+ system clock and timezone.</para>
+
+ <para>If you cannot remember whether or not the hardware clock is set to UTC,
+ find out by running the <userinput>hwclock --localtime --show</userinput>
+ command. This will display what the current time is according to the hardware
+ clock. If this time matches whatever your watch says, then the hardware clock is
+ set to local time. If the output from <command>hwclock</command> is not local
+ time, chances are it is set to UTC time. Verify this by adding or subtracting
+ the proper amount of hours for the timezone to the time shown by
+ <command>hwclock</command>. For example, if you are currently in the MST
+ timezone, which is also known as GMT -0700, add seven hours to the local
+ time.</para>
+
+ <para><command>systemd-timedated</command> reads <filename>/etc/adjtime</filename>,
+ and depending on the contents of the file, it sets the clock to either UTC or
+ local time.</para>
+
+ <para>Create the <filename>/etc/adjtime</filename> file with the following contents
+ if your hardware clock is set to local time:</para>
+
+<screen><userinput>cat &gt; /etc/adjtime &lt;&lt; "EOF"
+<literal>0.0 0 0.0
+0
+LOCAL</literal>
+EOF</userinput></screen>
+
+ <para>If <filename>/etc/adjtime</filename> isn't present at first boot,
+ <command>systemd-timedated</command> will assume that hardware clock is
+ set to UTC and adjust the file according to that.</para>
+
+ <para>You can also use the <command>timedatectl</command> utility to tell
+ <command>systemd-timedated</command> if your hardware clock is set to
+ UTC or local time:</para>
+
+<screen role="nodump"><userinput>timedatectl set-local-rtc 1</userinput></screen>
+
+ <para><command>timedatectl</command> can also be used to change system time and
+ time zone.</para>
+
+ <para>To change your current system time, issue:</para>
+
+<screen role="nodump"><userinput>timedatectl set-time YYYY-MM-DD HH:MM:SS</userinput></screen>
+
+ <para>Hardware clock will also be updated accordingly.</para>
+
+ <para>To change your current time zone, issue:</para>
+
+<screen role="nodump"><userinput>timedatectl set-timezone TIMEZONE</userinput></screen>
+
+ <para>You can get a list of available time zones by running:</para>
+
+<screen role="nodump"><userinput>timedatectl list-timezones</userinput></screen>
+
+ <note><para>Please note that the <command>timedatectl</command> command can
+ be used only on a system booted with systemd.</para></note>
+
+ <sect2>
+ <title>Network Time Synchronization</title>
+
+ <para>Starting with version 213, systemd ships a daemon called
+ <command>systemd-timesyncd</command> which can be used to
+ synchronize the system time with remote NTP servers.</para>
+
+ <para>The daemon is not intended as a replacement for the well
+ established NTP daemon, but as a client only implementation
+ of the SNTP protocol which can be used for less advanced
+ tasks and on resource limited systems.</para>
+
+ <para>Starting with systemd version 216, the
+ <command>systemd-timesyncd</command> daemon is enabled by
+ default. If you want to disable it, issue the following
+ command:</para>
+
+<screen role="nodump"><userinput>systemctl disable systemd-timesyncd</userinput></screen>
+
+ <para>The <filename>/etc/systemd/timesyncd.conf</filename> file
+ can be used to change the NTP servers that
+ <command>systemd-timesyncd</command> synchronizes with.</para>
+
+ <para>Please note that when system clock is set to Local Time,
+ <command>systemd-timesyncd</command> won't update hardware
+ clock.</para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter09/consoled.xml b/chapter09/consoled.xml
new file mode 100644
index 000000000..bf1fdc8e0
--- /dev/null
+++ b/chapter09/consoled.xml
@@ -0,0 +1,139 @@
+<?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-config-console" revision="systemd">
+ <?dbhtml filename="console.html"?>
+
+ <title>Configuring the Linux Console</title>
+
+ <indexterm zone="ch-config-console">
+ <primary sortas="d-console">console</primary>
+ <secondary>configuring</secondary>
+ </indexterm>
+
+ <para>This section discusses how to configure the
+ <command>systemd-vconsole-setup</command> system service, which configures
+ the virtual console font and console keymap.</para>
+
+ <para>The <command>systemd-vconsole-setup</command> service reads the
+ <filename>/etc/vconsole.conf</filename> file for configuration
+ information. Decide which keymap and screen font will be used. Various
+ language-specific HOWTOs can also help with this, see <ulink
+ url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>.
+ Examine <command>localectl list-keymaps</command> output for a list of
+ valid console keymaps. Look in
+ <filename class="directory">/usr/share/consolefonts</filename>
+ directory for valid screen fonts.</para>
+
+ <para>The <filename>/etc/vconsole.conf</filename> file should contain lines
+ of the form: VARIABLE="value". The following variables are recognized:</para>
+
+ <variablelist>
+
+ <varlistentry>
+ <term>KEYMAP</term>
+ <listitem>
+ <para>This variable specifies the key mapping table for the keyboard. If
+ unset, it defaults to <literal>us</literal>.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>KEYMAP_TOGGLE</term>
+ <listitem>
+ <para>This variable can be used to configure a second toggle keymap and
+ is unset by default.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>FONT</term>
+ <listitem>
+ <para>This variable specifies the font used by the virtual
+ console.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>FONT_MAP</term>
+ <listitem>
+ <para>This variable specifies the console map to be used.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>FONT_UNIMAP</term>
+ <listitem>
+ <para>This variable specifies the Unicode font map.</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <para>An example for a German keyboard and console is given below:</para>
+<!-- This is what is used by jhalfs for creating the vconsole.conf file.
+ Whenever you want to change the following, please inform the jhalfs
+ maintainer(s). -->
+<screen><userinput>cat &gt; /etc/vconsole.conf &lt;&lt; "EOF"
+<literal>KEYMAP=de-latin1
+FONT=Lat2-Terminus16</literal>
+EOF</userinput></screen>
+
+ <para>You can change KEYMAP value at runtime by using the
+ <command>localectl</command> utility:</para>
+
+<screen role="nodump"><userinput>localectl set-keymap MAP</userinput></screen>
+
+ <note><para>Please note that the <command>localectl</command> command can
+ be used only on a system booted with systemd.</para></note>
+
+ <para>You can also use <command>localectl</command> utility with the
+ corresponding parameters to change X11 keyboard layout, model, variant
+ and options:</para>
+
+<screen role="nodump"><userinput>localectl set-x11-keymap LAYOUT [MODEL] [VARIANT] [OPTIONS]</userinput></screen>
+
+ <para>To list possible values for <command>localectl set-x11-keymap</command>
+ parameters, run <command>localectl</command> with parameters listed below:
+ </para>
+
+ <variablelist>
+
+ <varlistentry>
+ <term>list-x11-keymap-models</term>
+ <listitem>
+ <para>Show known X11 keyboard mapping models.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>list-x11-keymap-layouts</term>
+ <listitem>
+ <para>Show known X11 keyboard mapping layouts.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>list-x11-keymap-variants</term>
+ <listitem>
+ <para>Show known X11 keyboard mapping variants.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>list-x11-keymap-options</term>
+ <listitem>
+ <para>Show known X11 keyboard mapping options.</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <note><para>Using any of the parameters listed above requires the
+ XKeyboard Config package from BLFS.</para></note>
+
+</sect1>
diff --git a/chapter09/etcshells.xml b/chapter09/etcshells.xml
new file mode 100644
index 000000000..30961c80c
--- /dev/null
+++ b/chapter09/etcshells.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE part 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-config-shells" xreflabel="Creating the /etc/shells File">
+ <?dbhtml filename="etcshells.html"?>
+
+<!--
+ <sect1info>
+ <othername>$LastChangedBy$</othername>
+ <date>$Date$</date>
+ </sect1info>
+-->
+ <title>Creating the /etc/shells File</title>
+
+ <indexterm zone="ch-config-shells">
+ <primary sortas="e-etc-shells">/etc/shells</primary>
+ </indexterm>
+
+ <para>The <filename>shells</filename> file contains a list of
+ login shells on the system. Applications use this file to determine
+ whether a shell is valid. For each shell a single line should be
+ present, consisting of the shell's path, relative to the root of the
+ directory structure (/).</para>
+
+ <para>For example, this file is consulted by <command>chsh</command>
+ to determine whether an unprivileged user may change the login shell for her
+ own account. If the command name is not listed, the user will be denied of
+ change.</para>
+
+ <para>It is a requirement for applications such as
+ <application>GDM</application> which does not populate the
+ face browser if it can't find <filename>/etc/shells</filename>, or
+ FTP daemons which traditionally disallow access to users
+ with shells not included in this file.</para>
+
+<screen role="root"><userinput>cat &gt; /etc/shells &lt;&lt; "EOF"
+<literal># Begin /etc/shells
+
+/bin/sh
+/bin/bash
+
+# End /etc/shells</literal>
+EOF</userinput></screen>
+
+</sect1>
diff --git a/chapter09/getcounted.xml b/chapter09/getcounted.xml
deleted file mode 100644
index bc0ad8908..000000000
--- a/chapter09/getcounted.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?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-finish-getcounted">
- <?dbhtml filename="getcounted.html"?>
-
- <title>Get Counted</title>
-
- <para>Now that you have finished the book, do you want to be counted as an
- LFS user? Head over to <ulink url="&lfs-root;cgi-bin/lfscounter.php"/> and
- register as an LFS user by entering your name and the first LFS version you
- have used.</para>
-
- <para>Let's reboot into LFS now.</para>
-
-</sect1>
diff --git a/chapter09/inputrc.xml b/chapter09/inputrc.xml
new file mode 100644
index 000000000..00d36877f
--- /dev/null
+++ b/chapter09/inputrc.xml
@@ -0,0 +1,82 @@
+<?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-config-inputrc">
+ <?dbhtml filename="inputrc.html"?>
+
+ <title>Creating the /etc/inputrc File</title>
+
+ <indexterm zone="ch-config-inputrc">
+ <primary sortas="e-/etc/inputrc">/etc/inputrc</primary>
+ </indexterm>
+
+ <para>The <filename>inputrc</filename> file is the configuration file for
+ the Readline library, which provides editing capabilities while the user is
+ entering a line from the terminal. It works by translating keyboard inputs
+ into specific actions. Readline is used by Bash and most other shells as
+ well as many other applications.</para>
+
+ <para>Most people do not need user-specific functionality so the command
+ below creates a global <filename>/etc/inputrc</filename> used by everyone who
+ logs in. If you later decide you need to override the defaults on a per-user
+ basis, you can create a <filename>.inputrc</filename> file in the user's home
+ directory with the modified mappings.</para>
+
+ <para>For more information on how to edit the <filename>inputrc</filename>
+ file, see <command>info bash</command> under the <emphasis>Readline Init
+ File</emphasis> section. <command>info readline</command> is also a good
+ source of information.</para>
+
+ <para>Below is a generic global <filename>inputrc</filename> along with comments
+ to explain what the various options do. Note that comments cannot be on the same
+ line as commands. Create the file using the following command:</para>
+
+<screen><userinput>cat &gt; /etc/inputrc &lt;&lt; "EOF"
+<literal># Begin /etc/inputrc
+# Modified by Chris Lynn &lt;roryo@roryo.dynup.net&gt;
+
+# Allow the command prompt to wrap to the next line
+set horizontal-scroll-mode Off
+
+# Enable 8bit input
+set meta-flag On
+set input-meta On
+
+# Turns off 8th bit stripping
+set convert-meta Off
+
+# Keep the 8th bit for display
+set output-meta On
+
+# none, visible or audible
+set bell-style none
+
+# All of the following map the escape sequence of the value
+# contained in the 1st argument to the readline specific functions
+"\eOd": backward-word
+"\eOc": forward-word
+
+# for linux console
+"\e[1~": beginning-of-line
+"\e[4~": end-of-line
+"\e[5~": beginning-of-history
+"\e[6~": end-of-history
+"\e[3~": delete-char
+"\e[2~": quoted-insert
+
+# for xterm
+"\eOH": beginning-of-line
+"\eOF": end-of-line
+
+# for Konsole
+"\e[H": beginning-of-line
+"\e[F": end-of-line
+
+# End /etc/inputrc</literal>
+EOF</userinput></screen>
+
+</sect1>
diff --git a/chapter09/introduction.xml b/chapter09/introduction.xml
new file mode 100644
index 000000000..cbc197a7b
--- /dev/null
+++ b/chapter09/introduction.xml
@@ -0,0 +1,225 @@
+<?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-config-introduction" revision="sysv">
+ <?dbhtml filename="introduction.html"?>
+
+ <title>Introduction</title>
+
+ <para>Booting a Linux system involves several tasks. The process must
+ mount both virtual and real file systems, initialize devices, activate swap,
+ check file systems for integrity, mount any swap partitions or files, set
+ the system clock, bring up networking, start any daemons required by the
+ system, and accomplish any other custom tasks needed by the user. This
+ process must be organized to ensure the tasks are performed in the correct
+ order but, at the same time, be executed as fast as possible.</para>
+
+<!-- <para>In the packages that were installed in Chapter&nbsp;6, there were two
+ different boot systems installed. LFS provides the ability to easily
+ select which system the user wants to use and to compare and contrast the
+ two systems by actually running each system on the local computer. The
+ advantages and disadvantages of these systems is presented below.</para>-->
+
+ <sect2 id='sysv-desc'>
+ <title>System V</title>
+
+ <para>System V is the classic boot process that has been used in Unix and
+ Unix-like systems such as Linux since about 1983. It consists of a small
+ program, <command>init</command>, that sets up basic programs such as
+ <command>login</command> (via getty) and runs a script. This script,
+ usually named <command>rc</command>, controls the execution of a set of
+ additional scripts that perform the tasks required to initialize the
+ system.</para>
+
+ <para>The <command>init</command> program is controlled by the
+ <filename>/etc/inittab</filename> file and is organized into run levels that
+ can be run by the user:</para>
+
+<literallayout>
+0 &mdash; halt
+1 &mdash; Single user mode
+2 &mdash; Multiuser, without networking
+3 &mdash; Full multiuser mode
+4 &mdash; User definable
+5 &mdash; Full multiuser mode with display manager
+6 &mdash; reboot
+</literallayout>
+
+ <para>The usual default run level is 3 or 5.</para>
+
+ <bridgehead renderas="sect3">Advantages</bridgehead>
+
+ <itemizedlist>
+ <listitem>
+ <para>Established, well understood system.</para>
+ </listitem>
+
+ <listitem>
+ <para>Easy to customize.</para>
+ </listitem>
+
+ </itemizedlist>
+
+
+ <bridgehead renderas="sect3">Disadvantages</bridgehead>
+
+ <itemizedlist>
+ <listitem>
+ <para>Slower to boot. A medium speed base LFS system
+ takes 8-12 seconds where the boot time is measured from the
+ first kernel message to the login prompt. Network
+ connectivity is typically established about 2 seconds
+ after the login prompt.</para>
+ </listitem>
+
+ <listitem>
+ <para>Serial processing of boot tasks. This is related to the previous
+ point. A delay in any process such as a file system check, will
+ delay the entire boot process.</para>
+ </listitem>
+
+ <listitem>
+ <para>Does not directly support advanced features like
+ control groups (cgroups), and per-user fair share scheduling.</para>
+ </listitem>
+
+ <listitem>
+ <para>Adding scripts requires manual, static sequencing decisions.</para>
+ </listitem>
+
+ </itemizedlist>
+
+ </sect2>
+<!--
+ <sect2 id='sysd-desc'>
+ <title>Systemd</title>
+
+ <para>Systemd is a group of interconnected programs that handles system and
+ individual process requests. It provides a dependency system between
+ various entities called "units". It automatically addresses dependencies
+ between units and can execute several startup tasks in parallel. It
+ provides login, inetd, logging, time, and networking services. </para>
+
+ <bridgehead renderas="sect3">Advantages</bridgehead>
+
+ <itemizedlist>
+ <listitem>
+ <para>Used on many established distributions by default.</para>
+ </listitem>
+
+ <listitem>
+ <para>There is extensive documentation.
+ See <ulink url="http://www.freedesktop.org/wiki/Software/systemd/"/>.</para>
+ </listitem>
+
+ <listitem>
+ <para>Parallel execution of boot processes. A medium speed
+ base LFS system takes 6-10 seconds from kernel start to a
+ login prompt. Network connectivity is typically established
+ about 2 seconds after the login prompt. More complex startup
+ procedures may show a greater speedup when compared to System V.</para>
+ </listitem>
+
+ <listitem>
+ <para>Implements advanced features such as control groups to
+ manage related processes.</para>
+ </listitem>
+
+ <listitem>
+ <para>Maintains backward compatibility with System V programs
+ and scripts.</para>
+ </listitem>
+ </itemizedlist>
+
+ <bridgehead renderas="sect3">Disadvantages</bridgehead>
+
+ <itemizedlist>
+ <listitem>
+ <para>There is a substantial learning curve.</para>
+ </listitem>
+
+ <listitem>
+ <para>Some advanced features such as dbus or cgroups cannot be
+ disabled if they are not otherwise needed.</para>
+ </listitem>
+
+ <listitem>
+ <para>Although implemented as several executable programs
+ the user cannot choose to implement only the portions desired.</para>
+ </listitem>
+
+ <listitem>
+ <para>Due to the nature of using compiled programs, systemd is
+ more difficult to debug.</para>
+ </listitem>
+
+ <listitem>
+ <para>Logging is done in a binary format. Extra tools must
+ be used to process logs or additional processes must be implemented
+ to duplicate traditional logging programs.</para>
+ </listitem>
+
+ </itemizedlist>
+
+ </sect2>
+-->
+<!--
+ <sect2 id='sysv'>
+ <title>Selecting a Boot Method</title>
+
+ <para>Selecting a boot method in LFS is relatively easy.
+ Both systems are installed side-by-side. The only task needed is to
+ ensure the files that are needed by the system have the correct names.
+ The following scripts do that.</para>
+
+<screen><userinput remap="install">cat &gt; /usr/sbin/set-systemd &lt;&lt; "EOF"
+#! /bin/bash
+
+ln -svfn init-systemd /sbin/init
+ln -svfn init.d-systemd /etc/init.d
+
+for tool in halt poweroff reboot runlevel shutdown telinit; do
+ ln -sfvn ${tool}-systemd /sbin/${tool}
+ ln -svfn ${tool}-systemd.8 /usr/share/man/man8/${tool}.8
+done
+
+echo "Now reboot with /sbin/reboot-sysv"
+EOF
+
+chmod 0744 /usr/sbin/set-systemd
+
+cat &gt; /usr/sbin/set-sysv &lt;&lt; "EOF"
+#! /bin/bash
+
+ln -sfvn init-sysv /sbin/init
+ln -svfn init.d-sysv /etc/init.d
+
+for tool in halt poweroff reboot runlevel shutdown telinit; do
+ ln -sfvn ${tool}-sysv /sbin/${tool}
+ ln -svfn ${tool}-sysv.8 /usr/share/man/man8/${tool}.8
+done
+
+echo "Now reboot with /sbin/reboot-systemd"
+EOF
+
+chmod 0744 /usr/sbin/set-sysv</userinput></screen>
+
+ <note><para>The comment about the correct command to reboot in the
+ above scripts is correct. The reboot command for the current boot
+ system must be used after the script changes the default reboot command.
+ </para></note>
+
+ <para>Now set the desired boot system. The default is System V:</para>
+
+<screen><userinput remap="install">/usr/sbin/set-sysv</userinput></screen>
+
+ <para>Changing the boot system can be done at any time by running the
+ appropriate script above and rebooting.</para>
+
+ </sect2>
+-->
+</sect1>
diff --git a/chapter09/introductiond.xml b/chapter09/introductiond.xml
new file mode 100644
index 000000000..fa2403edb
--- /dev/null
+++ b/chapter09/introductiond.xml
@@ -0,0 +1,73 @@
+<?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-config-introduction" revision="systemd">
+ <?dbhtml filename="introduction.html"?>
+
+ <title>Introduction</title>
+
+ <para>This chapter discusses configuration files and systemd services.
+ First, the general configuration files needed to set up networking are
+ presented.</para>
+
+ <itemizedlist>
+ <listitem>
+ <para><xref linkend="ch-config-network" role="."/></para>
+ </listitem>
+ <listitem>
+ <para><xref linkend="ch-config-hostname" role="."/></para>
+ </listitem>
+ <listitem>
+ <para><xref linkend="ch-config-hosts" role="."/></para>
+ </listitem>
+ </itemizedlist>
+
+ <para>Second, issues that affect the proper setup of devices are
+ discussed.</para>
+
+ <itemizedlist>
+ <listitem>
+ <para><xref linkend="ch-config-udev" role="."/></para>
+ </listitem>
+ <listitem>
+ <para><xref linkend="ch-config-symlinks" role="."/></para>
+ </listitem>
+ </itemizedlist>
+
+ <para>Third, configuring the system clock and keyboard layout.</para>
+
+ <itemizedlist>
+ <listitem>
+ <para><xref linkend="ch-config-clock" role="."/></para>
+ </listitem>
+ <listitem>
+ <para><xref linkend="ch-config-console" role="."/></para>
+ </listitem>
+ </itemizedlist>
+
+
+ <para>Fourth, a brief introduction to the scripts and configuration
+ files used when the user logs into the system.</para>
+
+ <itemizedlist>
+ <listitem>
+ <para><xref linkend="ch-config-locale" role="."/></para>
+ </listitem>
+ <listitem>
+ <para><xref linkend="ch-config-inputrc" role="."/></para>
+ </listitem>
+ </itemizedlist>
+
+ <para>And finally, configuring the systemd behavior.</para>
+
+ <itemizedlist>
+ <listitem>
+ <para><xref linkend="ch-config-systemd-custom" role="."/></para>
+ </listitem>
+ </itemizedlist>
+
+</sect1>
diff --git a/chapter09/locale.xml b/chapter09/locale.xml
new file mode 100644
index 000000000..5f473ac72
--- /dev/null
+++ b/chapter09/locale.xml
@@ -0,0 +1,152 @@
+<?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-config-locale" revision="systemd">
+ <?dbhtml filename="locale.html"?>
+
+ <title>Configuring the System Locale</title>
+
+ <indexterm zone="ch-config-locale">
+ <primary sortas="e-etc-locale-conf">/etc/locale.conf</primary>
+ </indexterm>
+
+ <para>The <filename>/etc/locale.conf</filename> below sets some
+ environment variables necessary for native language support. Setting
+ them properly results in:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>The output of programs translated into the native language</para>
+ </listitem>
+ <listitem>
+ <para>Correct classification of characters into letters, digits and other
+ classes. This is necessary for <command>bash</command> to properly accept
+ non-ASCII characters in command lines in non-English locales</para>
+ </listitem>
+ <listitem>
+ <para>The correct alphabetical sorting order for the country</para>
+ </listitem>
+ <listitem>
+ <para>Appropriate default paper size</para>
+ </listitem>
+ <listitem>
+ <para>Correct formatting of monetary, time, and date values</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>Replace <replaceable>&lt;ll&gt;</replaceable> below with the two-letter code
+ for the desired language (e.g., <quote>en</quote>) and
+ <replaceable>&lt;CC&gt;</replaceable> with the two-letter code for the appropriate
+ country (e.g., <quote>GB</quote>). <replaceable>&lt;charmap&gt;</replaceable> should
+ be replaced with the canonical charmap for your chosen locale. Optional
+ modifiers such as <quote>@euro</quote> may also be present.</para>
+
+ <para>The list of all locales supported by Glibc can be obtained by running
+ the following command:</para>
+
+<screen role="nodump"><userinput>locale -a</userinput></screen>
+
+ <para>Charmaps can have a number of aliases, e.g., <quote>ISO-8859-1</quote>
+ is also referred to as <quote>iso8859-1</quote> and <quote>iso88591</quote>.
+ Some applications cannot handle the various synonyms correctly (e.g., require
+ that <quote>UTF-8</quote> is written as <quote>UTF-8</quote>, not
+ <quote>utf8</quote>), so it is safest in most
+ cases to choose the canonical name for a particular locale. To determine
+ the canonical name, run the following command, where <replaceable>&lt;locale
+ name&gt;</replaceable> is the output given by <command>locale -a</command> for
+ your preferred locale (<quote>en_GB.iso88591</quote> in our example).</para>
+
+<screen role="nodump"><userinput>LC_ALL=<replaceable>&lt;locale name&gt;</replaceable> locale charmap</userinput></screen>
+
+ <para>For the <quote>en_GB.iso88591</quote> locale, the above command
+ will print:</para>
+
+<screen><computeroutput>ISO-8859-1</computeroutput></screen>
+
+ <para>This results in a final locale setting of <quote>en_GB.ISO-8859-1</quote>.
+ It is important that the locale found using the heuristic above is tested prior
+ to it being added to the Bash startup files:</para>
+
+<screen role="nodump"><userinput>LC_ALL=&lt;locale name&gt; locale language
+LC_ALL=&lt;locale name&gt; locale charmap
+LC_ALL=&lt;locale name&gt; locale int_curr_symbol
+LC_ALL=&lt;locale name&gt; locale int_prefix</userinput></screen>
+
+ <para>The above commands should print the language name, the character
+ encoding used by the locale, the local currency, and the prefix to dial
+ before the telephone number in order to get into the country. If any of the
+ commands above fail with a message similar to the one shown below, this means
+ that your locale was either not installed in Chapter&nbsp;6 or is not supported by
+ the default installation of Glibc.</para>
+
+<screen><computeroutput>locale: Cannot set LC_* to default locale: No such file or directory</computeroutput></screen>
+
+ <para>If this happens, you should either install the desired locale using the
+ <command>localedef</command> command, or consider choosing a different locale.
+ Further instructions assume that there are no such error messages from
+ Glibc.</para>
+
+ <!-- FIXME: the xlib example will became obsolete real soon -->
+ <para>Some packages beyond LFS may also lack support for your chosen locale. One
+ example is the X library (part of the X Window System), which outputs the
+ following error message if the locale does not exactly match one of the character
+ map names in its internal files:</para>
+
+<screen><computeroutput>Warning: locale not supported by Xlib, locale set to C</computeroutput></screen>
+
+ <para>In several cases Xlib expects that the character map will be listed in
+ uppercase notation with canonical dashes. For instance, "ISO-8859-1" rather
+ than "iso88591". It is also possible to find an appropriate specification by
+ removing the charmap part of the locale specification. This can be checked
+ by running the <command>locale charmap</command> command in both locales.
+ For example, one would have to change "de_DE.ISO-8859-15@euro" to
+ "de_DE@euro" in order to get this locale recognized by Xlib.</para>
+
+ <para>Other packages can also function incorrectly (but may not necessarily
+ display any error messages) if the locale name does not meet their expectations.
+ In those cases, investigating how other Linux distributions support your locale
+ might provide some useful information.</para>
+
+ <para>Once the proper locale settings have been determined, create the
+ <filename>/etc/locale.conf</filename> file:</para>
+
+<screen><userinput>cat &gt; /etc/locale.conf &lt;&lt; "EOF"
+<literal>LANG=<replaceable>&lt;ll&gt;_&lt;CC&gt;.&lt;charmap&gt;&lt;@modifiers&gt;</replaceable></literal>
+EOF</userinput></screen>
+
+ <para>Note that you can modify <filename>/etc/locale.conf</filename> with the
+ systemd <command>localectl</command> utility. To use
+ <command>localectl</command> for the example above, run:</para>
+
+<screen role="nodump"><userinput>localectl set-locale LANG="<replaceable>&lt;ll&gt;_&lt;CC&gt;.&lt;charmap&gt;&lt;@modifiers&gt;</replaceable>"</userinput></screen>
+
+ <para>You can also specify other language specific environment variables such
+ as <envar>LANG</envar>, <envar>LC_CTYPE</envar>, <envar>LC_NUMERIC</envar> or
+ any other environment variable from <command>locale</command> output. Just
+ separate them with a space. An example where <envar>LANG</envar> is set as
+ en_US.UTF-8 but <envar>LC_CTYPE</envar> is set as just en_US is:</para>
+
+<screen role="nodump"><userinput>localectl set-locale LANG="en_US.UTF-8" LC_CTYPE="en_US"</userinput></screen>
+
+ <note><para>Please note that the <command>localectl</command> command can
+ be used only on a system booted with systemd.</para></note>
+
+ <para>The <quote>C</quote> (default) and <quote>en_US</quote> (the recommended
+ one for United States English users) locales are different. <quote>C</quote>
+ uses the US-ASCII 7-bit character set, and treats bytes with the high bit set
+ as invalid characters. That's why, e.g., the <command>ls</command> command
+ substitutes them with question marks in that locale. Also, an attempt to send
+ mail with such characters from Mutt or Pine results in non-RFC-conforming
+ messages being sent (the charset in the outgoing mail is indicated as <quote>unknown
+ 8-bit</quote>). So you can use the <quote>C</quote> locale only if you are sure that
+ you will never need 8-bit characters.</para>
+
+ <para>UTF-8 based locales are not supported well by many programs.
+ Work is in progress to document and, if possible, fix such problems, see
+ <ulink url="&blfs-book;introduction/locale-issues.html"/>.</para>
+
+</sect1>
diff --git a/chapter09/network.xml b/chapter09/network.xml
new file mode 100644
index 000000000..b527258ee
--- /dev/null
+++ b/chapter09/network.xml
@@ -0,0 +1,247 @@
+<?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-config-network" revision="sysv">
+ <?dbhtml filename="network.html"?>
+
+ <title>General Network Configuration</title>
+
+ <indexterm zone="ch-config-network">
+ <primary sortas="d-network">network</primary>
+ <secondary>configuring</secondary></indexterm>
+<!--
+ <para>This section only applies if a network card is to be
+ configured.</para>
+
+ <para>If a network card will not be used, there is likely no need to create
+ any configuration files relating to network cards. If that is the case, you
+ will need to remove the <filename class="symlink">network</filename> symlinks
+ from all run-level directories (<filename
+ class="directory">/etc/rc.d/rc*.d</filename>) after the bootscripts are
+ installed in <xref linkend="ch-config-bootscripts"/>.</para>
+-->
+ <sect2>
+ <title>Creating Network Interface Configuration Files</title>
+
+ <para>Which interfaces are brought up and down by the network script
+ usually depends on the files in <filename
+ class="directory">/etc/sysconfig/</filename>. This directory should
+ contain a file for each interface to be configured, such as
+ <filename>ifconfig.xyz</filename>, where <quote>xyz</quote> should describe
+ the network card. The interface name (e.g. eth0) is usually appropriate.
+ Inside this file are attributes to this interface, such as its IP
+ address(es), subnet masks, and so forth. It is necessary that the stem of
+ the filename be <emphasis>ifconfig</emphasis>.</para>
+
+ <note><para>If the procedure in the previous section was not used, Udev
+ will assign network card interface names based on system physical
+ characteristics such as enp2s1. If you are not sure what your interface
+ name is, you can always run <command>ip link</command> or <command>ls
+ /sys/class/net</command> after you have booted your system.
+ </para></note>
+
+ <para>The following command creates a sample file for the
+ <emphasis>eth0</emphasis> device with a static IP address:</para>
+<!-- jhalfs relies on the values for IFACE, IP, etc. If you want to change
+ them, please inform the jhalfs maintainer(s). -->
+<screen><userinput>cd /etc/sysconfig/
+cat &gt; ifconfig.<replaceable>eth0</replaceable> &lt;&lt; "EOF"
+<literal>ONBOOT=<replaceable>yes</replaceable>
+IFACE=<replaceable>eth0</replaceable>
+SERVICE=<replaceable>ipv4-static</replaceable>
+IP=<replaceable>192.168.1.2</replaceable>
+GATEWAY=<replaceable>192.168.1.1</replaceable>
+PREFIX=<replaceable>24</replaceable>
+BROADCAST=<replaceable>192.168.1.255</replaceable></literal>
+EOF</userinput></screen>
+
+ <para>The values in italics must be changed in every file to match
+ the proper setup.</para>
+
+ <para>If the <envar>ONBOOT</envar> variable is set to <quote>yes</quote> the
+ System V network script will bring up the Network Interface Card (NIC) during
+ booting of the system. If set to anything but <quote>yes</quote> the NIC
+ will be ignored by the network script and not be automatically brought up.
+ The interface can be manually started or stopped with the
+ <command>ifup</command> and <command>ifdown</command> commands.</para>
+
+ <para>The <envar>IFACE</envar> variable defines the interface name,
+ for example, eth0. It is required for all network device configuration
+ files. The filename extension must match this value.</para>
+
+ <para>The <envar>SERVICE</envar> variable defines the method used for
+ obtaining the IP address. The LFS-Bootscripts package has a modular IP
+ assignment format, and creating additional files in the <filename
+ class="directory">/lib/services/</filename> directory allows other IP
+ assignment methods. This is commonly used for Dynamic Host Configuration
+ Protocol (DHCP), which is addressed in the BLFS book.</para>
+
+ <para>The <envar>GATEWAY</envar> variable should contain the default
+ gateway IP address, if one is present. If not, then comment out the
+ variable entirely.</para>
+
+ <para>The <envar>PREFIX</envar> variable contains the number of
+ bits used in the subnet. Each octet in an IP address is 8 bits. If the
+ subnet's netmask is 255.255.255.0, then it is using the first three octets
+ (24 bits) to specify the network number. If the netmask is 255.255.255.240,
+ it would be using the first 28 bits. Prefixes longer than 24 bits are
+ commonly used by DSL and cable-based Internet Service Providers (ISPs).
+ In this example (PREFIX=24), the netmask is 255.255.255.0. Adjust the
+ <envar>PREFIX</envar> variable according to your specific subnet.
+ If omitted, the PREFIX defaults to 24.</para>
+
+ <para>For more information see the <command>ifup</command> man page.</para>
+
+ </sect2>
+ <sect2 id="resolv.conf">
+ <title>Creating the /etc/resolv.conf File</title>
+
+ <indexterm zone="resolv.conf">
+ <primary sortas="e-/etc/resolv.conf">/etc/resolv.conf</primary>
+ </indexterm>
+
+ <para>The system will need some means of obtaining Domain Name Service
+ (DNS) name resolution to resolve Internet domain names to IP addresses, and
+ vice versa. This is best achieved by placing the IP address of the DNS
+ server, available from the ISP or network administrator, into
+ <filename>/etc/resolv.conf</filename>. Create the file by running the
+ following:</para>
+
+<screen><userinput>cat &gt; /etc/resolv.conf &lt;&lt; "EOF"
+<literal># Begin /etc/resolv.conf
+
+domain <replaceable>&lt;Your Domain Name&gt;</replaceable>
+nameserver <replaceable>&lt;IP address of your primary nameserver&gt;</replaceable>
+nameserver <replaceable>&lt;IP address of your secondary nameserver&gt;</replaceable>
+
+# End /etc/resolv.conf</literal>
+EOF</userinput></screen>
+
+ <para>The <varname>domain</varname> statement can be omitted
+ or replaced with a <varname>search</varname> statement. See the man page for
+ resolv.conf for more details.</para>
+
+ <para>Replace <replaceable>&lt;IP address of the nameserver&gt;</replaceable>
+ with the IP address of the DNS most appropriate for the setup. There will
+ often be more than one entry (requirements demand secondary servers for
+ fallback capability). If you only need or want one DNS server, remove the
+ second <emphasis>nameserver</emphasis> line from the file. The IP address
+ may also be a router on the local network.</para>
+
+ <note>
+ <para>The Google Public IPv4 DNS addresses are 8.8.8.8 and 8.8.4.4.</para>
+ </note>
+
+ </sect2>
+
+ <sect2 id="ch-config-hostname">
+ <title>Configuring the system hostname</title>
+
+ <indexterm zone="ch-config-hostname">
+ <primary sortas="d-hostname">hostname</primary>
+ <secondary>configuring</secondary>
+ </indexterm>
+
+ <para>During the boot process, the file <filename>/etc/hostname</filename>
+ is used for establishing the system's hostname.</para>
+
+ <para>Create the <filename>/etc/hostname</filename> file and enter a
+ hostname by running:</para>
+
+<screen><userinput>echo "<replaceable>&lt;lfs&gt;</replaceable>" &gt; /etc/hostname</userinput></screen>
+
+ <para><replaceable>&lt;lfs&gt;</replaceable> needs to be replaced with the
+ name given to the computer. Do not enter the Fully Qualified Domain Name
+ (FQDN) here. That information is put in the
+ <filename>/etc/hosts</filename> file.</para>
+
+ </sect2>
+
+ <sect2 id="ch-config-hosts">
+ <title>Customizing the /etc/hosts File</title>
+
+ <indexterm zone="ch-config-hosts">
+ <primary sortas="e-/etc/hosts">/etc/hosts</primary>
+ </indexterm>
+
+ <indexterm zone="ch-config-hosts">
+ <primary sortas="d-localnet">localnet</primary>
+ <secondary>/etc/hosts</secondary>
+ </indexterm>
+
+ <indexterm zone="ch-config-hosts">
+ <primary sortas="d-network">network</primary>
+ <secondary>/etc/hosts</secondary>
+ </indexterm>
+
+ <para>Decide on the IP address, fully-qualified domain name (FQDN), and
+ possible aliases for use in the <filename>/etc/hosts</filename> file. The
+ syntax is:</para>
+
+<screen><literal>IP_address myhost.example.org aliases</literal></screen>
+
+ <para>Unless the computer is to be visible to the Internet (i.e., there is
+ a registered domain and a valid block of assigned IP addresses&mdash;most
+ users do not have this), make sure that the IP address is in the private
+ network IP address range. Valid ranges are:</para>
+
+<screen><literal>Private Network Address Range Normal Prefix
+10.0.0.1 - 10.255.255.254 8
+172.x.0.1 - 172.x.255.254 16
+192.168.y.1 - 192.168.y.254 24</literal></screen>
+
+ <para>x can be any number in the range 16-31. y can be any number in the
+ range 0-255.</para>
+
+ <para>A valid private IP address could be 192.168.1.1. A valid FQDN for
+ this IP could be lfs.example.org.</para>
+
+ <para>Even if not using a network card, a valid FQDN is still required.
+ This is necessary for certain programs to operate correctly.</para>
+
+ <para>Create the <filename>/etc/hosts</filename> file by running:</para>
+
+<screen><userinput>cat &gt; /etc/hosts &lt;&lt; "EOF"
+<literal># Begin /etc/hosts
+
+127.0.0.1 localhost.localdomain localhost
+127.0.1.1 <replaceable>&lt;FQDN&gt;</replaceable> <replaceable>&lt;HOSTNAME&gt;</replaceable>
+<replaceable>&lt;192.168.1.1&gt;</replaceable> <replaceable>&lt;FQDN&gt;</replaceable> <replaceable>&lt;HOSTNAME&gt;</replaceable> <replaceable>[alias1] [alias2 ...]</replaceable>
+::1 localhost ip6-localhost ip6-loopback
+ff02::1 ip6-allnodes
+ff02::2 ip6-allrouters
+
+# End /etc/hosts</literal>
+EOF</userinput></screen>
+
+ <para>The <replaceable>&lt;192.168.1.1&gt;</replaceable>,
+ <replaceable>&lt;FQDN&gt;</replaceable>, and
+ <replaceable>&lt;HOSTNAME&gt;</replaceable> values need to be
+ changed for specific uses or requirements (if assigned an IP address by a
+ network/system administrator and the machine will be connected to an
+ existing network). The optional alias name(s) can be omitted.</para>
+
+<!-- This is not very useful
+
+ <para>If a network card is not going to be configured, create the
+ <filename>/etc/hosts</filename> file by running:</para>
+
+<screen role="nodump"><userinput>cat &gt; /etc/hosts &lt;&lt; "EOF"
+<literal># Begin /etc/hosts (no network card version)
+
+127.0.0.1 localhost
+127.0.1.1 <replaceable>&lt;FQDN&gt;</replaceable> <replaceable>&lt;HOSTNAME&gt;</replaceable>
+::1 localhost ip6-localhost ip6-loopback
+ff02::1 ip6-allnodes
+ff02::2 ip6-allrouters
+
+# End /etc/hosts (no network card version)</literal>
+EOF</userinput></screen> -->
+
+ </sect2>
+
+</sect1>
diff --git a/chapter09/networkd.xml b/chapter09/networkd.xml
new file mode 100644
index 000000000..688c315aa
--- /dev/null
+++ b/chapter09/networkd.xml
@@ -0,0 +1,335 @@
+<?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-config-network" revision="systemd">
+ <?dbhtml filename="network.html"?>
+
+ <title>General Network Configuration</title>
+
+ <indexterm zone="ch-config-network">
+ <primary sortas="d-network">network</primary>
+ <secondary>configuring</secondary></indexterm>
+
+ <para>This section only applies if a network card is to be
+ configured.</para>
+
+ <sect2>
+ <title>Network Interface Configuration Files</title>
+
+ <para>Starting with version 209, systemd ships a network configuration
+ daemon called <command>systemd-networkd</command> which can be used for
+ basic network configuration. Additionally, since version 213, DNS name
+ resolution can be handled by <command>systemd-resolved</command> in place
+ of a static <filename>/etc/resolv.conf</filename> file. Both services are
+ enabled by default.</para>
+
+ <para>Configuration files for <command>systemd-networkd</command> (and
+ <command>systemd-resolved</command>) can be placed in
+ <filename class="directory">/usr/lib/systemd/network</filename>
+ or <filename class="directory">/etc/systemd/network</filename>. Files in
+ <filename class="directory">/etc/systemd/network</filename> have a
+ higher priority than the ones in
+ <filename class="directory">/usr/lib/systemd/network</filename>.
+ There are three types of configuration files:
+ <filename class="extension">.link</filename>,
+ <filename class="extension">.netdev</filename> and
+ <filename class="extension">.network</filename> files. For detailed
+ descriptions and example contents of these configuration files, consult
+ the <filename>systemd-link(5)</filename>,
+ <filename>systemd-netdev(5)</filename> and
+ <filename>systemd-network(5)</filename> manual pages.</para>
+
+ <sect3 id="systemd-network-devices">
+ <title>Network Device Naming</title>
+
+ <para>
+ Udev normally assigns network card interface names based
+ on system physical characteristics such as enp2s1. If you are
+ not sure what your interface name is, you can always run
+ <command>ip link</command> after you have booted your system.
+ </para>
+
+ <para>
+ For most systems, there is only one network interface for
+ each type of connection. For example, the classic interface
+ name for a wired connection is eth0. A wireless connection
+ will usually have the name wifi0 or wlan0.
+ </para>
+
+ <para>
+ If you prefer to use the classic or customized network interface names,
+ there are three alternative ways to do that:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ Mask udev's .link file for the default policy:
+<screen role="nodump"><userinput>ln -s /dev/null /etc/systemd/network/99-default.link</userinput></screen>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Create a manual naming scheme, for example by naming the
+ interfaces something like "internet0", "dmz0", or "lan0".
+ For that, create .link
+ files in /etc/systemd/network/, that choose an explicit name or a
+ better naming scheme for one, some, or all of your interfaces.
+ For example:
+ </para>
+
+<screen role="nodump"><userinput>cat &gt; /etc/systemd/network/10-ether0.link &lt;&lt; "EOF"
+<literal>[Match]
+# Change the MAC address as appropriate for your network device
+MACAddress=12:34:45:78:90:AB
+
+[Link]
+Name=ether0</literal>
+EOF</userinput></screen>
+
+ <para>
+ See the man page systemd.link(5) for more information.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ In /boot/grub/grub.cfg, pass the option net.ifnames=0 on the
+ kernel command line.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3 id="systemd-networkd-static">
+ <title>Static IP Configuration</title>
+
+ <para>The command below creates a basic configuration file for a
+ Static IP setup (using both systemd-networkd and
+ systemd-resolved):</para>
+<!-- jhalfs relies on the values for Name, Address, etc. If you want to change
+ them, please inform the jhalfs maintainer(s). -->
+<screen><userinput>cat &gt; /etc/systemd/network/10-eth-static.network &lt;&lt; "EOF"
+<literal>[Match]
+Name=<replaceable>&lt;network-device-name&gt;</replaceable>
+
+[Network]
+Address=192.168.0.2/24
+Gateway=192.168.0.1
+DNS=192.168.0.1
+Domains=<replaceable>&lt;Your Domain Name&gt;</replaceable></literal>
+EOF</userinput></screen>
+
+ <para>Multiple DNS entries can be added if you have more than one DNS
+ server. Do not include DNS or Domains entries if you intend to use a
+ static <filename>/etc/resolv.conf</filename> file.</para>
+
+ </sect3>
+
+ <sect3 id="systemd-networkd-dhcp">
+ <title>DHCP Configuration</title>
+
+ <para>The command below creates a basic configuration file for an IPv4
+ DHCP setup:</para>
+
+<screen role="nodump"><userinput>cat &gt; /etc/systemd/network/10-eth-dhcp.network &lt;&lt; "EOF"
+<literal>[Match]
+Name=&lt;network-device-name&gt;
+
+[Network]
+DHCP=ipv4
+
+[DHCP]
+UseDomains=true</literal>
+EOF</userinput></screen>
+
+ </sect3>
+
+ </sect2>
+
+ <sect2 id="resolv.conf">
+ <title>Creating the /etc/resolv.conf File</title>
+
+ <indexterm zone="resolv.conf">
+ <primary sortas="e-/etc/resolv.conf">/etc/resolv.conf</primary>
+ </indexterm>
+
+ <para>If the system is going to be connected to the Internet, it will
+ need some means of Domain Name Service (DNS) name resolution to
+ resolve Internet domain names to IP addresses, and vice versa. This is
+ best achieved by placing the IP address of the DNS server, available
+ from the ISP or network administrator, into
+ <filename>/etc/resolv.conf</filename>.</para>
+
+ <sect3 id="resolv-conf-systemd-resolved">
+ <title>systemd-resolved Configuration</title>
+
+ <note><para>If using another means to configure your network
+ interfaces (ex: ppp, network-manager, etc.), or if using any type of
+ local resolver (ex: bind, dnsmasq, etc.), or any other software that
+ generates an <filename>/etc/resolv.conf</filename> (ex: resolvconf), the
+ <command>systemd-resolved</command> service should not be
+ used.</para></note>
+
+ <para>When using <command>systemd-resolved</command> for DNS
+ configuration, it creates the file
+ <filename>/run/systemd/resolve/resolv.conf</filename>. Create a
+ symlink in <filename>/etc</filename> to use the generated file:</para>
+
+<screen><userinput>ln -sfv /run/systemd/resolve/resolv.conf /etc/resolv.conf</userinput></screen>
+
+ </sect3>
+
+ <sect3 id="resolv-conf-static">
+ <title>Static resolv.conf Configuration</title>
+
+ <para>If a static <filename>/etc/resolv.conf</filename> is desired,
+ create it by running the following command:</para>
+
+<screen role="nodump"><userinput>cat &gt; /etc/resolv.conf &lt;&lt; "EOF"
+<literal># Begin /etc/resolv.conf
+
+domain <replaceable>&lt;Your Domain Name&gt;</replaceable>
+nameserver <replaceable>&lt;IP address of your primary nameserver&gt;</replaceable>
+nameserver <replaceable>&lt;IP address of your secondary nameserver&gt;</replaceable>
+
+# End /etc/resolv.conf</literal>
+EOF</userinput></screen>
+
+ <para>The <varname>domain</varname> statement can be omitted
+ or replaced with a <varname>search</varname> statement. See the man page
+ for resolv.conf for more details.</para>
+
+ <para>Replace
+ <replaceable>&lt;IP address of the nameserver&gt;</replaceable>
+ with the IP address of the DNS most appropriate for the setup. There will
+ often be more than one entry (requirements demand secondary servers for
+ fallback capability). If you only need or want one DNS server, remove the
+ second <emphasis>nameserver</emphasis> line from the file. The IP address
+ may also be a router on the local network.</para>
+
+ <note><para>The Google Public IPv4 DNS addresses are
+ <parameter>8.8.8.8</parameter> and <parameter>8.8.4.4</parameter>
+ for IPv4, and <parameter>2001:4860:4860::8888</parameter> and
+ <parameter>2001:4860:4860::8844</parameter> for IPv6.</para></note>
+
+ </sect3>
+
+ </sect2>
+
+ <sect2 id="ch-config-hostname">
+ <title>Configuring the system hostname</title>
+
+ <indexterm zone="ch-config-hostname">
+ <primary sortas="d-hostname">hostname</primary>
+ <secondary>configuring</secondary>
+ </indexterm>
+
+ <para>During the boot process, the file <filename>/etc/hostname</filename>
+ is used for establishing the system's hostname.</para>
+
+ <para>Create the <filename>/etc/hostname</filename> file and enter a
+ hostname by running:</para>
+
+<screen><userinput>echo "<replaceable>&lt;lfs&gt;</replaceable>" &gt; /etc/hostname</userinput></screen>
+
+ <para><replaceable>&lt;lfs&gt;</replaceable> needs to be replaced with the
+ name given to the computer. Do not enter the Fully Qualified Domain Name
+ (FQDN) here. That information is put in the
+ <filename>/etc/hosts</filename> file.</para>
+
+ </sect2>
+
+ <sect2 id="ch-config-hosts">
+ <title>Customizing the /etc/hosts File</title>
+
+ <indexterm zone="ch-config-hosts">
+ <primary sortas="e-/etc/hosts">/etc/hosts</primary>
+ </indexterm>
+
+ <indexterm zone="ch-config-hosts">
+ <primary sortas="d-localnet">localnet</primary>
+ <secondary>/etc/hosts</secondary>
+ </indexterm>
+
+ <indexterm zone="ch-config-hosts">
+ <primary sortas="d-network">network</primary>
+ <secondary>/etc/hosts</secondary>
+ </indexterm>
+
+ <para>Decide on a fully-qualified domain name (FQDN), and possible aliases
+ for use in the <filename>/etc/hosts</filename> file. If using static
+ addresses, you'll also need to decide on an IP address. The syntax
+ for a hosts file entry is:</para>
+
+<screen><literal>IP_address myhost.example.org aliases</literal></screen>
+
+ <para>Unless the computer is to be visible to the Internet (i.e., there is
+ a registered domain and a valid block of assigned IP addresses&mdash;most
+ users do not have this), make sure that the IP address is in the private
+ network IP address range. Valid ranges are:</para>
+
+<screen><literal>Private Network Address Range Normal Prefix
+10.0.0.1 - 10.255.255.254 8
+172.x.0.1 - 172.x.255.254 16
+192.168.y.1 - 192.168.y.254 24</literal></screen>
+
+ <para>x can be any number in the range 16-31. y can be any number in the
+ range 0-255.</para>
+
+ <para>A valid private IP address could be 192.168.1.1. A valid FQDN for
+ this IP could be lfs.example.org.</para>
+
+ <para>Even if not using a network card, a valid FQDN is still required.
+ This is necessary for certain programs to operate correctly.</para>
+
+ <para>If using DHCP, DHCPv6, IPv6 Autoconfiguration, or if a network card
+ is not going to be configured, create the <filename>/etc/hosts</filename>
+ file by running the following command:</para>
+
+<screen role="nodump"><userinput>cat &gt; /etc/hosts &lt;&lt; "EOF"
+<literal># Begin /etc/hosts
+
+127.0.0.1 localhost.localdomain localhost
+127.0.1.1 <replaceable>&lt;FQDN&gt;</replaceable> <replaceable>&lt;HOSTNAME&gt;</replaceable>
+::1 localhost ip6-localhost ip6-loopback
+ff02::1 ip6-allnodes
+ff02::2 ip6-allrouters
+
+# End /etc/hosts</literal>
+EOF</userinput></screen>
+
+ <para>The ::1 entry is the IPv6 counterpart of 127.0.0.1 and represents
+ the IPv6 loopback interface. 127.0.1.1 is a loopback entry reserved
+ specifically for the FQDN.</para>
+
+ <para>If using a static address, create the <filename>/etc/hosts</filename>
+ file by running this command instead:</para>
+
+<screen><userinput>cat &gt; /etc/hosts &lt;&lt; "EOF"
+<literal># Begin /etc/hosts
+
+127.0.0.1 localhost
+127.0.1.1 <replaceable>&lt;FQDN&gt;</replaceable> <replaceable>&lt;HOSTNAME&gt;</replaceable>
+<replaceable>&lt;192.168.0.2&gt;</replaceable> <replaceable>&lt;FQDN&gt;</replaceable> <replaceable>&lt;HOSTNAME&gt;</replaceable> <replaceable>[alias1] [alias2] ...</replaceable>
+::1 localhost ip6-localhost ip6-loopback
+ff02::1 ip6-allnodes
+ff02::2 ip6-allrouters
+
+# End /etc/hosts</literal>
+EOF</userinput></screen>
+
+ <para>The <replaceable>&lt;192.168.0.2&gt;</replaceable>,
+ <replaceable>&lt;FQDN&gt;</replaceable>, and
+ <replaceable>&lt;HOSTNAME&gt;</replaceable> values need to be
+ changed for specific uses or requirements (if assigned an IP address by a
+ network/system administrator and the machine will be connected to an
+ existing network). The optional alias name(s) can be omitted.</para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter09/profile.xml b/chapter09/profile.xml
new file mode 100644
index 000000000..226dd9fac
--- /dev/null
+++ b/chapter09/profile.xml
@@ -0,0 +1,162 @@
+<?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-config-profile" revision="sysv">
+ <?dbhtml filename="profile.html"?>
+
+ <title>The Bash Shell Startup Files</title>
+
+ <indexterm zone="ch-config-profile">
+ <primary sortas="e-/etc/profile">/etc/profile</primary>
+ </indexterm>
+
+ <para>The shell program <command>/bin/bash</command> (hereafter referred to
+ as <quote>the shell</quote>) uses a collection of startup files to help
+ create an environment to run in. Each file has a specific use and may affect
+ login and interactive environments differently. The files in the <filename
+ class="directory">/etc</filename> directory provide global settings. If an
+ equivalent file exists in the home directory, it may override the global
+ settings.</para>
+
+ <para>An interactive login shell is started after a successful login, using
+ <command>/bin/login</command>, by reading the <filename>/etc/passwd</filename>
+ file. An interactive non-login shell is started at the command-line (e.g.,
+ <prompt>[prompt]$</prompt><command>/bin/bash</command>). A non-interactive
+ shell is usually present when a shell script is running. It is non-interactive
+ because it is processing a script and not waiting for user input between
+ commands.</para>
+
+ <para>For more information, see <command>info bash</command> under the
+ <emphasis>Bash Startup Files and Interactive Shells</emphasis> section.</para>
+
+ <para>The files <filename>/etc/profile</filename> and
+ <filename>~/.bash_profile</filename> are read when the shell is
+ invoked as an interactive login shell.</para>
+
+ <para>The base <filename>/etc/profile</filename> below sets some
+ environment variables necessary for native language support. Setting
+ them properly results in:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>The output of programs translated into the native language</para>
+ </listitem>
+ <listitem>
+ <para>Correct classification of characters into letters, digits and other
+ classes. This is necessary for <command>bash</command> to properly accept
+ non-ASCII characters in command lines in non-English locales</para>
+ </listitem>
+ <listitem>
+ <para>The correct alphabetical sorting order for the country</para>
+ </listitem>
+ <listitem>
+ <para>Appropriate default paper size</para>
+ </listitem>
+ <listitem>
+ <para>Correct formatting of monetary, time, and date values</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>Replace <replaceable>&lt;ll&gt;</replaceable> below with the two-letter code
+ for the desired language (e.g., <quote>en</quote>) and
+ <replaceable>&lt;CC&gt;</replaceable> with the two-letter code for the appropriate
+ country (e.g., <quote>GB</quote>). <replaceable>&lt;charmap&gt;</replaceable> should
+ be replaced with the canonical charmap for your chosen locale. Optional
+ modifiers such as <quote>@euro</quote> may also be present.</para>
+
+ <para>The list of all locales supported by Glibc can be obtained by running
+ the following command:</para>
+
+<screen role="nodump"><userinput>locale -a</userinput></screen>
+
+ <para>Charmaps can have a number of aliases, e.g., <quote>ISO-8859-1</quote>
+ is also referred to as <quote>iso8859-1</quote> and <quote>iso88591</quote>.
+ Some applications cannot handle the various synonyms correctly (e.g., require
+ that <quote>UTF-8</quote> is written as <quote>UTF-8</quote>, not
+ <quote>utf8</quote>), so it is safest in most
+ cases to choose the canonical name for a particular locale. To determine
+ the canonical name, run the following command, where <replaceable>&lt;locale
+ name&gt;</replaceable> is the output given by <command>locale -a</command> for
+ your preferred locale (<quote>en_GB.iso88591</quote> in our example).</para>
+
+<screen role="nodump"><userinput>LC_ALL=<replaceable>&lt;locale name&gt;</replaceable> locale charmap</userinput></screen>
+
+ <para>For the <quote>en_GB.iso88591</quote> locale, the above command
+ will print:</para>
+
+<screen><computeroutput>ISO-8859-1</computeroutput></screen>
+
+ <para>This results in a final locale setting of <quote>en_GB.ISO-8859-1</quote>.
+ It is important that the locale found using the heuristic above is tested prior
+ to it being added to the Bash startup files:</para>
+
+<screen role="nodump"><userinput>LC_ALL=&lt;locale name&gt; locale language
+LC_ALL=&lt;locale name&gt; locale charmap
+LC_ALL=&lt;locale name&gt; locale int_curr_symbol
+LC_ALL=&lt;locale name&gt; locale int_prefix</userinput></screen>
+
+ <para>The above commands should print the language name, the character
+ encoding used by the locale, the local currency, and the prefix to dial
+ before the telephone number in order to get into the country. If any of the
+ commands above fail with a message similar to the one shown below, this means
+ that your locale was either not installed in Chapter&nbsp;6 or is not supported by
+ the default installation of Glibc.</para>
+
+<screen><computeroutput>locale: Cannot set LC_* to default locale: No such file or directory</computeroutput></screen>
+
+ <para>If this happens, you should either install the desired locale using the
+ <command>localedef</command> command, or consider choosing a different locale.
+ Further instructions assume that there are no such error messages from
+ Glibc.</para>
+
+ <!-- FIXME: the xlib example will became obsolete real soon -->
+ <para>Some packages beyond LFS may also lack support for your chosen locale. One
+ example is the X library (part of the X Window System), which outputs the
+ following error message if the locale does not exactly match one of the character
+ map names in its internal files:</para>
+
+<screen><computeroutput>Warning: locale not supported by Xlib, locale set to C</computeroutput></screen>
+
+ <para>In several cases Xlib expects that the character map will be listed in
+ uppercase notation with canonical dashes. For instance, "ISO-8859-1" rather
+ than "iso88591". It is also possible to find an appropriate specification by
+ removing the charmap part of the locale specification. This can be checked
+ by running the <command>locale charmap</command> command in both locales.
+ For example, one would have to change "de_DE.ISO-8859-15@euro" to
+ "de_DE@euro" in order to get this locale recognized by Xlib.</para>
+
+ <para>Other packages can also function incorrectly (but may not necessarily
+ display any error messages) if the locale name does not meet their expectations.
+ In those cases, investigating how other Linux distributions support your locale
+ might provide some useful information.</para>
+
+ <para>Once the proper locale settings have been determined, create the
+ <filename>/etc/profile</filename> file:</para>
+
+<screen><userinput>cat &gt; /etc/profile &lt;&lt; "EOF"
+<literal># Begin /etc/profile
+
+export LANG=<replaceable>&lt;ll&gt;_&lt;CC&gt;.&lt;charmap&gt;&lt;@modifiers&gt;</replaceable>
+
+# End /etc/profile</literal>
+EOF</userinput></screen>
+
+ <para>The <quote>C</quote> (default) and <quote>en_US</quote> (the recommended
+ one for United States English users) locales are different. <quote>C</quote>
+ uses the US-ASCII 7-bit character set, and treats bytes with the high bit set
+ as invalid characters. That's why, e.g., the <command>ls</command> command
+ substitutes them with question marks in that locale. Also, an attempt to send
+ mail with such characters from Mutt or Pine results in non-RFC-conforming
+ messages being sent (the charset in the outgoing mail is indicated as <quote>unknown
+ 8-bit</quote>). So you can use the <quote>C</quote> locale only if you are sure that
+ you will never need 8-bit characters.</para>
+
+ <para>UTF-8 based locales are not supported well by some programs.
+ Work is in progress to document and, if possible, fix such problems, see
+ <ulink url="&blfs-book;introduction/locale-issues.html"/>.</para>
+
+</sect1>
diff --git a/chapter09/reboot.xml b/chapter09/reboot.xml
deleted file mode 100644
index c6a857dbd..000000000
--- a/chapter09/reboot.xml
+++ /dev/null
@@ -1,113 +0,0 @@
-<?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-finish-reboot">
- <?dbhtml filename="reboot.html"?>
-
- <title>Rebooting the System</title>
-
- <para>Now that all of the software has been installed, it is time to reboot
- your computer. However, you should be aware of a few things. The system you
- have created in this book is quite minimal, and most likely will not have
- the functionality you would need to be able to continue forward. By installing
- a few extra packages from the BLFS book while still in our current chroot
- environment, you can leave yourself in a much better position to continue on
- once you reboot into your new LFS installation. Here are some suggestions:</para>
-
- <itemizedlist>
-
- <listitem><para>A text mode browser such as <ulink
- url='&blfs-book;basicnet/lynx.html'>Lynx</ulink>
- will allow you to easily view the BLFS book in one virtual terminal, while
- building packages in another.</para></listitem>
-
- <listitem><para>The <ulink
- url='&blfs-book;general/gpm.html'>GPM</ulink> package will allow
- you to perform copy/paste actions in your virtual
- terminals.</para></listitem>
-
- <listitem><para>If you are in a situation where static IP configuration
- does not meet your networking requirements, installing a package
- such as <ulink url='&blfs-book;basicnet/dhcpcd.html'>dhcpcd</ulink>
- or the client portion of <ulink
- url='&blfs-book;basicnet/dhcp.html'>dhcp</ulink> may be
- useful.</para></listitem>
-
- <listitem><para>Installing <ulink
- url='&blfs-book;postlfs/sudo.html'>sudo</ulink> may be useful for
- building packages as a non-root user and easily installing the resulting
- packages in your new system. </para></listitem>
-
- <listitem><para>If you want to access your new system from a remote system
- within a comfortable GUI environment, install <ulink
- url='&blfs-book;postlfs/openssh.html'>openssh</ulink>.
- </para></listitem>
-
- <listitem><para>To make fetching files over the internet easier, install
- <ulink url='&blfs-book;basicnet/wget.html'>wget</ulink>.
- </para></listitem>
-
- <listitem><para>If one or more of your disk drives have a GUID partition
- table (GPT), either <ulink
- url='&blfs-book;postlfs/gptfdisk.html'>gptfdisk</ulink> or <ulink
- url='&blfs-book;postlfs/parted.html'>parted</ulink> will be useful.
- </para></listitem>
-
- <listitem><para>Finally, a review of the following configuration files
- is also appropriate at this point. </para>
-
- <itemizedlist>
- <listitem><para>/etc/bashrc </para></listitem>
- <listitem><para>/etc/dircolors </para></listitem>
- <listitem><para>/etc/fstab </para></listitem>
- <listitem><para>/etc/hosts </para></listitem>
- <listitem><para>/etc/inputrc </para></listitem>
- <listitem><para>/etc/profile </para></listitem>
- <listitem><para>/etc/resolv.conf </para></listitem>
- <listitem><para>/etc/vimrc </para></listitem>
- <listitem><para>/root/.bash_profile </para></listitem>
- <listitem><para>/root/.bashrc </para></listitem>
- <listitem revision="sysv"><para>/etc/sysconfig/ifconfig.eth0 </para></listitem>
- </itemizedlist>
- </listitem>
- </itemizedlist>
-
- <para>Now that we have said that, let's move on to booting our shiny new LFS
- installation for the first time! First exit from the chroot environment:</para>
-
-<screen><userinput>logout</userinput></screen>
-
- <para>Then unmount the virtual file systems:</para>
-
-<screen><userinput>umount -v $LFS/dev/pts
-umount -v $LFS/dev
-umount -v $LFS/run
-umount -v $LFS/proc
-umount -v $LFS/sys</userinput></screen>
-
- <para>Unmount the LFS file system itself:</para>
-
-<screen><userinput>umount -v $LFS</userinput></screen>
-
- <para>If multiple partitions were created, unmount the other
- partitions before unmounting the main one, like this:</para>
-
-<screen role="nodump"><userinput>umount -v $LFS/usr
-umount -v $LFS/home
-umount -v $LFS</userinput></screen>
-
- <para>Now, reboot the system with:</para>
-
-<screen role="nodump"><userinput>shutdown -r now</userinput></screen>
-
- <para>Assuming the GRUB boot loader was set up as outlined earlier, the menu
- is set to boot <emphasis>LFS &version;</emphasis> automatically.</para>
-
- <para>When the reboot is complete, the LFS system is ready for use and
- more software may be added to suit your needs.</para>
-
-</sect1>
diff --git a/chapter09/symlinks.xml b/chapter09/symlinks.xml
new file mode 100644
index 000000000..951e6976d
--- /dev/null
+++ b/chapter09/symlinks.xml
@@ -0,0 +1,256 @@
+<?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-config-symlinks">
+ <?dbhtml filename="symlinks.html"?>
+
+ <title>Managing Devices</title>
+
+ <sect2 revision="sysv">
+
+ <title>Network Devices</title>
+
+ <para>Udev, by default, names network devices according to Firmware/BIOS
+ data or physical characteristics like the bus, slot, or MAC address. The
+ purpose of this naming convention is to ensure that network devices are
+ named consistently and not based on the time the network card was
+ discovered. For example, on a computer having two network cards made by
+ Intel and Realtek, the network card manufactured by Intel may become eth0
+ and the Realtek card becomes eth1. In some cases, after a reboot the cards
+ get renumbered the other way around.</para>
+
+ <para>In the new naming scheme, typical network device names would then
+ be something like enp5s0 or wlp3s0. If this naming convention is not
+ desired, the traditional naming scheme or a custom scheme can be
+ implemented.</para>
+
+ <sect3>
+ <title>Disabling Persistent Naming on the Kernel Command Line</title>
+
+ <para>The traditional naming scheme using eth0, eth1, etc can be
+ restored by adding <userinput>net.ifnames=0</userinput> on the
+ kernel command line. This is most appropriate for those systems
+ that have only one ethernet device of the same type. Laptops
+ often have multiple ethernet connections that are named eth0 and
+ wlan0 and are also candidates for this method. The command line
+ is passed in the GRUB configuration file.
+ See <xref linkend="grub-cfg"/>.</para>
+ </sect3>
+
+ <sect3>
+ <title>Creating Custom Udev Rules</title>
+
+ <para>The naming scheme can be customized by creating custom Udev
+ rules. A script has been included that generates the initial rules.
+ Generate these rules by running:</para>
+
+<screen role="install"><userinput>bash /lib/udev/init-net-rules.sh</userinput></screen>
+
+ <para> Now, inspect the
+ <filename>/etc/udev/rules.d/70-persistent-net.rules</filename> file, to
+ find out which name was assigned to which network device:</para>
+
+<screen role="nodump"><userinput>cat /etc/udev/rules.d/70-persistent-net.rules</userinput></screen>
+
+ <note><para>In some cases such as when MAC addresses have been assigned to
+ a network card manually or in a virtual environment such as Qemu or Xen,
+ the network rules file may not have been generated because addresses
+ are not consistently assigned. In these cases, this method cannot
+ be used.</para></note>
+
+ <para>The file begins with a comment block followed by two lines for each
+ NIC. The first line for each NIC is a commented description showing its
+ hardware IDs (e.g. its PCI vendor and device IDs, if it's a PCI card),
+ along with its driver in parentheses, if the driver can be found. Neither
+ the hardware ID nor the driver is used to determine which name to give an
+ interface; this information is only for reference. The second line is the
+ Udev rule that matches this NIC and actually assigns it a name.</para>
+
+ <para>All Udev rules are made up of several keys, separated by commas and
+ optional whitespace. This rule's keys and an explanation of each of them
+ are as follows:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para><literal>SUBSYSTEM=="net"</literal> - This tells Udev to ignore
+ devices that are not network cards.</para>
+ </listitem>
+ <listitem>
+ <para><literal>ACTION=="add"</literal> - This tells Udev to ignore this
+ rule for a uevent that isn't an add ("remove" and "change" uevents also
+ happen, but don't need to rename network interfaces).</para>
+ </listitem>
+ <listitem>
+ <para><literal>DRIVERS=="?*"</literal> - This exists so that Udev will
+ ignore VLAN or bridge sub-interfaces (because these sub-interfaces do
+ not have drivers). These sub-interfaces are skipped because the name
+ that would be assigned would collide with their parent devices.</para>
+ </listitem>
+ <listitem>
+ <para><literal>ATTR{address}</literal> - The value of this key is the
+ NIC's MAC address.</para>
+ </listitem>
+ <listitem>
+ <para><literal>ATTR{type}=="1"</literal> - This ensures the rule only
+ matches the primary interface in the case of certain wireless drivers,
+ which create multiple virtual interfaces. The secondary interfaces are
+ skipped for the same reason that VLAN and bridge sub-interfaces are
+ skipped: there would be a name collision otherwise.</para>
+ </listitem>
+ <listitem>
+ <para><literal>NAME</literal> - The value of this key is the name that
+ Udev will assign to this interface.</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>The value of <literal>NAME</literal> is the important part. Make sure
+ you know which name has been assigned to each of your network cards before
+ proceeding, and be sure to use that <literal>NAME</literal> value when
+ creating your configuration files below.</para>
+
+ </sect3>
+
+ </sect2>
+
+ <sect2 revision="sysv">
+
+ <title>CD-ROM symlinks</title>
+
+ <para>Some software that you may want to install later (e.g., various
+ media players) expect the <filename class="symlink">/dev/cdrom</filename>
+ and <filename class="symlink">/dev/dvd</filename> symlinks to exist, and
+ to point to a CD-ROM or DVD-ROM device. Also, it may be convenient to put
+ references to those symlinks into <filename>/etc/fstab</filename>. Udev
+ comes with a script that will generate rules files to create these symlinks
+ for you, depending on the capabilities of each device, but you need to
+ decide which of two modes of operation you wish to have the script use.</para>
+
+ <para>First, the script can operate in <quote>by-path</quote> mode (used by
+ default for USB and FireWire devices), where the rules it creates depend on
+ the physical path to the CD or DVD device. Second, it can operate in
+ <quote>by-id</quote> mode (default for IDE and SCSI devices), where the
+ rules it creates depend on identification strings stored in the CD or DVD
+ device itself. The path is determined by Udev's <command>path_id</command>
+ script, and the identification strings are read from the hardware by its
+ <command>ata_id</command> or <command>scsi_id</command> programs, depending
+ on which type of device you have.</para>
+
+ <para>There are advantages to each approach; the correct approach to use
+ will depend on what kinds of device changes may happen. If you expect the
+ physical path to the device (that is, the ports and/or slots that it plugs
+ into) to change, for example because you plan on moving the drive to a
+ different IDE port or a different USB connector, then you should use the
+ <quote>by-id</quote> mode. On the other hand, if you expect the device's
+ identification to change, for example because it may die, and you would
+ replace it with a different device with the same capabilities and which
+ is plugged into the same connectors, then you should use the
+ <quote>by-path</quote> mode.</para>
+
+ <para>If either type of change is possible with your drive, then choose a
+ mode based on the type of change you expect to happen more often.</para>
+
+<!-- If you use by-id mode, the symlinks will survive even the transition
+ to libata for IDE drives, but that is not for the book. -->
+
+ <important><para>External devices (for example, a USB-connected CD drive)
+ should not use by-path persistence, because each time the device is plugged
+ into a new external port, its physical path will change. All
+ externally-connected devices will have this problem if you write Udev rules
+ to recognize them by their physical path; the problem is not limited to CD
+ and DVD drives.</para></important>
+
+ <para>If you wish to see the values that the Udev scripts will use, then
+ for the appropriate CD-ROM device, find the corresponding directory under
+ <filename class="directory">/sys</filename> (e.g., this can be
+ <filename class="directory">/sys/block/hdd</filename>) and
+ run a command similar to the following:</para>
+
+<screen role="nodump"><userinput>udevadm test /sys/block/hdd</userinput></screen>
+
+ <para>Look at the lines containing the output of various *_id programs.
+ The <quote>by-id</quote> mode will use the ID_SERIAL value if it exists and
+ is not empty, otherwise it will use a combination of ID_MODEL and
+ ID_REVISION. The <quote>by-path</quote> mode will use the ID_PATH value.</para>
+
+ <para>If the default mode is not suitable for your situation, then the
+ following modification can be made to the
+ <filename>/etc/udev/rules.d/83-cdrom-symlinks.rules</filename> file,
+ as follows (where <replaceable>mode</replaceable> is one of
+ <quote>by-id</quote> or <quote>by-path</quote>):</para>
+
+<screen role="nodump"><userinput>sed -i -e 's/"write_cd_rules"/"write_cd_rules <replaceable>mode</replaceable>"/' \
+ /etc/udev/rules.d/83-cdrom-symlinks.rules</userinput></screen>
+
+ <para>Note that it is not necessary to create the rules files or symlinks
+ at this time, because you have bind-mounted the host's
+ <filename class="directory">/dev</filename> directory into the LFS system,
+ and we assume the symlinks exist on the host. The rules and symlinks will
+ be created the first time you boot your LFS system.</para>
+
+ <para>However, if you have multiple CD-ROM devices, then the symlinks
+ generated at that time may point to different devices than they point to on
+ your host, because devices are not discovered in a predictable order. The
+ assignments created when you first boot the LFS system will be stable, so
+ this is only an issue if you need the symlinks on both systems to point to
+ the same device. If you need that, then inspect (and possibly edit) the
+ generated <filename>/etc/udev/rules.d/70-persistent-cd.rules</filename>
+ file after booting, to make sure the assigned symlinks match what you need.</para>
+
+ </sect2>
+
+ <sect2>
+
+ <title>Dealing with duplicate devices</title>
+
+ <para>As explained in <xref linkend="ch-config-udev"/>, the order in
+ which devices with the same function appear in
+ <filename class="directory">/dev</filename> is essentially random.
+ E.g., if you have a USB web camera and a TV tuner, sometimes
+ <filename>/dev/video0</filename> refers to the camera and
+ <filename>/dev/video1</filename> refers to the tuner, and sometimes
+ after a reboot the order changes to the opposite one.
+ For all classes of hardware except sound cards and network cards, this is
+ fixable by creating Udev rules for custom persistent symlinks.
+ The case of network cards is covered separately in
+ <xref linkend="ch-config-network"/>, and sound card configuration can
+ be found in <ulink url="&blfs-book;postlfs/devices.html">BLFS</ulink>.</para>
+
+ <para>For each of your devices that is likely to have this problem
+ (even if the problem doesn't exist in your current Linux distribution),
+ find the corresponding directory under
+ <filename class="directory">/sys/class</filename> or
+ <filename class="directory">/sys/block</filename>.
+ For video devices, this may be
+ <filename
+ class="directory">/sys/class/video4linux/video<replaceable>X</replaceable></filename>.
+ Figure out the attributes that identify the device uniquely (usually,
+ vendor and product IDs and/or serial numbers work):</para>
+
+<screen role="nodump"><userinput>udevadm info -a -p /sys/class/video4linux/video0</userinput></screen>
+
+ <para>Then write rules that create the symlinks, e.g.:</para>
+
+<screen role="nodump"><userinput>cat &gt; /etc/udev/rules.d/83-duplicate_devs.rules &lt;&lt; "EOF"
+<literal>
+# Persistent symlinks for webcam and tuner
+KERNEL=="video*", ATTRS{idProduct}=="1910", ATTRS{idVendor}=="0d81", \
+ SYMLINK+="webcam"
+KERNEL=="video*", ATTRS{device}=="0x036f", ATTRS{vendor}=="0x109e", \
+ SYMLINK+="tvtuner"
+</literal>
+EOF</userinput></screen>
+
+ <para>The result is that <filename>/dev/video0</filename> and
+ <filename>/dev/video1</filename> devices still refer randomly to the tuner
+ and the web camera (and thus should never be used directly), but there are
+ symlinks <filename>/dev/tvtuner</filename> and
+ <filename>/dev/webcam</filename> that always point to the correct
+ device.</para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter09/systemd-custom.xml b/chapter09/systemd-custom.xml
new file mode 100644
index 000000000..787fd4572
--- /dev/null
+++ b/chapter09/systemd-custom.xml
@@ -0,0 +1,313 @@
+<?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-config-systemd-custom" revision="systemd">
+ <?dbhtml filename="systemd-custom.html"?>
+
+ <title>Systemd Usage and Configuration</title>
+
+ <indexterm zone="ch-config-systemd-custom">
+ <primary sortas="e-Systemd">Systemd Customization</primary>
+ </indexterm>
+
+ <sect2>
+ <title>Basic Configuration</title>
+
+ <para>The <filename>/etc/systemd/system.conf</filename> file contains a set
+ of options to control basic systemd operations. The default file has all
+ entries commented out with the default settings indicated. This file is
+ where the log level may be changed as well as some basic logging settings.
+ See the <filename>systemd-system.conf(5)</filename> manual page for details
+ on each configuration option.</para>
+
+ </sect2>
+
+ <sect2>
+ <title>Disabling Screen Clearing at Boot Time</title>
+
+ <para>The normal behavior for systemd is to clear the screen at
+ the end of the boot sequence. If desired, this behavior may be
+ changed by running the following command:</para>
+
+<screen role="nodump"><userinput>mkdir -pv /etc/systemd/system/getty@tty1.service.d
+
+cat &gt; /etc/systemd/system/getty@tty1.service.d/noclear.conf &lt;&lt; EOF
+<literal>[Service]
+TTYVTDisallocate=no</literal>
+EOF</userinput></screen>
+
+ <para>The boot messages can always be reviewed by using the
+ <userinput>journalctl -b</userinput> command as the root user.</para>
+
+ </sect2>
+
+ <sect2>
+ <title>Disabling tmpfs for /tmp</title>
+
+ <para>By default, <filename class="directory">/tmp</filename> is created as
+ a tmpfs. If this is not desired, it can be overridden by the following:</para>
+
+<screen role="nodump"><userinput>ln -sfv /dev/null /etc/systemd/system/tmp.mount</userinput></screen>
+
+ <para>Alternatively, if a a separate partition for
+ <filename class="directory">/tmp</filename> is desired, specify that
+ partition in an <filename>/etc/fstab</filename> entry.</para>
+
+ <warning>
+ <para>
+ Do not create the symbolic link above if a separate partition is used
+ for <filename class="directory">/tmp</filename>. This will prevent the
+ root file system (/) from being remounted r/w and make the system
+ unusable when booted.
+ </para>
+ </warning>
+
+ </sect2>
+
+ <sect2>
+ <title>Configuring Automatic File Creation and Deletion</title>
+
+ <para>There are several services that create or delete files or
+ directories:</para>
+
+ <itemizedlist>
+ <listitem><para>systemd-tmpfiles-clean.service</para></listitem>
+ <listitem><para>systemd-tmpfiles-setup-dev.service</para></listitem>
+ <listitem><para>systemd-tmpfiles-setup.service</para></listitem>
+ </itemizedlist>
+
+ <para>The system location for the configuration files is
+ <filename>/usr/lib/tmpfiles.d/*.conf</filename>. The local
+ configuration files are in
+ <filename class="directory">/etc/tmpfiles.d</filename>. Files in
+ <filename class="directory">/etc/tmpfiles.d</filename> override
+ files with the same name in
+ <filename class="directory">/usr/lib/tmpfiles.d</filename>. See
+ <filename>tmpfiles.d(5)</filename> manual page for file format
+ details.</para>
+
+ <para>
+ Note that the syntax for the
+ <filename>/usr/lib/tmpfiles.d/*.conf</filename> files can be
+ confusing. For example, the default deletion of files in the /tmp directory
+ is located in <filename>/usr/lib/tmpfiles.d/tmp.conf</filename> with
+ the line:
+
+<screen role="nodump">q /tmp 1777 root root 10d</screen>
+
+ The type field, q, discusses creating a subvolume with quotas which
+ is really only applicable to btrfs filesystems. It references type v
+ which in turn references type d (directory). This then creates the
+ specified directory if is is not present and adjusts the permissions
+ and ownership as specified. Contents of the directory will be
+ subject to time based cleanup if the age argument is specified.
+ </para>
+
+ <para>
+ If the default parameters are not desired, then the file should
+ be copied to <filename class="directory">/etc/tmpfiles.d</filename>
+ and edited as desired. For example:
+
+<screen role="nodump"><userinput>mkdir -p /etc/tmpfiles.d
+cp /usr/lib/tmpfiles.d/tmp.conf /etc/tmpfiles.d</userinput></screen>
+ </para>
+
+ </sect2>
+
+ <sect2>
+ <title>Overriding Default Services Behavior</title>
+
+ <para>The parameter of a unit can be overriden by creating a directory
+ and a configuration file in <filename
+ class="directory">/etc/systemd/system</filename>. For example:</para>
+
+<screen role="nodump"><userinput>mkdir -pv /etc/systemd/system/foobar.service.d
+
+cat > /etc/systemd/system/foobar.service.d/foobar.conf &lt;&lt; EOF
+<literal>[Service]
+Restart=always
+RestartSec=30</literal>
+EOF</userinput></screen>
+
+ <para>See <filename>systemd.unit(5)</filename> manual page for more
+ information. After creating the configuration file, run
+ <userinput>systemctl daemon-reload</userinput> and <userinput>systemctl
+ restart foobar</userinput> to activate the changes to a service.</para>
+
+ </sect2>
+
+ <sect2>
+ <title>Debugging the Boot Sequence</title>
+
+ <para>Rather than plain shell scripts used in SysVinit or BSD style init
+ systems, systemd uses a unified format for different types of startup
+ files (or units). The command <command>systemctl</command> is used to
+ enable, disable, control state, and obtain status of unit files. Here
+ are some examples of frequently used commands:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para><command>systemctl list-units -t <replaceable>&lt;service&gt;</replaceable> [--all]</command>:
+ lists loaded unit files of type service.</para>
+ </listitem>
+ <listitem>
+ <para><command>systemctl list-units -t <replaceable>&lt;target&gt;</replaceable> [--all]</command>:
+ lists loaded unit files of type target.</para>
+ </listitem>
+ <listitem>
+ <para><command>systemctl show -p Wants <replaceable>&lt;multi-user.target&gt;</replaceable></command>:
+ shows all units that depend on the multi-user target. Targets are
+ special unit files that are anogalous to runlevels under
+ SysVinit.</para>
+ </listitem>
+ <listitem>
+ <para><command>systemctl status <replaceable>&lt;servicename.service&gt;</replaceable></command>:
+ shows the status of the servicename service. The .service extension
+ can be omitted if there are no other unit files with the same name,
+ such as .socket files (which create a listening socket that provides
+ similar functionality to inetd/xinetd).</para>
+ </listitem>
+ </itemizedlist>
+
+ </sect2>
+
+ <sect2>
+ <title>Working with the Systemd Journal</title>
+
+ <para>Logging on a system booted with systemd is handled with
+ systemd-journald (by default), rather than a typical unix syslog daemon.
+ You can also add a normal syslog daemon and have both work side by
+ side if desired. The systemd-journald program stores journal entries in a
+ binary format rather than a plain text log file. To assist with
+ parsing the file, the command <command>journalctl</command> is provided.
+ Here are some examples of frequently used commands:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para><command>journalctl -r</command>: shows all contents of the
+ journal in reverse chronological order.</para>
+ </listitem>
+ <listitem>
+ <para><command>journalctl -u <replaceable>UNIT</replaceable></command>:
+ shows the journal entries associated with the specified UNIT
+ file.</para>
+ </listitem>
+ <listitem>
+ <para><command>journalctl -b[=ID] -r</command>: shows the journal
+ entries since last successful boot (or for boot ID) in reverse
+ chronological order.</para>
+ </listitem>
+ <listitem>
+ <para><command>journalctl -f</command>: povides functionality similar
+ to tail -f (follow).</para>
+ </listitem>
+ </itemizedlist>
+
+ </sect2>
+
+ <sect2>
+ <title>Working with Core Dumps</title>
+
+ <para>Core dumps are useful to debug crashed programs, especially
+ when a daemon process crashes. On systemd booted systems the core
+ dumping is handled by <command>systemd-coredump</command>. It will
+ log the core dump into the journal and store the core dump itself in
+ <filename class="directory">/var/lib/systemd/coredump</filename>.
+ To retrieve and process core dumps, <command>coredumpctl</command>
+ tool is provided. Here are some examples of frequently used commands:
+ </para>
+
+ <itemizedlist>
+ <listitem>
+ <para><command>coredumpctl -r</command>: lists all core dumps in
+ reversed chronological order.</para>
+ </listitem>
+ <listitem>
+ <para><command>coredumpctl -1 info</command>: show the information
+ of the last core dump.</para>
+ </listitem>
+ <listitem>
+ <para><command>coredumpctl -1 debug</command>: load the last core
+ dump into <ulink url="&blfs-book;general/gdb.html">GDB</ulink>.
+ </para>
+ </listitem>
+ </itemizedlist>
+
+ <para>Core dumps may use a lot of disk space. The maximum disk space
+ used by core dumps can be limited by creating a configuration file in
+ <filename class="directory">/etc/systemd/coredump.conf.d</filename>.
+ For example:</para>
+
+<screen role="nodump"><userinput>mkdir -pv /etc/systemd/coredump.conf.d
+
+cat &gt; /etc/systemd/coredump.conf.d/maxuse.conf &lt;&lt; EOF
+<literal>[Coredump]
+MaxUse=5G</literal>
+EOF</userinput></screen>
+
+ <para>See <filename>systemd-coredump(8)</filename>,
+ <filename>coredumpctl(1)</filename>, and
+ <filename>coredump.conf.d(5)</filename> manual pages for more
+ information.</para>
+ </sect2>
+
+ <sect2>
+ <title>Long Running Processes</title>
+
+ <para>Beginning with systemd-230, all user processes are killed when a user
+ session is ended, even if nohup is used, or the process uses the
+ <function>daemon()</function> or <function>setsid()</function> functions.
+ This is a deliberate change from a historically permissive environment to a
+ more restrictive one. The new behavior may cause issues if you depend on
+ long running programs (e.g., <command>screen</command> or
+ <command>tmux</command>) to remain active after ending your user session.
+ There are three ways to enable lingering processes to remain after a user
+ session is ended.</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ <emphasis>Enable process lingering for only selected users</emphasis>:
+ Normal users have permission to enable process lingering
+ with the command <command>loginctl enable-linger</command> for their
+ own user. System administrators can use the same command with a
+ <parameter>user</parameter> argument to enable for a user. That user
+ can then use the <command>systemd-run</command> command to start
+ long running processes. For example: <command>systemd-run --scope
+ --user /usr/bin/screen</command>. If you enable lingering for your
+ user, the user@.service will remain even after all login sessions are
+ closed, and will automatically start at system boot. This has the
+ advantage of explicitly allowing and disallowing processes to run
+ after the user session has ended, but breaks backwards compatibility
+ with tools like <command>nohup</command> and utilities that use
+ <function>deamon()</function>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>Enable system-wide process lingering</emphasis>:
+ You can set <parameter>KillUserProcesses=no</parameter> in
+ <filename>/etc/systemd/logind.conf</filename> to enable process lingering
+ globally for all users. This has the benefit of leaving the old
+ method available to all users at the expense of explicit control.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>Disable at build-time</emphasis>: You can enable
+ lingering by default while building systemd by adding the switch
+ <parameter>-Ddefault-kill-user-processes=false</parameter> to the
+ <command>meson</command> command for systemd. This completely
+ disables the ability of systemd to kill user processes at session
+ end.
+ </para>
+ </listitem>
+ </itemizedlist>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter09/theend.xml b/chapter09/theend.xml
deleted file mode 100644
index 9f2ca17cc..000000000
--- a/chapter09/theend.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-<?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-finish-theend">
- <?dbhtml filename="theend.html"?>
-
- <title>The End</title>
-
- <indexterm zone="ch-finish-theend">
- <primary sortas="e-/etc/lfs-release">/etc/lfs-release</primary>
- </indexterm>
-
- <indexterm zone="ch-finish-theend">
- <primary sortas="e-/etc/lsb-release">/etc/lsb-release</primary>
- </indexterm>
-
- <indexterm zone="ch-finish-theend">
- <primary sortas="e-/etc/os-release">/etc/os-release</primary>
- </indexterm>
-
- <para>Well done! The new LFS system is installed! We wish you much
- success with your shiny new custom-built Linux system.</para>
-
- <para>It may be a good idea to create an
- <filename>/etc/lfs-release</filename> file. By having this file, it is very
- easy for you (and for us if you need to ask for help at some point) to find
- out which LFS version is installed on the system. Create this file by
- running:</para>
-
-<screen revision="sysv"><userinput>echo &version; &gt; /etc/lfs-release</userinput></screen>
-
-<screen revision="systemd"><userinput>echo &versiond; &gt; /etc/lfs-release</userinput></screen>
-
- <para>Two files describing the installed system may be used by packages
- that will be installed on the system, either in binary form or by building
- them.</para>
-
- <para>The first one shows the status of your
- new system with respect to the Linux Standards Base (LSB). To create
- this file, run:</para>
-
-<screen revision="sysv"><userinput>cat &gt; /etc/lsb-release &lt;&lt; "EOF"
-DISTRIB_ID="Linux From Scratch"
-DISTRIB_RELEASE="&version;"
-DISTRIB_CODENAME="&lt;your name here&gt;"
-DISTRIB_DESCRIPTION="Linux From Scratch"
-EOF</userinput></screen>
-
-<screen revision="systemd"><userinput>cat &gt; /etc/lsb-release &lt;&lt; "EOF"
-DISTRIB_ID="Linux From Scratch"
-DISTRIB_RELEASE="&versiond;"
-DISTRIB_CODENAME="&lt;your name here&gt;"
-DISTRIB_DESCRIPTION="Linux From Scratch"
-EOF</userinput></screen>
-
- <para>The second one contains roughly the same information, and is used
- by systemd and some graphical desktop environments. To create
- this file, run:</para>
-
-<screen revision="sysv"><userinput>cat &gt; /etc/os-release &lt;&lt; "EOF"
-NAME="Linux From Scratch"
-VERSION="&version;"
-ID=lfs
-PRETTY_NAME="Linux From Scratch &version;"
-VERSION_CODENAME="&lt;your name here&gt;"
-EOF</userinput></screen>
-
-<screen revision="systemd"><userinput>cat &gt; /etc/os-release &lt;&lt; "EOF"
-NAME="Linux From Scratch"
-VERSION="&versiond;"
-ID=lfs
-PRETTY_NAME="Linux From Scratch &versiond;"
-VERSION_CODENAME="&lt;your name here&gt;"
-EOF</userinput></screen>
-
- <para>Be sure to put some sort of customization for the fields
- 'DISTRIB_CODENAME' and 'VERSION_CODENAME' to make the system uniquely
- yours.</para>
-
-</sect1>
diff --git a/chapter09/udev.xml b/chapter09/udev.xml
new file mode 100644
index 000000000..6060849be
--- /dev/null
+++ b/chapter09/udev.xml
@@ -0,0 +1,342 @@
+<?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-config-udev">
+ <?dbhtml filename="udev.html"?>
+
+ <title>Overview of Device and Module Handling</title>
+
+ <indexterm zone="ch-config-udev">
+ <primary sortas="a-Udev">Udev</primary>
+ <secondary>usage</secondary>
+ </indexterm>
+
+ <para>In <xref linkend="chapter-building-system"/>, we installed the Udev
+ package when <phrase revision="sysv">eudev</phrase>
+ <phrase revision="systemd">systemd</phrase> was built. Before we go into the
+ details regarding how this works, a brief history of previous methods of
+ handling devices is in order.</para>
+
+ <para>Linux systems in general traditionally used a static device creation
+ method, whereby a great many device nodes were created under <filename
+ class="directory">/dev</filename> (sometimes literally thousands of nodes),
+ regardless of whether the corresponding hardware devices actually existed. This
+ was typically done via a <command>MAKEDEV</command> script, which contains a
+ number of calls to the <command>mknod</command> program with the relevant
+ major and minor device numbers for every possible device that might exist in
+ the world.</para>
+
+ <para>Using the Udev method, only those devices which are detected by the
+ kernel get device nodes created for them. Because these device nodes will be
+ created each time the system boots, they will be stored on a <systemitem
+ class="filesystem">devtmpfs</systemitem> file system (a virtual file system
+ that resides entirely in system memory). Device nodes do not require much
+ space, so the memory that is used is negligible.</para>
+
+ <sect2>
+ <title>History</title>
+
+ <para>In February 2000, a new filesystem called <systemitem
+ class="filesystem">devfs</systemitem> was merged into the 2.3.46 kernel
+ and was made available during the 2.4 series of stable kernels. Although
+ it was present in the kernel source itself, this method of creating devices
+ dynamically never received overwhelming support from the core kernel
+ developers.</para>
+
+ <para>The main problem with the approach adopted by <systemitem
+ class="filesystem">devfs</systemitem> was the way it handled device
+ detection, creation, and naming. The latter issue, that of device node
+ naming, was perhaps the most critical. It is generally accepted that if
+ device names are allowed to be configurable, then the device naming policy
+ should be up to a system administrator, not imposed on them by any
+ particular developer(s). The <systemitem
+ class="filesystem">devfs</systemitem> file system also suffered from race
+ conditions that were inherent in its design and could not be fixed without a
+ substantial revision to the kernel. It was marked as deprecated for a long
+ period &ndash; due to a lack of maintenance &ndash; and was finally removed
+ from the kernel in June, 2006.</para>
+
+ <para>With the development of the unstable 2.5 kernel tree, later released
+ as the 2.6 series of stable kernels, a new virtual filesystem called
+ <systemitem class="filesystem">sysfs</systemitem> came to be. The job of
+ <systemitem class="filesystem">sysfs</systemitem> is to export a view of
+ the system's hardware configuration to userspace processes. With this
+ userspace-visible representation, the possibility of developing a userspace
+ replacement for <systemitem class="filesystem">devfs</systemitem> became
+ much more realistic.</para>
+
+ </sect2>
+
+ <sect2>
+ <title>Udev Implementation</title>
+
+ <sect3>
+ <title>Sysfs</title>
+
+ <para>The <systemitem class="filesystem">sysfs</systemitem> filesystem
+ was mentioned briefly above. One may wonder how <systemitem
+ class="filesystem">sysfs</systemitem> knows about the devices present on
+ a system and what device numbers should be used for them. Drivers that
+ have been compiled into the kernel directly register their objects with a
+ <systemitem class="filesystem">sysfs</systemitem> (devtmpfs internally)
+ as they are detected by the kernel. For drivers compiled as modules, this
+ registration will happen when the module is loaded. Once the <systemitem
+ class="filesystem">sysfs</systemitem> filesystem is mounted (on /sys),
+ data which the drivers register with <systemitem
+ class="filesystem">sysfs</systemitem> are available to userspace
+ processes and to udevd for processing (including modifications to device
+ nodes).</para>
+
+ </sect3>
+
+ <sect3>
+ <title>Device Node Creation</title>
+
+ <para>Device files are created by the kernel by the <systemitem
+ class="filesystem">devtmpfs</systemitem> filesystem. Any driver that
+ wishes to register a device node will go through the <systemitem
+ class="filesystem">devtmpfs</systemitem> (via the driver core) to do it.
+ When a <systemitem class="filesystem">devtmpfs</systemitem> instance is
+ mounted on <filename class="directory">/dev</filename>, the device node
+ will initially be created with a fixed name, permissions, and
+ owner.</para>
+
+ <para>A short time later, the kernel will send a uevent to <command>
+ udevd</command>. Based on the rules specified in the files within the
+ <filename class="directory">/etc/udev/rules.d</filename>, <filename
+ class="directory">/lib/udev/rules.d</filename>, and <filename
+ class="directory">/run/udev/rules.d</filename> directories, <command>
+ udevd</command> will create additional symlinks to the device node, or
+ change its permissions, owner, or group, or modify the internal
+ <command>udevd</command> database entry (name) for that object.</para>
+
+ <para>The rules in these three directories are numbered and all three
+ directories are merged together. If <command>udevd</command> can't find a
+ rule for the device it is creating, it will leave the permissions and
+ ownership at whatever <systemitem
+ class="filesystem">devtmpfs</systemitem> used initially.</para> </sect3>
+
+ <sect3 id="module-loading">
+ <title>Module Loading</title>
+
+ <para>Device drivers compiled as modules may have aliases built into them.
+ Aliases are visible in the output of the <command>modinfo</command>
+ program and are usually related to the bus-specific identifiers of devices
+ supported by a module. For example, the <emphasis>snd-fm801</emphasis>
+ driver supports PCI devices with vendor ID 0x1319 and device ID 0x0801,
+ and has an alias of <quote>pci:v00001319d00000801sv*sd*bc04sc01i*</quote>.
+ For most devices, the bus driver exports the alias of the driver that
+ would handle the device via <systemitem
+ class="filesystem">sysfs</systemitem>. E.g., the
+ <filename>/sys/bus/pci/devices/0000:00:0d.0/modalias</filename> file
+ might contain the string
+ <quote>pci:v00001319d00000801sv00001319sd00001319bc04sc01i00</quote>.
+ The default rules provided with Udev will cause <command>udevd</command>
+ to call out to <command>/sbin/modprobe</command> with the contents of the
+ <envar>MODALIAS</envar> uevent environment variable (which should be the
+ same as the contents of the <filename>modalias</filename> file in sysfs),
+ thus loading all modules whose aliases match this string after wildcard
+ expansion.</para>
+
+ <para>In this example, this means that, in addition to
+ <emphasis>snd-fm801</emphasis>, the obsolete (and unwanted)
+ <emphasis>forte</emphasis> driver will be loaded if it is
+ available. See below for ways in which the loading of unwanted drivers can
+ be prevented.</para>
+
+ <para>The kernel itself is also able to load modules for network
+ protocols, filesystems and NLS support on demand.</para>
+
+ </sect3>
+
+ <sect3>
+ <title>Handling Hotpluggable/Dynamic Devices</title>
+
+ <para>When you plug in a device, such as a Universal Serial Bus (USB) MP3
+ player, the kernel recognizes that the device is now connected and
+ generates a uevent. This uevent is then handled by
+ <command>udevd</command> as described above.</para>
+
+ </sect3>
+
+ </sect2>
+
+ <sect2>
+ <title>Problems with Loading Modules and Creating Devices</title>
+
+ <para>There are a few possible problems when it comes to automatically
+ creating device nodes.</para>
+
+ <sect3>
+ <title>A kernel module is not loaded automatically</title>
+
+ <para>Udev will only load a module if it has a bus-specific alias and the
+ bus driver properly exports the necessary aliases to <systemitem
+ class="filesystem">sysfs</systemitem>. In other cases, one should
+ arrange module loading by other means. With Linux-&linux-version;, Udev is
+ known to load properly-written drivers for INPUT, IDE, PCI, USB, SCSI,
+ SERIO, and FireWire devices.</para>
+
+ <para>To determine if the device driver you require has the necessary
+ support for Udev, run <command>modinfo</command> with the module name as
+ the argument. Now try locating the device directory under
+ <filename class="directory">/sys/bus</filename> and check whether there is
+ a <filename>modalias</filename> file there.</para>
+
+ <para>If the <filename>modalias</filename> file exists in <systemitem
+ class="filesystem">sysfs</systemitem>, the driver supports the device and
+ can talk to it directly, but doesn't have the alias, it is a bug in the
+ driver. Load the driver without the help from Udev and expect the issue
+ to be fixed later.</para>
+
+ <para>If there is no <filename>modalias</filename> file in the relevant
+ directory under <filename class="directory">/sys/bus</filename>, this
+ means that the kernel developers have not yet added modalias support to
+ this bus type. With Linux-&linux-version;, this is the case with ISA
+ busses. Expect this issue to be fixed in later kernel versions.</para>
+
+ <para>Udev is not intended to load <quote>wrapper</quote> drivers such as
+ <emphasis>snd-pcm-oss</emphasis> and non-hardware drivers such as
+ <emphasis>loop</emphasis> at all.</para>
+
+ </sect3>
+
+ <sect3>
+ <title>A kernel module is not loaded automatically, and Udev is not
+ intended to load it</title>
+
+ <para>If the <quote>wrapper</quote> module only enhances the
+ functionality provided by some other module (e.g.,
+ <emphasis>snd-pcm-oss</emphasis> enhances the functionality of
+ <emphasis>snd-pcm</emphasis> by making the sound cards available to OSS
+ applications), configure <command>modprobe</command> to load the wrapper
+ after Udev loads the wrapped module. To do this, add a
+ <quote>softdep</quote> line to the corresponding
+ <filename>/etc/modprobe.d/<replaceable>&lt;filename&gt;</replaceable>.conf</filename>
+ file. For example:</para>
+
+<screen role="nodump"><literal>softdep snd-pcm post: snd-pcm-oss</literal></screen>
+
+ <para>Note that the <quote>softdep</quote> command also allows
+ <literal>pre:</literal> dependencies, or a mixture of both
+ <literal>pre:</literal> and <literal>post:</literal>. See the
+ <filename>modprobe.d(5)</filename> manual page for more information
+ on <quote>softdep</quote> syntax and capabilities.</para>
+
+ <para>If the module in question is not a wrapper and is useful by itself,
+ configure the <command>modules</command> bootscript to load this
+ module on system boot. To do this, add the module name to the
+ <filename>/etc/sysconfig/modules</filename> file on a separate line.
+ This works for wrapper modules too, but is suboptimal in that case.</para>
+
+ </sect3>
+
+ <sect3>
+ <title>Udev loads some unwanted module</title>
+
+ <para>Either don't build the module, or blacklist it in a
+ <filename>/etc/modprobe.d/blacklist.conf</filename> file as done with the
+ <emphasis>forte</emphasis> module in the example below:</para>
+
+<screen role="nodump"><literal>blacklist forte</literal></screen>
+
+ <para>Blacklisted modules can still be loaded manually with the
+ explicit <command>modprobe</command> command.</para>
+
+ </sect3>
+
+ <sect3>
+ <title>Udev creates a device incorrectly, or makes a wrong symlink</title>
+
+ <para>This usually happens if a rule unexpectedly matches a device. For
+ example, a poorly-written rule can match both a SCSI disk (as desired)
+ and the corresponding SCSI generic device (incorrectly) by vendor.
+ Find the offending rule and make it more specific, with the help of the
+ <command>udevadm info</command> command.</para>
+
+ </sect3>
+
+ <sect3>
+ <title>Udev rule works unreliably</title>
+
+ <para>This may be another manifestation of the previous problem. If not,
+ and your rule uses <systemitem class="filesystem">sysfs</systemitem>
+ attributes, it may be a kernel timing issue, to be fixed in later kernels.
+ For now, you can work around it by creating a rule that waits for the used
+ <systemitem class="filesystem">sysfs</systemitem> attribute and appending
+ it to the <filename>/etc/udev/rules.d/10-wait_for_sysfs.rules</filename>
+ file (create this file if it does not exist). Please notify the LFS
+ Development list if you do so and it helps.</para>
+
+ </sect3>
+
+ <sect3>
+ <title>Udev does not create a device</title>
+
+ <para>Further text assumes that the driver is built statically into the
+ kernel or already loaded as a module, and that you have already checked
+ that Udev doesn't create a misnamed device.</para>
+
+ <para>Udev has no information needed to create a device node if a kernel
+ driver does not export its data to
+ <systemitem class="filesystem">sysfs</systemitem>. This is most common
+ with third party drivers from outside the kernel tree. Create a static
+ device node in <filename>/lib/udev/devices</filename> with the
+ appropriate major/minor numbers (see the file
+ <filename>devices.txt</filename> inside the kernel documentation or the
+ documentation provided by the third party driver vendor). The static
+ device node will be copied to <filename class="directory">/dev</filename>
+ by <command>udev</command>.</para>
+
+ </sect3>
+
+ <sect3>
+ <title>Device naming order changes randomly after rebooting</title>
+
+ <para>This is due to the fact that Udev, by design, handles uevents and
+ loads modules in parallel, and thus in an unpredictable order. This will
+ never be <quote>fixed</quote>. You should not rely upon the kernel device
+ names being stable. Instead, create your own rules that make symlinks with
+ stable names based on some stable attributes of the device, such as a
+ serial number or the output of various *_id utilities installed by Udev.
+ See <xref linkend="ch-config-symlinks"/> and
+ <xref linkend="ch-config-network"/> for examples.</para>
+
+ </sect3>
+
+ </sect2>
+
+ <sect2>
+ <title>Useful Reading</title>
+
+ <para>Additional helpful documentation is available at the following
+ sites:</para>
+
+ <itemizedlist>
+
+ <listitem>
+ <para>A Userspace Implementation of <systemitem class="filesystem">devfs</systemitem>
+ <ulink url="http://www.kroah.com/linux/talks/ols_2003_udev_paper/Reprint-Kroah-Hartman-OLS2003.pdf"/></para>
+ </listitem>
+
+ <listitem>
+ <para>The <systemitem class="filesystem">sysfs</systemitem> Filesystem
+ <ulink url="http://www.kernel.org/pub/linux/kernel/people/mochel/doc/papers/ols-2005/mochel.pdf"/></para>
+ </listitem>
+
+<!-- No longer available
+ <listitem>
+ <para>Pointers to further reading
+ <ulink url="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html"/>
+ </para>
+ </listitem>
+-->
+ </itemizedlist>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter09/usage.xml b/chapter09/usage.xml
new file mode 100644
index 000000000..4a4cf6c36
--- /dev/null
+++ b/chapter09/usage.xml
@@ -0,0 +1,710 @@
+<?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">
+ <!ENTITY site SYSTEM "../appendices/rc.site.script">
+ %general-entities;
+]>
+
+<sect1 id="ch-config-usage" revision="sysv">
+ <?dbhtml filename="usage.html"?>
+
+ <title>System V Bootscript Usage and Configuration</title>
+
+ <indexterm zone="ch-config-usage">
+ <primary sortas="a-Bootscripts">Bootscripts</primary>
+ <secondary>usage</secondary>
+ </indexterm>
+
+ <sect2>
+ <title>How Do the System V Bootscripts Work?</title>
+
+ <para>Linux uses a special booting facility named SysVinit that is based on a
+ concept of <emphasis>run-levels</emphasis>. It can be quite different from one
+ system to another, so it cannot be assumed that because things worked in one
+ particular Linux distribution, they should work the same in LFS too. LFS has its
+ own way of doing things, but it respects generally accepted standards.</para>
+
+ <para>SysVinit (which will be referred to as <quote>init</quote> from now on)
+ works using a run-levels scheme. There are seven (numbered 0 to 6) run-levels
+ (actually, there are more run-levels, but they are for special cases and are
+ generally not used. See <filename>init(8)</filename> for more details), and
+ each one of those corresponds to the actions the computer is supposed to
+ perform when it starts up. The default run-level is 3. Here are the
+ descriptions of the different run-levels as they are implemented:</para>
+
+<literallayout>0: halt the computer
+1: single-user mode
+2: multi-user mode without networking
+3: multi-user mode with networking
+4: reserved for customization, otherwise does the same as 3
+5: same as 4, it is usually used for GUI login (like X's <command>xdm</command> or KDE's <command>kdm</command>)
+6: reboot the computer</literallayout>
+
+ </sect2>
+
+ <sect2 id="conf-sysvinit" role="configuration">
+ <title>Configuring Sysvinit</title>
+
+ <indexterm zone="conf-sysvinit">
+ <primary sortas="a-Sysvinit">Sysvinit</primary>
+ <secondary>configuring</secondary>
+ </indexterm>
+
+ <indexterm zone="conf-sysvinit">
+ <primary sortas="e-/etc/inittab">/etc/inittab</primary>
+ </indexterm>
+
+ <para>During the kernel initialization, the first program that is run
+ is either specified on the command line or, by default
+ <command>init</command>. This program reads the initialization file
+ <filename>/etc/inittab</filename>. Create this file with:</para>
+
+<screen><userinput>cat &gt; /etc/inittab &lt;&lt; "EOF"
+<literal># Begin /etc/inittab
+
+id:3:initdefault:
+
+si::sysinit:/etc/rc.d/init.d/rc S
+
+l0:0:wait:/etc/rc.d/init.d/rc 0
+l1:S1:wait:/etc/rc.d/init.d/rc 1
+l2:2:wait:/etc/rc.d/init.d/rc 2
+l3:3:wait:/etc/rc.d/init.d/rc 3
+l4:4:wait:/etc/rc.d/init.d/rc 4
+l5:5:wait:/etc/rc.d/init.d/rc 5
+l6:6:wait:/etc/rc.d/init.d/rc 6
+
+ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
+
+su:S016:once:/sbin/sulogin
+
+1:2345:respawn:/sbin/agetty --noclear tty1 9600
+2:2345:respawn:/sbin/agetty tty2 9600
+3:2345:respawn:/sbin/agetty tty3 9600
+4:2345:respawn:/sbin/agetty tty4 9600
+5:2345:respawn:/sbin/agetty tty5 9600
+6:2345:respawn:/sbin/agetty tty6 9600
+
+# End /etc/inittab</literal>
+EOF</userinput></screen>
+
+ <para>An explanation of this initialization file is in the man page for
+ <emphasis>inittab</emphasis>. For LFS, the key command that is run is
+ <command>rc</command>. The initialization file above will instruct
+ <command>rc</command> to run all the scripts starting with an S in the
+ <filename class="directory">/etc/rc.d/rcS.d</filename> directory
+ followed by all the scripts starting with an S in the <filename
+ class="directory">/etc/rc.d/rc?.d</filename> directory where the question
+ mark is specified by the initdefault value.</para>
+
+ <para>As a convenience, the <command>rc</command> script reads a library of
+ functions in <filename class="directory">/lib/lsb/init-functions</filename>.
+ This library also reads an optional configuration file,
+ <filename>/etc/sysconfig/rc.site</filename>. Any of the system
+ configuration file parameters described in subsequent sections can be
+ alternatively placed in this file allowing consolidation of all system
+ parameters in this one file.</para>
+
+ <para>As a debugging convenience, the functions script also logs all output
+ to <filename>/run/var/bootlog</filename>. Since the <filename
+ class="directory">/run</filename> directory is a tmpfs, this file is not
+ persistent across boots, however it is appended to the more permanent file
+ <filename>/var/log/boot.log</filename> at the end of the boot process.</para>
+
+ <sect3 id="init-levels" >
+ <title>Changing Run Levels</title>
+
+ <para>Changing run-levels is done with <command>init
+ <replaceable>&lt;runlevel&gt;</replaceable></command>, where
+ <replaceable>&lt;runlevel&gt;</replaceable> is the target run-level. For example, to
+ reboot the computer, a user could issue the <command>init 6</command> command,
+ which is an alias for the <command>reboot</command> command. Likewise,
+ <command>init 0</command> is an alias for the <command>halt</command>
+ command.</para>
+
+ <para>There are a number of directories under <filename
+ class="directory">/etc/rc.d</filename> that look like <filename
+ class="directory">rc?.d</filename> (where ? is the number of the run-level) and
+ <filename class="directory">rcsysinit.d</filename>, all containing a number of
+ symbolic links. Some begin with a <emphasis>K</emphasis>, the others begin with
+ an <emphasis>S</emphasis>, and all of them have two numbers following the
+ initial letter. The K means to stop (kill) a service and the S means to start a
+ service. The numbers determine the order in which the scripts are run, from 00
+ to 99&mdash;the lower the number the earlier it gets executed. When
+ <command>init</command> switches to another run-level, the appropriate services
+ are either started or stopped, depending on the runlevel chosen.</para>
+
+ <para>The real scripts are in <filename
+ class="directory">/etc/rc.d/init.d</filename>. They do the actual work, and
+ the symlinks all point to them. K links and S links point to
+ the same script in <filename class="directory">/etc/rc.d/init.d</filename>.
+ This is because the scripts can be called with different parameters like
+ <parameter>start</parameter>, <parameter>stop</parameter>,
+ <parameter>restart</parameter>, <parameter>reload</parameter>, and
+ <parameter>status</parameter>. When a K link is encountered, the appropriate
+ script is run with the <parameter>stop</parameter> argument. When an S link
+ is encountered, the appropriate script is run with the
+ <parameter>start</parameter> argument.</para>
+
+ <para>There is one exception to this explanation. Links that start
+ with an <emphasis>S</emphasis> in the <filename
+ class="directory">rc0.d</filename> and <filename
+ class="directory">rc6.d</filename> directories will not cause anything
+ to be started. They will be called with the parameter
+ <parameter>stop</parameter> to stop something. The logic behind this
+ is that when a user is going to reboot or halt the system, nothing
+ needs to be started. The system only needs to be stopped.</para>
+
+ <para>These are descriptions of what the arguments make the scripts
+ do:</para>
+
+ <variablelist>
+
+ <varlistentry>
+ <term><parameter>start</parameter></term>
+ <listitem>
+ <para>The service is started.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>stop</parameter></term>
+ <listitem>
+ <para>The service is stopped.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>restart</parameter></term>
+ <listitem>
+ <para>The service is stopped and then started again.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>reload</parameter></term>
+ <listitem>
+ <para>The configuration of the service is updated.
+ This is used after the configuration file of a service was modified, when
+ the service does not need to be restarted.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>status</parameter></term>
+ <listitem>
+ <para>Tells if the service is running and with which PIDs.</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <para>Feel free to modify the way the boot process works (after all,
+ it is your own LFS system). The files given here are an example of how
+ it can be done.</para>
+
+ </sect3>
+ </sect2>
+
+ <sect2>
+ <title>Udev Bootscripts</title>
+
+ <para>The <filename>/etc/rc.d/init.d/udev</filename> initscript starts
+ <command>udevd</command>, triggers any "coldplug" devices that have
+ already been created by the kernel and waits for any rules to complete.
+ The script also unsets the uevent handler from the default of
+ <filename>/sbin/hotplug </filename>. This is done because the kernel no
+ longer needs to call out to an external binary. Instead
+ <command>udevd</command> will listen on a netlink socket for uevents that
+ the kernel raises.</para>
+
+ <para>The <command>/etc/rc.d/init.d/udev_retry</command> initscript takes
+ care of re-triggering events for subsystems whose rules may rely on
+ filesystems that are not mounted until the <command>mountfs</command>
+ script is run (in particular, <filename class="directory">/usr</filename>
+ and <filename class="directory">/var</filename> may cause this). This
+ script runs after the <command>mountfs</command> script, so those rules
+ (if re-triggered) should succeed the second time around. It is
+ configured from the <filename>/etc/sysconfig/udev_retry</filename> file;
+ any words in this file other than comments are considered subsystem names
+ to trigger at retry time. To find the subsystem of a device, use
+ <command>udevadm info --attribute-walk &lt;device&gt;</command> where
+ &lt;device&gt; is an absolute path in /dev or /sys such as /dev/sr0 or
+ /sys/class/rtc.</para>
+
+ <para>For information on kernel module loading and udev, see
+ <xref linkend="module-loading"/>.</para>
+<!--
+ <sect3>
+ <title>Module Loading</title>
+
+ <para>Device drivers compiled as modules may have aliases built into them.
+ Aliases are visible in the output of the <command>modinfo</command>
+ program and are usually related to the bus-specific identifiers of devices
+ supported by a module. For example, the <emphasis>snd-fm801</emphasis>
+ driver supports PCI devices with vendor ID 0x1319 and device ID 0x0801,
+ and has an alias of <quote>pci:v00001319d00000801sv*sd*bc04sc01i*</quote>.
+ For most devices, the bus driver exports the alias of the driver that
+ would handle the device via <systemitem
+ class="filesystem">sysfs</systemitem>. E.g., the
+ <filename>/sys/bus/pci/devices/0000:00:0d.0/modalias</filename> file
+ might contain the string
+ <quote>pci:v00001319d00000801sv00001319sd00001319bc04sc01i00</quote>.
+ The default rules provided with Udev will cause <command>udevd</command>
+ to call out to <command>/sbin/modprobe</command> with the contents of the
+ <envar>MODALIAS</envar> uevent environment variable (which should be the
+ same as the contents of the <filename>modalias</filename> file in sysfs),
+ thus loading all modules whose aliases match this string after wildcard
+ expansion.</para>
+
+ <para>In this example, this means that, in addition to
+ <emphasis>snd-fm801</emphasis>, the obsolete (and unwanted)
+ <emphasis>forte</emphasis> driver will be loaded if it is
+ available. See below for ways in which the loading of unwanted drivers can
+ be prevented.</para>
+
+ <para>The kernel itself is also able to load modules for network
+ protocols, filesystems and NLS support on demand.</para>
+
+ </sect3>
+
+ <sect3>
+ <title>Handling Hotpluggable/Dynamic Devices</title>
+
+ <para>When you plug in a device, such as a Universal Serial Bus (USB) MP3
+ player, the kernel recognizes that the device is now connected and
+ generates a uevent. This uevent is then handled by
+ <command>udevd</command> as described above.</para>
+
+ </sect3>
+-->
+ </sect2>
+
+ <sect2 id="ch-config-clock">
+ <title>Configuring the System Clock</title>
+
+ <indexterm zone="ch-config-clock">
+ <primary sortas="d-setclock">setclock</primary>
+ <secondary>configuring</secondary></indexterm>
+
+ <para>The <command>setclock</command> script reads the time from the hardware
+ clock, also known as the BIOS or the Complementary Metal Oxide Semiconductor
+ (CMOS) clock. If the hardware clock is set to UTC, this script will convert the
+ hardware clock's time to the local time using the
+ <filename>/etc/localtime</filename> file (which tells the
+ <command>hwclock</command> program which timezone the user is in). There is no
+ way to detect whether or not the hardware clock is set to UTC, so this
+ needs to be configured manually.</para>
+
+ <para>The <command>setclock</command> is run via
+ <application>udev</application> when the kernel detects the hardware
+ capability upon boot. It can also be run manually with the stop parameter to
+ store the system time to the CMOS clock.</para>
+
+ <para>If you cannot remember whether or not the hardware clock is set to UTC,
+ find out by running the <userinput>hwclock --localtime --show</userinput>
+ command. This will display what the current time is according to the hardware
+ clock. If this time matches whatever your watch says, then the hardware clock is
+ set to local time. If the output from <command>hwclock</command> is not local
+ time, chances are it is set to UTC time. Verify this by adding or subtracting
+ the proper amount of hours for the timezone to the time shown by
+ <command>hwclock</command>. For example, if you are currently in the MST
+ timezone, which is also known as GMT -0700, add seven hours to the local
+ time.</para>
+
+ <para>Change the value of the <envar>UTC</envar> variable below
+ to a value of <parameter>0</parameter> (zero) if the hardware clock
+ is <emphasis>not</emphasis> set to UTC time.</para>
+
+ <para>Create a new file <filename>/etc/sysconfig/clock</filename> by running
+ the following:</para>
+
+<screen><userinput>cat &gt; /etc/sysconfig/clock &lt;&lt; "EOF"
+<literal># Begin /etc/sysconfig/clock
+
+UTC=1
+
+# Set this to any options you might need to give to hwclock,
+# such as machine hardware clock type for Alphas.
+CLOCKPARAMS=
+
+# End /etc/sysconfig/clock</literal>
+EOF</userinput></screen>
+
+ <para>A good hint explaining how to deal with time on LFS is available
+ at <ulink url="&hints-root;time.txt"/>. It explains issues such as
+ time zones, UTC, and the <envar>TZ</envar> environment variable.</para>
+
+ <note><para>The CLOCKPARAMS and UTC paramaters may be alternatively set
+ in the <filename>/etc/sysconfig/rc.site</filename> file.</para></note>
+
+ </sect2>
+
+ <sect2 id="ch-config-console">
+ <?dbhtml filename="console.html"?>
+
+ <title>Configuring the Linux Console</title>
+
+ <indexterm zone="ch-config-console">
+ <primary sortas="d-console">console</primary>
+ <secondary>configuring</secondary>
+ </indexterm>
+
+ <para>This section discusses how to configure the <command>console</command>
+ bootscript that sets up the keyboard map, console font and console kernel log
+ level. If non-ASCII characters (e.g., the copyright sign, the British pound
+ sign and Euro symbol) will not be used and the keyboard is a U.S. one, much
+ of this section can be skipped. Without the configuration file, (or
+ equivalent settings in <filename>rc.site</filename>), the
+ <command>console</command> bootscript will do nothing.</para>
+
+ <para>The <command>console</command> script reads the
+ <filename>/etc/sysconfig/console</filename> file for configuration
+ information. Decide which keymap and screen font will be used. Various
+ language-specific HOWTOs can also help with this, see <ulink
+ url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>. If still in
+ doubt, look in the <filename class="directory">/usr/share/keymaps</filename>
+ and <filename class="directory">/usr/share/consolefonts</filename> directories
+ for valid keymaps and screen fonts. Read <filename>loadkeys(1)</filename> and
+ <filename>setfont(8)</filename> manual pages to determine the correct
+ arguments for these programs.</para>
+
+ <para>The <filename>/etc/sysconfig/console</filename> file should contain lines
+ of the form: VARIABLE="value". The following variables are recognized:</para>
+ <variablelist>
+
+ <varlistentry>
+ <term>LOGLEVEL</term>
+ <listitem>
+ <para>This variable specifies the log level for kernel messages sent
+ to the console as set by <command>dmesg -n</command>. Valid levels are
+ from "1" (no messages) to "8". The default level is "7".</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>KEYMAP</term>
+ <listitem>
+ <para>This variable specifies the arguments for the
+ <command>loadkeys</command> program, typically, the name of keymap
+ to load, e.g., <quote>it</quote>. If this variable is not set, the
+ bootscript will not run the <command>loadkeys</command> program,
+ and the default kernel keymap will be used. Note that a few keymaps
+ have multiple versions with the same name (cz and its variants in
+ qwerty/ and qwertz/, es in olpc/ and qwerty/, and trf in fgGIod/ and
+ qwerty/). In these cases the parent directory should also be specified
+ (e.g. qwerty/es) to ensure the proper keymap is loaded.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>KEYMAP_CORRECTIONS</term>
+ <listitem>
+ <para>This (rarely used) variable
+ specifies the arguments for the second call to the
+ <command>loadkeys</command> program. This is useful if the stock keymap
+ is not completely satisfactory and a small adjustment has to be made. E.g.,
+ to include the Euro sign into a keymap that normally doesn't have it,
+ set this variable to <quote>euro2</quote>.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>FONT</term>
+ <listitem>
+ <para>This variable specifies the arguments for the
+ <command>setfont</command> program. Typically, this includes the font
+ name, <quote>-m</quote>, and the name of the application character
+ map to load. E.g., in order to load the <quote>lat1-16</quote> font
+ together with the <quote>8859-1</quote> application character map
+ (as it is appropriate in the USA),
+ <!-- because of the copyright sign -->
+ set this variable to <quote>lat1-16 -m 8859-1</quote>.
+ In UTF-8 mode, the kernel uses the application character map for
+ conversion of composed 8-bit key codes in the keymap to UTF-8, and thus
+ the argument of the "-m" parameter should be set to the encoding of the
+ composed key codes in the keymap.</para>
+
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>UNICODE</term>
+ <listitem>
+ <para>Set this variable to <quote>1</quote>, <quote>yes</quote> or
+ <quote>true</quote> in order to put the
+ console into UTF-8 mode. This is useful in UTF-8 based locales and
+ harmful otherwise.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>LEGACY_CHARSET</term>
+ <listitem>
+ <para>For many keyboard layouts, there is no stock Unicode keymap in
+ the Kbd package. The <command>console</command> bootscript will
+ convert an available keymap to UTF-8 on the fly if this variable is
+ set to the encoding of the available non-UTF-8 keymap.</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <para>Some examples:</para>
+
+ <itemizedlist>
+
+ <listitem>
+ <para>For a non-Unicode setup, only the KEYMAP and FONT variables are
+ generally needed. E.g., for a Polish setup, one would use:</para>
+<screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
+<literal># Begin /etc/sysconfig/console
+
+KEYMAP="pl2"
+FONT="lat2a-16 -m 8859-2"
+
+# End /etc/sysconfig/console</literal>
+EOF</userinput></screen>
+ </listitem>
+
+ <listitem>
+ <para>As mentioned above, it is sometimes necessary to adjust a
+ stock keymap slightly. The following example adds the Euro symbol to the
+ German keymap:</para>
+
+<screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
+<literal># Begin /etc/sysconfig/console
+
+KEYMAP="de-latin1"
+KEYMAP_CORRECTIONS="euro2"
+FONT="lat0-16 -m 8859-15"
+UNICODE="1"
+
+# End /etc/sysconfig/console</literal>
+EOF</userinput></screen>
+ </listitem>
+
+ <listitem>
+ <para>The following is a Unicode-enabled example for Bulgarian, where a
+ stock UTF-8 keymap exists:</para>
+<!-- This is what is used by jhalfs for creating the console file: whenever
+ you change the following, please inform the jhalfs maintainer(s). -->
+<screen><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
+<literal># Begin /etc/sysconfig/console
+
+UNICODE="1"
+KEYMAP="bg_bds-utf8"
+FONT="LatArCyrHeb-16"
+
+# End /etc/sysconfig/console</literal>
+EOF</userinput></screen>
+ </listitem>
+
+ <listitem>
+ <para>Due to the use of a 512-glyph LatArCyrHeb-16 font in the previous
+ example, bright colors are no longer available on the Linux console unless
+ a framebuffer is used. If one wants to have bright colors without
+ framebuffer and can live without characters not belonging to his language,
+ it is still possible to use a language-specific 256-glyph font, as
+ illustrated below:</para>
+
+<screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
+<literal># Begin /etc/sysconfig/console
+
+UNICODE="1"
+KEYMAP="bg_bds-utf8"
+FONT="cyr-sun16"
+
+# End /etc/sysconfig/console</literal>
+EOF</userinput></screen>
+ </listitem>
+
+ <listitem>
+ <para>The following example illustrates keymap autoconversion from
+ ISO-8859-15 to UTF-8 and enabling dead keys in Unicode mode:</para>
+
+<screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
+<literal># Begin /etc/sysconfig/console
+
+UNICODE="1"
+KEYMAP="de-latin1"
+KEYMAP_CORRECTIONS="euro2"
+LEGACY_CHARSET="iso-8859-15"
+FONT="LatArCyrHeb-16 -m 8859-15"
+
+# End /etc/sysconfig/console</literal>
+EOF</userinput></screen>
+ </listitem>
+
+ <listitem>
+ <para>Some keymaps have dead keys (i.e., keys that don't produce a
+ character by themselves, but put an accent on the character produced
+ by the next key) or define composition rules (such as: <quote>press
+ Ctrl+. A E to get &AElig;</quote> in the default keymap).
+ Linux-&linux-version; interprets dead keys and composition rules in the
+ keymap correctly only when the source characters to be composed together
+ are not multibyte. This deficiency doesn't affect keymaps for European
+ languages, because there accents are added to unaccented ASCII
+ characters, or two ASCII characters are composed together. However, in
+ UTF-8 mode it is a problem, e.g., for the Greek language, where one
+ sometimes needs to put an accent on the letter <quote>alpha</quote>.
+ The solution is either to avoid the use of UTF-8, or to install the
+ X window system that doesn't have this limitation in its input
+ handling.</para>
+ </listitem>
+
+ <listitem>
+ <para>For Chinese, Japanese, Korean and some other languages, the Linux
+ console cannot be configured to display the needed characters. Users
+ who need such languages should install the X Window System, fonts that
+ cover the necessary character ranges, and the proper input method (e.g.,
+ SCIM, it supports a wide variety of languages).</para>
+ </listitem>
+
+ </itemizedlist>
+
+ <!-- Added because folks keep posting their console file with X questions
+ to blfs-support list -->
+ <note>
+ <para>The <filename>/etc/sysconfig/console</filename> file only controls
+ the Linux text console localization. It has nothing to do with setting
+ the proper keyboard layout and terminal fonts in the X Window System, with
+ ssh sessions or with a serial console. In such situations, limitations
+ mentioned in the last two list items above do not apply.</para>
+ </note>
+
+ </sect2>
+
+ <sect2 id="ch-config-createfiles">
+ <title>Creating Files at Boot</title>
+
+ <indexterm zone="ch-config-createfiles">
+ <primary sortas="d-createfiles">File creation at boot</primary>
+ <secondary>configuring</secondary>
+ </indexterm>
+
+ <para>At times, it is desired to create files at boot time. For instance,
+ the <filename class="directory">/tmp/.ICE-unix</filename> directory
+ may be desired. This can be done by creating an entry in the
+ <filename>/etc/sysconfig/createfiles</filename> configuration script.
+ The format of this file is embedded in the comments of the default
+ configuration file.</para>
+ </sect2>
+
+ <sect2 id="ch-config-sysklogd">
+ <title>Configuring the sysklogd Script</title>
+
+ <indexterm zone="ch-config-sysklogd">
+ <primary sortas="d-sysklogd">sysklogd</primary>
+ <secondary>configuring</secondary>
+ </indexterm>
+
+ <para>The <filename>sysklogd</filename> script invokes the
+ <command>syslogd</command> program as a part of System V initialization. The
+ <parameter>-m 0</parameter> option turns off the periodic timestamp mark that
+ <command>syslogd</command> writes to the log files every 20 minutes by
+ default. If you want to turn on this periodic timestamp mark, edit
+ <filename>/etc/sysconfig/rc.site</filename> and define the variable
+ SYSKLOGD_PARMS to the desired value. For instance, to remove all parameters,
+ set the variable to a null value:</para>
+
+<screen role="nodump">SYSKLOGD_PARMS=</screen>
+
+ <para>See <userinput>man syslogd</userinput> for more options.</para>
+
+ </sect2>
+
+ <sect2 id="ch-config-site">
+ <title>The rc.site File</title>
+
+ <indexterm zone="ch-config-site">
+ <primary sortas="a-rc.site">rc.site</primary>
+ </indexterm>
+
+ <para>The optional <filename>/etc/sysconfig/rc.site</filename> file contains
+ settings that are automatically set for each SystemV boot script. It can
+ alternatively set the values specified in the <filename>hostname</filename>,
+ <filename>console</filename>, and <filename>clock</filename> files in the
+ <filename class='directory'>/etc/sysconfig/</filename> directory. If the
+ associated variables are present in both these separate files and
+ <filename>rc.site</filename>, the values in the script specific files have
+ precedence. </para>
+
+ <para><filename>rc.site</filename> also contains parameters that can
+ customize other aspects of the boot process. Setting the IPROMPT variable
+ will enable selective running of bootscripts. Other options are described
+ in the file comments. The default version of the file is as follows:</para>
+
+ <!-- Use role to fix a pdf generation problem -->
+ <screen role="auto">&site;</screen>
+
+ <sect3>
+ <title>Customizing the Boot and Shutdown Scripts</title>
+
+ <para>The LFS boot scripts boot and shut down a system in a fairly
+ efficient manner, but there are a few tweaks that you can make in the
+ rc.site file to improve speed even more and to adjust messages according
+ to your preferences. To do this, adjust the settings in
+ the <filename>/etc/sysconfig/rc.site</filename> file above.</para>
+
+ <itemizedlist>
+
+ <listitem><para>During the boot script <filename>udev</filename>, there is
+ a call to <command>udev settle</command> that requires some time to
+ complete. This time may or may not be required depending on devices present
+ in the system. If you only have simple partitions and a single ethernet
+ card, the boot process will probably not need to wait for this command. To
+ skip it, set the variable OMIT_UDEV_SETTLE=y.</para></listitem>
+
+ <listitem><para>The boot script <filename>udev_retry</filename> also runs
+ <command>udev settle</command> by default. This command is only needed by
+ default if the <filename class='directory'>/var</filename> directory is
+ separately mounted. This is because the clock needs the file
+ <filename>/var/lib/hwclock/adjtime</filename>. Other customizations may
+ also need to wait for udev to complete, but in many installations it is not
+ needed. Skip the command by setting the variable OMIT_UDEV_RETRY_SETTLE=y.
+ </para></listitem>
+
+ <listitem><para>By default, the file system checks are silent. This can
+ appear to be a delay during the bootup process. To turn on the
+ <command>fsck</command> output, set the variable VERBOSE_FSCK=y.
+ </para></listitem>
+
+ <listitem><para>When rebooting, you may want to skip the filesystem check,
+ <command>fsck</command>, completely. To do this, either create the file
+ <filename>/fastboot</filename> or reboot the system with the command
+ <command>/sbin/shutdown -f -r now</command>. On the other hand, you can
+ force all file systems to be checked by creating
+ <filename>/forcefsck</filename> or running <command>shutdown</command> with
+ the <parameter>-F</parameter> parameter instead of <parameter>-f</parameter>.
+ </para>
+
+ <para>Setting the variable FASTBOOT=y will disable <command>fsck</command>
+ during the boot process until it is removed. This is not recommended
+ on a permanent basis.</para></listitem>
+
+ <listitem><para>Normally, all files in the <filename
+ class='directory'>/tmp</filename> directory are deleted at boot time.
+ Depending on the number of files or directories present, this can cause a
+ noticeable delay in the boot process. To skip removing these files set the
+ variable SKIPTMPCLEAN=y.</para></listitem>
+
+ <listitem><para>During shutdown, the <command>init</command> program sends
+ a TERM signal to each program it has started (e.g. agetty), waits for a set
+ time (default 3 seconds), and sends each process a KILL signal and waits
+ again. This process is repeated in the <command>sendsignals</command>
+ script for any processes that are not shut down by their own scripts. The
+ delay for <command>init</command> can be set by passing a parameter. For
+ example to remove the delay in <command>init</command>, pass the -t0
+ parameter when shutting down or rebooting (e.g. <command>/sbin/shutdown
+ -t0 -r now</command>). The delay for the <command>sendsignals</command>
+ script can be skipped by setting the parameter
+ KILLDELAY=0.</para></listitem>
+
+ </itemizedlist>
+
+ </sect3>
+ </sect2>
+</sect1>
diff --git a/chapter09/whatnow.xml b/chapter09/whatnow.xml
deleted file mode 100644
index 273eb7740..000000000
--- a/chapter09/whatnow.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-<?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-finish-whatnow">
- <?dbhtml filename="whatnow.html"?>
-
- <title>What Now?</title>
-
- <para>Thank you for reading this LFS book. We hope that you have
- found this book helpful and have learned more about the system
- creation process.</para>
-
- <para>Now that the LFS system is installed, you may be wondering
- <quote>What next?</quote> To answer that question, we have compiled a
- list of resources for you.</para>
-
- <itemizedlist>
-
- <listitem>
- <para>Maintenance</para>
-
- <para>Bugs and security notices are reported regularly for all software.
- Since an LFS system is compiled from source, it is up to you to keep
- abreast of such reports. There are several online resources that track
- such reports, some of which are shown below:</para>
-
- <itemizedlist>
-
- <listitem>
- <para><ulink url="http://www.cert.org/">CERT</ulink> (Computer
- Emergency Response Team)</para>
-
- <para>CERT has a mailing list that publishes security alerts concerning
- various operating systems and applications. Subscription information is
- available at <ulink
- url="http://www.us-cert.gov/cas/signup.html"/>.</para>
- </listitem>
-
- <listitem>
- <para>Bugtraq</para>
-
- <para>Bugtraq is a full-disclosure computer security mailing list. It
- publishes newly discovered security issues, and occasionally potential
- fixes for them. Subscription information is available at <ulink
- url="http://www.securityfocus.com/archive"/>.</para>
- </listitem>
-
- </itemizedlist>
- </listitem>
-
- <listitem>
- <para>Beyond Linux From Scratch</para>
-
- <para>The Beyond Linux From Scratch book covers installation
- procedures for a wide range of software beyond the scope of the LFS
- Book. The BLFS project is located at <ulink url="&blfs-root;"/>.</para>
- </listitem>
-
- <listitem>
- <para>LFS Hints</para>
-
- <para>The LFS Hints are a collection of educational documents
- submitted by volunteers in the LFS community. The hints are available
- at <ulink url="&hints-index;"/>.</para>
- </listitem>
-
- <listitem>
- <para>Mailing lists</para>
-
- <para>There are several LFS mailing lists you may subscribe to if you
- are in need of help, want to stay current with the latest developments,
- want to contribute to the project, and more. See <xref
- linkend="ch-intro-maillists"/> for more
- information.</para>
- </listitem>
-
- <listitem>
- <para>The Linux Documentation Project</para>
-
- <para>The goal of The Linux Documentation Project (TLDP) is to
- collaborate on all of the issues of Linux documentation. The TLDP features
- a large collection of HOWTOs, guides, and man pages. It is located at
- <ulink url="http://www.tldp.org/"/>.</para>
- </listitem>
-
- </itemizedlist>
-
-</sect1>