diff options
author | Krejzi <krejzi@linuxfromscratch.org> | 2013-02-15 21:14:37 +0000 |
---|---|---|
committer | Krejzi <krejzi@linuxfromscratch.org> | 2013-02-15 21:14:37 +0000 |
commit | f3317d4d6ec0c92c07e5f670882081ab518b5e39 (patch) | |
tree | e6fa4d79a690df7e88d357e09c9b42dcf0afff5a | |
parent | 4a4e0178687f1411081dc2eadf547a77bb4b397e (diff) |
Move Chapter 7 in place for Systemd.
git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/systemd/BOOK@10159 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
-rw-r--r-- | chapter07/bootscripts.xml | 329 | ||||
-rw-r--r-- | chapter07/chapter07.xml | 5 | ||||
-rw-r--r-- | chapter07/hostname.xml | 9 | ||||
-rw-r--r-- | chapter07/introduction.xml | 25 | ||||
-rw-r--r-- | chapter07/locale.xml (renamed from chapter07/profile.xml) | 45 | ||||
-rw-r--r-- | chapter07/network.xml | 98 | ||||
-rw-r--r-- | chapter07/symlinks.xml | 86 | ||||
-rw-r--r-- | chapter07/sysklogd.xml | 31 | ||||
-rw-r--r-- | chapter07/udev.xml | 40 | ||||
-rw-r--r-- | chapter07/usage.xml | 205 |
10 files changed, 16 insertions, 857 deletions
diff --git a/chapter07/bootscripts.xml b/chapter07/bootscripts.xml deleted file mode 100644 index 5c7d71cbd..000000000 --- a/chapter07/bootscripts.xml +++ /dev/null @@ -1,329 +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-scripts-bootscripts" role="wrap"> - <?dbhtml filename="bootscripts.html"?> - - <sect1info condition="script"> - <productname>lfs-bootscripts</productname> - <productnumber>&lfs-bootscripts-version;</productnumber> - <address>&lfs-bootscripts-url;</address> - </sect1info> - - <title>LFS-Bootscripts-&lfs-bootscripts-version;</title> - - <indexterm zone="ch-scripts-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.</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, mountkernfs, network, rc, reboot, - sendsignals, setclock, 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-scripts-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-scripts-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-scripts-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-scripts-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-scripts-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-scripts-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-scripts-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-scripts-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-scripts-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-scripts-bootscripts mountfs-bootscripts"> - <primary sortas="d-mountfs">mountfs</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="mountkernfs-bootscripts"> - <term><command>mountkernfs</command></term> - <listitem> - <para>Mounts virtual kernel file systems, such as <systemitem - class="filesystem">proc</systemitem></para> - <indexterm zone="ch-scripts-bootscripts mountkernfs-bootscripts"> - <primary sortas="d-mountkernfs">mountkernfs</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-scripts-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-scripts-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-scripts-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-scripts-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-scripts-bootscripts setclock-bootscripts"> - <primary sortas="d-setclock">setclock</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="static-bootscripts"> - <term><command>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-scripts-bootscripts static-bootscripts"> - <primary sortas="d-static">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-scripts-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-scripts-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-scripts-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-scripts-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-scripts-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 to - <filename class="directory">/etc/udev/rules.d</filename> if required</para> - <indexterm zone="ch-scripts-bootscripts udev-retry-bootscripts"> - <primary sortas="d-udev-retry">udev_retry</primary> - </indexterm> - </listitem> - </varlistentry> - - </variablelist> - - </sect2> - -</sect1> diff --git a/chapter07/chapter07.xml b/chapter07/chapter07.xml index dbf20b74d..a141539be 100644 --- a/chapter07/chapter07.xml +++ b/chapter07/chapter07.xml @@ -16,13 +16,10 @@ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="hosts.xml"/> <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"/> - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bootscripts.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="hostname.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="setclock.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="console.xml"/> - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="sysklogd.xml"/> - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="profile.xml"/> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="locale.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="inputrc.xml"/> </chapter> diff --git a/chapter07/hostname.xml b/chapter07/hostname.xml index 9addc0f2a..c26b2dc2b 100644 --- a/chapter07/hostname.xml +++ b/chapter07/hostname.xml @@ -15,14 +15,13 @@ <secondary>configuring</secondary> </indexterm> - <para>Part of the job of the <command>localnet</command> script is setting the - system's hostname. This needs to be configured in the - <filename>/etc/sysconfig/network</filename> file.</para> + <para>Systemd reads <filename>/etc/hostname</filename> to determine which + hostname should be set.</para> - <para>Create the <filename>/etc/sysconfig/network</filename> file and enter a + <para>Create the <filename>/etc/hostname</filename> file and enter a hostname by running:</para> -<screen><userinput>echo "HOSTNAME=<replaceable><lfs></replaceable>" > /etc/sysconfig/network</userinput></screen> +<screen><userinput>echo "<replaceable><lfs></replaceable>" > /etc/hostname</userinput></screen> <para><replaceable><lfs></replaceable> needs to be replaced with the name given to the computer. Do not enter the Fully Qualified Domain Name (FQDN) here. That diff --git a/chapter07/introduction.xml b/chapter07/introduction.xml index 0f3cac732..c2aa3fe94 100644 --- a/chapter07/introduction.xml +++ b/chapter07/introduction.xml @@ -34,28 +34,10 @@ </listitem> </itemizedlist> - <para>The next sections detail how to install and configure the LFS system - scripts needed during the boot process. Most of these scripts will work - without modification, but a few require additional configuration files - because they deal with hardware-dependent information.</para> - - <para>System-V style init scripts are employed in this book because they are - widely used and relatively simple. For additional options, a hint detailing - the BSD style init setup is available at <ulink - url="&hints-root;bsd-init.txt"/>. Searching the LFS mailing lists for - <quote>depinit</quote>, <quote>upstart</quote>, or <quote>systemd</quote> - will also offer additional information.</para> - - <para>If using an alternative style of init scripts, skip these sections.</para> + <para>Third, configuring hostname, keyboard layout and system clock.</para> <itemizedlist> <listitem> - <para><xref linkend="ch-scripts-bootscripts" role="."/></para> - </listitem> - <listitem> - <para><xref linkend="ch-scripts-usage" role="."/></para> - </listitem> - <listitem> <para><xref linkend="ch-scripts-hostname" role="."/></para> </listitem> <listitem> @@ -64,9 +46,6 @@ <listitem> <para><xref linkend="ch-scripts-console" role="."/></para> </listitem> - <listitem> - <para><xref linkend="ch-scripts-sysklogd" role="."/></para> - </listitem> </itemizedlist> @@ -75,7 +54,7 @@ <itemizedlist> <listitem> - <para><xref linkend="ch-scripts-profile" role="."/></para> + <para><xref linkend="ch-scripts-locale" role="."/></para> </listitem> <listitem> <para><xref linkend="ch-scripts-inputrc" role="."/></para> diff --git a/chapter07/profile.xml b/chapter07/locale.xml index af33993f3..f4c7443dc 100644 --- a/chapter07/profile.xml +++ b/chapter07/locale.xml @@ -5,39 +5,16 @@ %general-entities; ]> -<sect1 id="ch-scripts-profile"> - <?dbhtml filename="profile.html"?> +<sect1 id="ch-scripts-locale"> + <?dbhtml filename="locale.html"?> - <title>The Bash Shell Startup Files</title> + <title>Configuring the System Locale</title> - <indexterm zone="ch-scripts-profile"> - <primary sortas="e-/etc/profile">/etc/profile</primary> + <indexterm zone="ch-scripts-locale"> + <primary sortas="e-etc-locale-conf">/etc/locale.conf</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 + <para>The <filename>/etc/locale.conf</filename> below sets some environment variables necessary for native language support. Setting them properly results in:</para> @@ -135,14 +112,10 @@ LC_ALL=<locale name> locale int_prefix</userinput></screen> might provide some useful information.</para> <para>Once the proper locale settings have been determined, create the - <filename>/etc/profile</filename> file:</para> + <filename>/etc/locale.conf</filename> file:</para> -<screen><userinput>cat > /etc/profile << "EOF" -<literal># Begin /etc/profile - -export LANG=<replaceable><ll>_<CC>.<charmap><@modifiers></replaceable> - -# End /etc/profile</literal> +<screen><userinput>cat > /etc/locale.conf << "EOF" +<literal>LANG=<replaceable><ll>_<CC>.<charmap><@modifiers></replaceable></literal> EOF</userinput></screen> <para>The <quote>C</quote> (default) and <quote>en_US</quote> (the recommended diff --git a/chapter07/network.xml b/chapter07/network.xml index 8a721fb5a..e7146b79d 100644 --- a/chapter07/network.xml +++ b/chapter07/network.xml @@ -17,104 +17,6 @@ <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-scripts-bootscripts"/>.</para> - - <sect2 id='stable-net-names'> - <title>Creating stable names for network interfaces</title> - - <para>If there is only one network interface in the system to be - configured, this section is optional, although it will never be wrong to do - it. In many cases (e.g. a laptop with a wireless and a wired interface), - accomplishing the configuration in this section is necessary.</para> - - <para>With Udev and modular network drivers, the network interface numbering - is not persistent across reboots by default, because the drivers are loaded - in parallel and, thus, in random order. For example, on a computer having - two network cards made by Intel and Realtek, the network card manufactured - by Intel may become <filename class="devicefile">eth0</filename> and the - Realtek card becomes <filename class="devicefile">eth1</filename>. In some - cases, after a reboot the cards get renumbered the other way around. To - avoid this, Udev comes with a script and some rules to assign stable names - to network cards based on their MAC address.</para> - - <para>The rules were pre-generated in the build instructions for - <application>udev (systemd)</application> in the last chapter. 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 addresess have been assigned to - a network card manually or in a virtual environment such as Xen, - the network rules file may not have been generated because addresses - are not consistently assigned. In these cases, just continue to - the next section.</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>KERNEL=="eth*"</literal> - This key was added to the - Udev rule generator to handle machines that have multiple network - interfaces, all with the same MAC address (the PS3 is one such - machine). If the independent interfaces have different basenames, - this key will allow Udev to tell them apart. This is generally not - necessary for most Linux From Scratch users, but does not hurt.</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> - - </sect2> - <sect2> <title>Creating Network Interface Configuration Files</title> diff --git a/chapter07/symlinks.xml b/chapter07/symlinks.xml index 7f5c03532..da205e8da 100644 --- a/chapter07/symlinks.xml +++ b/chapter07/symlinks.xml @@ -12,92 +12,6 @@ <sect2> - <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>/lib/udev/rules.d/75-cd-aliases-generator.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>"/' \ - /lib/udev/rules.d/75-cd-aliases-generator.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-scripts-udev"/>, the order in diff --git a/chapter07/sysklogd.xml b/chapter07/sysklogd.xml deleted file mode 100644 index c2d784b67..000000000 --- a/chapter07/sysklogd.xml +++ /dev/null @@ -1,31 +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-scripts-sysklogd"> - <?dbhtml filename="sysklogd.html"?> - - <title>Configuring the sysklogd Script</title> - - <indexterm zone="ch-scripts-sysklogd"> - <primary sortas="d-sysklogd">sysklogd</primary> - <secondary>configuring</secondary> - </indexterm> - - <para>The <filename>sysklogd</filename> script invokes the - <command>syslogd</command> program with the <parameter>-m 0</parameter> - option. This 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> - -</sect1> diff --git a/chapter07/udev.xml b/chapter07/udev.xml index 3a287e8f1..101bf0106 100644 --- a/chapter07/udev.xml +++ b/chapter07/udev.xml @@ -121,46 +121,6 @@ initially.</para> </sect3> <sect3> - <title>Udev Bootscripts</title> - - <para>The first LFS bootscript, - <filename>/etc/init.d/mountvirtfs</filename> will copy any devices - located in <filename class="directory">/lib/udev/devices</filename> to - <filename class="directory">/dev</filename>. This is necessary because - some devices, directories, and symlinks are needed before the dynamic - device handling processes are available during the early stages of - booting a system, or are required by <command>udevd</command> itself. - Creating static device nodes in <filename - class="directory">/lib/udev/devices</filename> also provides an easy - workaround for devices that are not supported by the dynamic device - handling infrastructure.</para> - - <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 <device></command> where - <device> is a an absolure path in /dev or /sys such as /dev/sr0 or - /sys/class/rtc.</para> - - </sect3> - - <sect3> <title>Module Loading</title> <para>Device drivers compiled as modules may have aliases built into them. diff --git a/chapter07/usage.xml b/chapter07/usage.xml deleted file mode 100644 index 78c1268bb..000000000 --- a/chapter07/usage.xml +++ /dev/null @@ -1,205 +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-scripts-usage"> - <?dbhtml filename="usage.html"?> - - <title>How Do These Bootscripts Work?</title> - - <indexterm zone="ch-scripts-usage"> - <primary sortas="a-Bootscripts">Bootscripts</primary> - <secondary>usage</secondary> - </indexterm> - - <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 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 > /etc/inittab << "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 intialization file above will instruct - <command>rc</command> to run all the scripts starting with an S in the - <filename class="directory">/etc/rc.d/rcsysinit.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> - - </sect2> - - <sect2 id="init-levels" > - <title>Changing Run Levels</title> - - <para>Changing run-levels is done with <command>init - <replaceable><runlevel></replaceable></command>, where - <replaceable><runlevel></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—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> - - </sect2> - -</sect1> |