Rewrite and reorganize Chapter 7.

Update systemd customization.


git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@10542 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
Bruce Dubbs 2014-04-21 21:44:04 +00:00
parent c65dd23ee4
commit bf58c1eecd
11 changed files with 906 additions and 216 deletions

View File

@ -35,6 +35,16 @@
</itemizedlist> </itemizedlist>
</listitem> </listitem>
--> -->
<listitem>
<para>2014-03-21</para>
<itemizedlist>
<listitem>
<para>[bdubbs] - Rewrote and reorganized Chapter 7.
Updated systemd customization.</para>
</listitem>
</itemizedlist>
</listitem>
<listitem> <listitem>
<para>2014-04-18</para> <para>2014-04-18</para>
<itemizedlist> <itemizedlist>

View File

@ -24,8 +24,9 @@
<title/> <title/>
<para>The LFS-Bootscripts package contains a set of scripts to start/stop <para>The LFS-Bootscripts package contains a set of scripts to start/stop
the LFS system at bootup/shutdown. The networking systemd unit file is the LFS system at bootup/shutdown. A networking systemd unit file is
also installed.</para> also installed. The configuration files and procedures needed to
customize the boot process are described in the following sections.</para>
<segmentedlist> <segmentedlist>
<segtitle>&buildtime;</segtitle> <segtitle>&buildtime;</segtitle>

View File

@ -13,17 +13,17 @@
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduction.xml"/> <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"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bootscripts.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="network.xml"/>
<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="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="symlinks.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="network.xml"/>
<!-- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="hosts.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="usage.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="sysd-custom.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="sysd-custom.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="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="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="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="sysklogd.xml"/>-->
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="site.xml"/> <!-- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="site.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="profile.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="inputrc.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="inputrc.xml"/>

View File

@ -39,15 +39,15 @@
<filename>/etc/inittab</filename> file and is organized into run levels that <filename>/etc/inittab</filename> file and is organized into run levels that
can be run by the user:</para> can be run by the user:</para>
<itemizedlist> <literallayout>
<listitem><para>0 &mdash; halt</para></listitem> 0 &mdash; halt
<listitem><para>1 &mdash; Single user mode</para></listitem> 1 &mdash; Single user mode
<listitem><para>2 &mdash; Multiuser, without networking</para></listitem> 2 &mdash; Multiuser, without networking
<listitem><para>3 &mdash; Full multiuser mode</para></listitem> 3 &mdash; Full multiuser mode
<listitem><para>4 &mdash; User definable</para></listitem> 4 &mdash; User definable
<listitem><para>5 &mdash; Full multiuser mode with display manager</para></listitem> 5 &mdash; Full multiuser mode with display manager
<listitem><para>6 &mdash; reboot</para></listitem> 6 &mdash; reboot
</itemizedlist> </literallayout>
<para>The usual default run level is 3 or 5.</para> <para>The usual default run level is 3 or 5.</para>
@ -207,6 +207,11 @@ EOF
chmod 0744 /usr/sbin/set-sysv</userinput></screen> 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> <para>Now set the desired boot system. The default is System V:</para>
<screen><userinput remap="install">/usr/sbin/set-sysv</userinput></screen> <screen><userinput remap="install">/usr/sbin/set-sysv</userinput></screen>

View File

@ -24,106 +24,11 @@
class="directory">/etc/rc.d/rc*.d</filename>) after the bootscripts are class="directory">/etc/rc.d/rc*.d</filename>) after the bootscripts are
installed in <xref linkend="ch-scripts-bootscripts"/>.</para> 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>If using the traditional network interface names such as eth0 is desired,
generate a custom Udev rule:</para>
<screen><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 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> <sect2>
<title>Creating Network Interface Configuration Files</title> <title>Creating Network Interface Configuration Files</title>
<para>Which interfaces are brought up and down by the network script <para>Which interfaces are brought up and down by the network script
depends on the files in <filename usually depends on the files in <filename
class="directory">/etc/sysconfig/</filename>. This directory should class="directory">/etc/sysconfig/</filename>. This directory should
contain a file for each interface to be configured, such as contain a file for each interface to be configured, such as
<filename>ifconfig.xyz</filename>, where <quote>xyz</quote> is required to <filename>ifconfig.xyz</filename>, where <quote>xyz</quote> is required to
@ -216,12 +121,38 @@ EOF</userinput></screen>
<para>Replace eth0 with the correct network interface card <para>Replace eth0 with the correct network interface card
name as described on the beginning of this page.</para> name as described on the beginning of this page.</para>
<note><para>These procedures require the configuartion files as specified
in the previous section.</para></note>
<note><para>The network card can also be started or stopped <note><para>The network card can also be started or stopped
with the traditional <command>ifup &lt;device&gt;</command> or with the traditional <command>ifup &lt;device&gt;</command> or
<command>ifdown &lt;device&gt;</command> commands.</para></note> <command>ifdown &lt;device&gt;</command> commands.</para></note>
</sect2> </sect2>
<sect2 id="systemd2-net-enable">
<title>Configuring the Network Interface Card for systemd-networkd</title>
<para>An alternative way to configure a NIC when booting with with
systemd is to create a configuration file recognized by the
systemd-networkd daemon. To configure the device create a file similar
to this:</para>
<screen role="nodump"><userinput>cat &gt; /etc/systemd/network/10-static-eth0.network &lt;&lt; "EOF"
[Match]
Name=eth0
[Network]
Address=192.168.0.2/24
Gateway=192.168.0.1
EOF</userinput></screen>
<para>You can use multiple .network files if desired. You can also specify
DHCP=yes instead of the Address and Gateway settings. See the man page for
systemd.network for more details,</para>
</sect2>
<sect2 id="resolv.conf"> <sect2 id="resolv.conf">
<title>Creating the /etc/resolv.conf File</title> <title>Creating the /etc/resolv.conf File</title>
@ -262,4 +193,100 @@ EOF</userinput></screen>
</sect2> </sect2>
<sect2 id="ch-scripts-hostname">
<title>Configuring the system hostname</title>
<indexterm zone="ch-scripts-hostname">
<primary sortas="d-hostname">hostname</primary>
<secondary>configuring</secondary>
</indexterm>
<para>During the boot process, both Systemd and System V use the same file
for establishing the system's hostname. This needs to be configured by
creating <filename>/etc/hostname</filename>.</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-scripts-hosts">
<title>Customizing the /etc/hosts File</title>
<indexterm zone="ch-scripts-hosts">
<primary sortas="e-/etc/hosts">/etc/hosts</primary>
</indexterm>
<indexterm zone="ch-scripts-hosts">
<primary sortas="d-localnet">localnet</primary>
<secondary>/etc/hosts</secondary>
</indexterm>
<indexterm zone="ch-scripts-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 (network card version)
127.0.0.1 localhost
<replaceable>&lt;192.168.1.1&gt;</replaceable> <replaceable>&lt;HOSTNAME.example.org&gt;</replaceable> <replaceable>[alias1] [alias2 ...]</replaceable>
# End /etc/hosts (network card version)</literal>
EOF</userinput></screen>
<para>The <replaceable>&lt;192.168.1.1&gt;</replaceable> and
<replaceable>&lt;HOSTNAME.example.org&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>
<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 <replaceable>&lt;HOSTNAME.example.org&gt;</replaceable> <replaceable>&lt;HOSTNAME&gt;</replaceable> localhost
# End /etc/hosts (no network card version)</literal>
EOF</userinput></screen>
</sect2>
</sect1> </sect1>

View File

@ -8,7 +8,151 @@
<sect1 id="ch-scripts-symlinks"> <sect1 id="ch-scripts-symlinks">
<?dbhtml filename="symlinks.html"?> <?dbhtml filename="symlinks.html"?>
<title>Creating Custom Symlinks to Devices</title> <title>Managing Devices</title>
<sect2>
<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="nodump"><userinput>bash /lib/udev/init-net-rules.sh</userinput></screen>
<para> Now, inspect th
<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 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>
<sect3>
<title>Custom Naming in Systemd</title>
<para>Network interface names can also be customized with a set of
files spcific to systemd. A file with a name such as 10-eth0.link
in the /etc/systemd/network directory can set an interface name. All
files in the directory will be applied in lexical order. Files
in the /lib/systemd/network directory with the same name as those
in /etc/systemd/network will be overridden. See the man page
for systemd.link for a full explanation.</para>
<para>An example file looks like:</para>
<screen role="nodump">[Match]
MACAddress=12:34:56:78:9a:bc
Driver=brcmsmac
Path=pci-0000:02:00.0-*
Type=wlan
Virtualization=no
Host=my-laptop
Architecture=x86-64
[Link]
Name=wireless0
MTUBytes=1450
BitsPerSecond=10M
WakeOnLan=magic
MACAddress=cb:a9:87:65:43:21</screen>
<para>The [Match] section specifies when to apply the rule. In
the example above, the entries can be shortened to the minimum
needed to uniquely identify the network device. Similarly,
the [Link] section only needs to specify the changes from the
default that are desired. In many cases, the only thing needed is
the Name entry.</para>
</sect3>
</sect2>
<sect2> <sect2>
@ -108,7 +252,7 @@
<filename>/dev/video1</filename> refers to the tuner, and sometimes <filename>/dev/video1</filename> refers to the tuner, and sometimes
after a reboot the order changes to the opposite one. after a reboot the order changes to the opposite one.
For all classes of hardware except sound cards and network cards, this is For all classes of hardware except sound cards and network cards, this is
fixable by creating udev rules for custom persistent symlinks. fixable by creating Udev rules for custom persistent symlinks.
The case of network cards is covered separately in The case of network cards is covered separately in
<xref linkend="ch-scripts-network"/>, and sound card configuration can <xref linkend="ch-scripts-network"/>, and sound card configuration can
be found in <ulink url="&blfs-root;view/svn/postlfs/devices.html">BLFS</ulink>.</para> be found in <ulink url="&blfs-root;view/svn/postlfs/devices.html">BLFS</ulink>.</para>

View File

@ -8,7 +8,7 @@
<sect1 id="ch-scripts-sysd-custom"> <sect1 id="ch-scripts-sysd-custom">
<?dbhtml filename="sysd-custom.html"?> <?dbhtml filename="sysd-custom.html"?>
<title>Systemd Customization</title> <title>Systemd Usage and Confiuration</title>
<indexterm zone="ch-scripts-sysd-custom"> <indexterm zone="ch-scripts-sysd-custom">
<primary sortas="e-Systemd">Systemd Customization</primary> <primary sortas="e-Systemd">Systemd Customization</primary>
@ -98,6 +98,143 @@ EOF</userinput></screen>
</sect2> </sect2>
<sect2 id="ch-scripts-systemd-console">
<title>Setting Console Fonts and Keyboard</title>
<indexterm zone="ch-scripts-systemd-console">
<primary sortas="d-console">systemd 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>
<screen role="nodump"><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 <command>localectl</command> command can
be used only on a system booted with Systemd.</para></note>
</sect2>
<sect2>
<title>Clock Configuration</title>
<indexterm zone="ch-scripts-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><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. Create the
<filename>/etc/adjtime</filename> file with the following contents <emphasis>if your
hardware clock is set to local time</emphasis>:</para>
<screen role="nodump"><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 create the file using that setting.</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 list of available time zones by running:</para>
<screen role="nodump"><userinput>timedatectl list-timezones</userinput></screen>
<note><para>The <command>timedatectl</command> command can
be used only on a system booted with Systemd.</para></note>
</sect2>
<sect2> <sect2>
<title>Debugging the Boot Sequence</title> <title>Debugging the Boot Sequence</title>

View File

@ -8,7 +8,7 @@
<sect1 id="ch-scripts-udev"> <sect1 id="ch-scripts-udev">
<?dbhtml filename="udev.html"?> <?dbhtml filename="udev.html"?>
<title>Device and Module Handling on an LFS System</title> <title>Overview of Device and Module Handling</title>
<indexterm zone="ch-scripts-udev"> <indexterm zone="ch-scripts-udev">
<primary sortas="a-Udev">Udev</primary> <primary sortas="a-Udev">Udev</primary>
@ -16,15 +16,15 @@
</indexterm> </indexterm>
<para>In <xref linkend="chapter-building-system"/>, we installed the Udev <para>In <xref linkend="chapter-building-system"/>, we installed the Udev
package. Before we go into the details regarding how this works, package as a part of systemd. Before we go into the details regarding how
a brief history of previous methods of handling devices is in this works, a brief history of previous methods of handling devices is in
order.</para> order.</para>
<para>Linux systems in general traditionally use a static device creation <para>Linux systems in general traditionally used a static device creation
method, whereby a great many device nodes are created under <filename method, whereby a great many device nodes were created under <filename
class="directory">/dev</filename> (sometimes literally thousands of nodes), class="directory">/dev</filename> (sometimes literally thousands of nodes),
regardless of whether the corresponding hardware devices actually exist. This regardless of whether the corresponding hardware devices actually existed. This
is typically done via a <command>MAKEDEV</command> script, which contains a was typically done via a <command>MAKEDEV</command> script, which contains a
number of calls to the <command>mknod</command> program with the relevant 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 major and minor device numbers for every possible device that might exist in
the world.</para> the world.</para>
@ -53,8 +53,8 @@
device names are allowed to be configurable, then the device naming policy 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 should be up to a system administrator, not imposed on them by any
particular developer(s). The <systemitem particular developer(s). The <systemitem
class="filesystem">devfs</systemitem> file system also suffers from race class="filesystem">devfs</systemitem> file system also suffered from race
conditions that are inherent in its design and cannot be fixed without a 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 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 period &ndash; due to a lack of maintenance &ndash; and was finally removed
from the kernel in June, 2006.</para> from the kernel in June, 2006.</para>
@ -64,7 +64,7 @@
<systemitem class="filesystem">sysfs</systemitem> came to be. The job of <systemitem class="filesystem">sysfs</systemitem> came to be. The job of
<systemitem class="filesystem">sysfs</systemitem> is to export a view of <systemitem class="filesystem">sysfs</systemitem> is to export a view of
the system's hardware configuration to userspace processes. With this the system's hardware configuration to userspace processes. With this
userspace-visible representation, the possibility of seeing a userspace userspace-visible representation, the possibility of developing a userspace
replacement for <systemitem class="filesystem">devfs</systemitem> became replacement for <systemitem class="filesystem">devfs</systemitem> became
much more realistic.</para> much more realistic.</para>
@ -97,7 +97,7 @@
<para>Device files are created by the kernel by the <systemitem <para>Device files are created by the kernel by the <systemitem
class="filesystem">devtmpfs</systemitem> filesystem. Any driver that class="filesystem">devtmpfs</systemitem> filesystem. Any driver that
wishes to register a device node will go through <systemitem wishes to register a device node will go through the <systemitem
class="filesystem">devtmpfs</systemitem> (via the driver core) to do it. class="filesystem">devtmpfs</systemitem> (via the driver core) to do it.
When a <systemitem class="filesystem">devtmpfs</systemitem> instance is When a <systemitem class="filesystem">devtmpfs</systemitem> instance is
mounted on <filename class="directory">/dev</filename>, the device node mounted on <filename class="directory">/dev</filename>, the device node
@ -113,53 +113,12 @@
change its permissions, owner, or group, or modify the internal change its permissions, owner, or group, or modify the internal
<command>udevd</command> database entry (name) for that object.</para> <command>udevd</command> database entry (name) for that object.</para>
<para>The rules in these three directories are numbered in a similar <para>The rules in these three directories are numbered and all three
fashion to the LFS-Bootscripts package and all three directories are directories are merged together. If <command>udevd</command> can't find a
merged together. If <command>udevd</command> can't find a rule for the rule for the device it is creating, it will leave the permissions and
device it is creating, it will leave the permissions and ownership at ownership at whatever <systemitem
whatever <systemitem class="filesystem">devtmpfs</systemitem> used class="filesystem">devtmpfs</systemitem> used initially.</para> </sect3>
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 &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>
</sect3>
<sect3> <sect3>
<title>Module Loading</title> <title>Module Loading</title>
@ -313,27 +272,6 @@
</sect3> </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 the
<command>udev</command> bootscript.</para>
</sect3>
<sect3> <sect3>
<title>Device naming order changes randomly after rebooting</title> <title>Device naming order changes randomly after rebooting</title>

View File

@ -2,32 +2,36 @@
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent"> <!ENTITY % general-entities SYSTEM "../general.ent">
<!ENTITY site SYSTEM "../appendices/rc.site.script">
%general-entities; %general-entities;
]> ]>
<sect1 id="ch-scripts-usage"> <sect1 id="ch-scripts-usage">
<?dbhtml filename="usage.html"?> <?dbhtml filename="usage.html"?>
<title>How Do the System V Bootscripts Work?</title> <title>System V Bootscript Usage and Configuration</title>
<indexterm zone="ch-scripts-usage"> <indexterm zone="ch-scripts-usage">
<primary sortas="a-Bootscripts">Bootscripts</primary> <primary sortas="a-Bootscripts">Bootscripts</primary>
<secondary>usage</secondary> <secondary>usage</secondary>
</indexterm> </indexterm>
<para>Linux uses a special booting facility named SysVinit that is based on a <sect2>
concept of <emphasis>run-levels</emphasis>. It can be quite different from one <title>How Do the System V Bootscripts Work?</title>
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) <para>Linux uses a special booting facility named SysVinit that is based on a
works using a run-levels scheme. There are seven (numbered 0 to 6) run-levels concept of <emphasis>run-levels</emphasis>. It can be quite different from one
(actually, there are more run-levels, but they are for special cases and are system to another, so it cannot be assumed that because things worked in one
generally not used. See <filename>init(8)</filename> for more details), and particular Linux distribution, they should work the same in LFS too. LFS has its
each one of those corresponds to the actions the computer is supposed to own way of doing things, but it respects generally accepted standards.</para>
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> <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 <literallayout>0: halt the computer
1: single-user mode 1: single-user mode
@ -37,6 +41,8 @@
5: same as 4, it is usually used for GUI login (like X's <command>xdm</command> or KDE's <command>kdm</command>) 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> 6: reboot the computer</literallayout>
</sect2>
<sect2 id="conf-sysvinit" role="configuration"> <sect2 id="conf-sysvinit" role="configuration">
<title>Configuring Sysvinit</title> <title>Configuring Sysvinit</title>
@ -106,9 +112,7 @@ EOF</userinput></screen>
persistent across boots, however it is appended to the more permanent file 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> <filename>/var/log/boot.log</filename> at the end of the boot process.</para>
</sect2> <sect3 id="init-levels" >
<sect2 id="init-levels" >
<title>Changing Run Levels</title> <title>Changing Run Levels</title>
<para>Changing run-levels is done with <command>init <para>Changing run-levels is done with <command>init
@ -200,6 +204,430 @@ EOF</userinput></screen>
it is your own LFS system). The files given here are an example of how it is your own LFS system). The files given here are an example of how
it can be done.</para> it can be done.</para>
</sect3>
</sect2> </sect2>
<sect2 id="ch-scripts-clock">
<title>Configuring the System Clock</title>
<sect3 id="ch-scripts-setclock">
<title>System V Clock Configuration</title>
<indexterm zone="ch-scripts-setclock">
<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>
</sect3>
</sect2>
<sect2 id="ch-scripts-console">
<?dbhtml filename="console.html"?>
<title>Configuring the Linux Console</title>
<indexterm zone="ch-scripts-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</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>es</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.</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"
# 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>
<screen role="nodump"><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-scripts-createfiles">
<title>Creating Files at Boot</title>
<indexterm zone="ch-scripts-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-scripts-sysklogd">
<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 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-scripts-site">
<title>The rc.site File</title>
<indexterm zone="ch-scripts-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> </sect1>

View File

@ -113,8 +113,8 @@ xorriso -as cdrecord -v dev=/dev/cdrw blank=as_needed grub-img.iso</userinput></
--> -->
</sect2> </sect2>
<sect2> <sect2 id="grub-cfg">
<title>Creating the Configuration File</title> <title>Creating the GRUB Configuration File</title>
<para>Generate <filename>/boot/grub/grub.cfg</filename>:</para> <para>Generate <filename>/boot/grub/grub.cfg</filename>:</para>

View File

@ -1,5 +1,5 @@
<!ENTITY version "SVN-20140418"> <!ENTITY version "SVN-20140421">
<!ENTITY releasedate "April 18, 2014"> <!ENTITY releasedate "April 21, 2014">
<!ENTITY copyrightdate "1999-2014"><!-- jhalfs needs a literal dash, not &ndash; --> <!ENTITY copyrightdate "1999-2014"><!-- jhalfs needs a literal dash, not &ndash; -->
<!ENTITY milestone "8.0"> <!ENTITY milestone "8.0">
<!ENTITY generic-version "development"> <!-- Use "development", "testing", or "x.y[-pre{x}]" --> <!ENTITY generic-version "development"> <!-- Use "development", "testing", or "x.y[-pre{x}]" -->