diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml
index 777d9d333..c084b13f1 100644
--- a/chapter01/changelog.xml
+++ b/chapter01/changelog.xml
@@ -35,6 +35,16 @@
-->
+
+ 2014-03-21
+
+
+ [bdubbs] - Rewrote and reorganized Chapter 7.
+ Updated systemd customization.
+
+
+
+
2014-04-18
diff --git a/chapter07/bootscripts.xml b/chapter07/bootscripts.xml
index 64e244d79..51a5b8f9c 100644
--- a/chapter07/bootscripts.xml
+++ b/chapter07/bootscripts.xml
@@ -24,8 +24,9 @@
The LFS-Bootscripts package contains a set of scripts to start/stop
- the LFS system at bootup/shutdown. The networking systemd unit file is
- also installed.
+ the LFS system at bootup/shutdown. A networking systemd unit file is
+ also installed. The configuration files and procedures needed to
+ customize the boot process are described in the following sections.
&buildtime;
diff --git a/chapter07/chapter07.xml b/chapter07/chapter07.xml
index ae298f0b0..695f471c5 100644
--- a/chapter07/chapter07.xml
+++ b/chapter07/chapter07.xml
@@ -13,17 +13,17 @@
-
-
+
+
-
-
-
-
-
+
+
+
+
+
diff --git a/chapter07/introduction.xml b/chapter07/introduction.xml
index 27c5dbba4..243bad3b9 100644
--- a/chapter07/introduction.xml
+++ b/chapter07/introduction.xml
@@ -39,15 +39,15 @@
/etc/inittab file and is organized into run levels that
can be run by the user:
-
- 0 — halt
- 1 — Single user mode
- 2 — Multiuser, without networking
- 3 — Full multiuser mode
- 4 — User definable
- 5 — Full multiuser mode with display manager
- 6 — reboot
-
+
+0 — halt
+1 — Single user mode
+2 — Multiuser, without networking
+3 — Full multiuser mode
+4 — User definable
+5 — Full multiuser mode with display manager
+6 — reboot
+
The usual default run level is 3 or 5.
@@ -207,6 +207,11 @@ EOF
chmod 0744 /usr/sbin/set-sysv
+ 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.
+
+
Now set the desired boot system. The default is System V:
/usr/sbin/set-sysv
diff --git a/chapter07/network.xml b/chapter07/network.xml
index 4134bb40c..97ecf894e 100644
--- a/chapter07/network.xml
+++ b/chapter07/network.xml
@@ -24,106 +24,11 @@
class="directory">/etc/rc.d/rc*.d) after the bootscripts are
installed in .
-
- Creating stable names for network interfaces
-
- 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.
-
- 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 eth0 and the
- Realtek card becomes eth1. 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.
-
- If using the traditional network interface names such as eth0 is desired,
- generate a custom Udev rule:
-
-bash /lib/udev/init-net-rules.sh
-
- Now, inspect the
- /etc/udev/rules.d/70-persistent-net.rules file, to
- find out which name was assigned to which network device:
-
-cat /etc/udev/rules.d/70-persistent-net.rules
-
- 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.
-
- 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.
-
- 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:
-
-
-
- SUBSYSTEM=="net" - This tells Udev to ignore
- devices that are not network cards.
-
-
- ACTION=="add" - 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).
-
-
- DRIVERS=="?*" - 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.
-
-
- ATTR{address} - The value of this key is the
- NIC's MAC address.
-
-
- ATTR{type}=="1" - 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.
-
-
- KERNEL=="eth*" - 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.
-
-
- NAME - The value of this key is the name that
- Udev will assign to this interface.
-
-
-
- The value of NAME 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 NAME value when
- creating your configuration files below.
-
-
-
Creating Network Interface Configuration Files
Which interfaces are brought up and down by the network script
- depends on the files in /etc/sysconfig/. This directory should
contain a file for each interface to be configured, such as
ifconfig.xyz, where xyz
is required to
@@ -216,12 +121,38 @@ EOF
Replace eth0 with the correct network interface card
name as described on the beginning of this page.
+ These procedures require the configuartion files as specified
+ in the previous section.
+
The network card can also be started or stopped
with the traditional ifup <device> or
ifdown <device> commands.
+
+ Configuring the Network Interface Card for systemd-networkd
+
+ 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:
+
+cat > /etc/systemd/network/10-static-eth0.network << "EOF"
+[Match]
+Name=eth0
+
+[Network]
+Address=192.168.0.2/24
+Gateway=192.168.0.1
+EOF
+
+ 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,
+
+
+
Creating the /etc/resolv.conf File
@@ -262,4 +193,100 @@ EOF
+
+ Configuring the system hostname
+
+
+ hostname
+ configuring
+
+
+ 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 /etc/hostname.
+
+ Create the /etc/hostname file and enter a
+ hostname by running:
+
+echo "<lfs>" > /etc/hostname
+
+ <lfs> 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
+ /etc/hosts file.
+
+
+
+
+ Customizing the /etc/hosts File
+
+
+ /etc/hosts
+
+
+
+ localnet
+ /etc/hosts
+
+
+
+ network
+ /etc/hosts
+
+
+ Decide on the IP address, fully-qualified domain name (FQDN), and
+ possible aliases for use in the /etc/hosts file. The
+ syntax is:
+
+IP_address myhost.example.org aliases
+
+ 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—most
+ users do not have this), make sure that the IP address is in the private
+ network IP address range. Valid ranges are:
+
+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
+
+ x can be any number in the range 16-31. y can be any number in the
+ range 0-255.
+
+ A valid private IP address could be 192.168.1.1. A valid FQDN for
+ this IP could be lfs.example.org.
+
+ Even if not using a network card, a valid FQDN is still required.
+ This is necessary for certain programs to operate correctly.
+
+ Create the /etc/hosts file by running:
+
+cat > /etc/hosts << "EOF"
+# Begin /etc/hosts (network card version)
+
+127.0.0.1 localhost
+<192.168.1.1> <HOSTNAME.example.org> [alias1] [alias2 ...]
+
+# End /etc/hosts (network card version)
+EOF
+
+ The <192.168.1.1> and
+ <HOSTNAME.example.org> 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.
+
+ If a network card is not going to be configured, create the
+ /etc/hosts file by running:
+
+cat > /etc/hosts << "EOF"
+# Begin /etc/hosts (no network card version)
+
+127.0.0.1 <HOSTNAME.example.org> <HOSTNAME> localhost
+
+# End /etc/hosts (no network card version)
+EOF
+
+
+
diff --git a/chapter07/symlinks.xml b/chapter07/symlinks.xml
index bba84e369..1d4467a15 100644
--- a/chapter07/symlinks.xml
+++ b/chapter07/symlinks.xml
@@ -8,7 +8,151 @@
- Creating Custom Symlinks to Devices
+ Managing Devices
+
+
+
+ Network Devices
+
+ 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.
+
+ 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.
+
+
+ Disabling Persistent Naming on the Kernel Command Line
+
+ The traditional naming scheme using eth0, eth1, etc can be
+ restored by adding net.ifnames=0 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 .
+
+
+
+ Creating Custom Udev Rules
+
+ 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:
+
+bash /lib/udev/init-net-rules.sh
+
+ Now, inspect th
+ /etc/udev/rules.d/70-persistent-net.rules file, to
+ find out which name was assigned to which network device:
+
+cat /etc/udev/rules.d/70-persistent-net.rules
+
+ 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.
+
+ 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.
+
+ 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:
+
+
+
+ SUBSYSTEM=="net" - This tells Udev to ignore
+ devices that are not network cards.
+
+
+ ACTION=="add" - 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).
+
+
+ DRIVERS=="?*" - 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.
+
+
+ ATTR{address} - The value of this key is the
+ NIC's MAC address.
+
+
+ ATTR{type}=="1" - 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.
+
+
+ NAME - The value of this key is the name that
+ Udev will assign to this interface.
+
+
+
+ The value of NAME 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 NAME value when
+ creating your configuration files below.
+
+
+
+
+ Custom Naming in Systemd
+
+ 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.
+
+ An example file looks like:
+
+[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
+
+ 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.
+
+
+
+
@@ -108,7 +252,7 @@
/dev/video1 refers to the tuner, and sometimes
after a reboot the order changes to the opposite one.
For all classes of hardware except sound cards and network cards, this is
- fixable by creating udev rules for custom persistent symlinks.
+ fixable by creating Udev rules for custom persistent symlinks.
The case of network cards is covered separately in
, and sound card configuration can
be found in BLFS.
diff --git a/chapter07/sysd-custom.xml b/chapter07/sysd-custom.xml
index 7f3d4864b..e5872ece9 100644
--- a/chapter07/sysd-custom.xml
+++ b/chapter07/sysd-custom.xml
@@ -8,7 +8,7 @@
- Systemd Customization
+ Systemd Usage and Confiuration
Systemd Customization
@@ -98,6 +98,143 @@ EOF
+
+ Setting Console Fonts and Keyboard
+
+
+ systemd console
+ configuring
+
+
+ This section discusses how to configure the
+ systemd-vconsole-setup system service, which configures
+ the virtual console font and console keymap.
+
+ The systemd-vconsole-setup service reads the
+ /etc/vconsole.conf file for configuration
+ information. Decide which keymap and screen font will be used. Various
+ language-specific HOWTOs can also help with this, see .
+ Examine localectl list-keymaps output for a list of
+ valid console keymaps. Look in
+ /usr/share/consolefonts
+ directory for valid screen fonts.
+
+ The /etc/vconsole.conf file should contain lines
+ of the form: VARIABLE="value". The following variables are recognized:
+
+
+
+
+ KEYMAP
+
+ This variable specifies the key mapping table for the keyboard. If
+ unset, it defaults to us.
+
+
+
+
+ KEYMAP_TOGGLE
+
+ This variable can be used to configure a second toggle keymap and
+ is unset by default.
+
+
+
+ FONT
+
+ This variable specifies the font used by the virtual
+ console.
+
+
+
+ FONT_MAP
+
+ This variable specifies the console map to be used.
+
+
+
+
+ FONT_UNIMAP
+
+ This variable specifies the unicode font map.
+
+
+
+
+
+ An example for a German keyboard and console is given below:
+
+cat > /etc/vconsole.conf << "EOF"
+KEYMAP=de-latin1
+FONT=Lat2-Terminus16
+EOF
+
+ You can change KEYMAP value at runtime by using the
+ localectl utility:
+
+localectl set-keymap MAP
+
+ Please note that localectl command can
+ be used only on a system booted with Systemd.
+
+
+
+
+ Clock Configuration
+
+
+ clock
+ configuring
+
+ This section discusses how to configure the
+ systemd-timedated system service, which configures
+ system clock and timezone.
+
+ systemd-timedated reads
+ /etc/adjtime, and depending on the contents of the file,
+ it sets the clock to either UTC or local time. Create the
+ /etc/adjtime file with the following contents if your
+ hardware clock is set to local time:
+
+cat > /etc/adjtime << "EOF"
+0.0 0 0.0
+0
+LOCAL
+EOF
+
+ If /etc/adjtime isn't present at first boot,
+ systemd-timedated will assume that hardware clock is
+ set to UTC and create the file using that setting.
+
+ You can also use the timedatectl utility to tell
+ systemd-timedated if your hardware clock is set to
+ UTC or local time:
+
+timedatectl set-local-rtc 1
+
+ timedatectl can also be used to change system time and
+ time zone.
+
+ To change your current system time, issue:
+
+timedatectl set-time YYYY:MM:DD HH:MM:SS
+
+ Hardware clock will also be updated accordingly.
+
+ To change your current time zone, issue:
+
+timedatectl set-timezone TIMEZONE
+
+ You can get list of available time zones by running:
+
+timedatectl list-timezones
+
+ The timedatectl command can
+ be used only on a system booted with Systemd.
+
+
+
Debugging the Boot Sequence
diff --git a/chapter07/udev.xml b/chapter07/udev.xml
index 7e11388d8..f8a73d8e9 100644
--- a/chapter07/udev.xml
+++ b/chapter07/udev.xml
@@ -8,7 +8,7 @@
- Device and Module Handling on an LFS System
+ Overview of Device and Module Handling
Udev
@@ -16,15 +16,15 @@
In , we installed the Udev
- package. Before we go into the details regarding how this works,
- a brief history of previous methods of handling devices is in
+ package as a part of systemd. Before we go into the details regarding how
+ this works, a brief history of previous methods of handling devices is in
order.
- Linux systems in general traditionally use a static device creation
- method, whereby a great many device nodes are created under Linux systems in general traditionally used a static device creation
+ method, whereby a great many device nodes were created under /dev (sometimes literally thousands of nodes),
- regardless of whether the corresponding hardware devices actually exist. This
- is typically done via a MAKEDEV script, which contains a
+ regardless of whether the corresponding hardware devices actually existed. This
+ was typically done via a MAKEDEV script, which contains a
number of calls to the mknod program with the relevant
major and minor device numbers for every possible device that might exist in
the world.
@@ -53,8 +53,8 @@
device names are allowed to be configurable, then the device naming policy
should be up to a system administrator, not imposed on them by any
particular developer(s). The devfs file system also suffers from race
- conditions that are inherent in its design and cannot be fixed without a
+ class="filesystem">devfs file system also suffered from race
+ conditions that were inherent in its design and could not be fixed without a
substantial revision to the kernel. It was marked as deprecated for a long
period – due to a lack of maintenance – and was finally removed
from the kernel in June, 2006.
@@ -64,7 +64,7 @@
sysfs came to be. The job of
sysfs is to export a view of
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 devfs became
much more realistic.
@@ -97,7 +97,7 @@
Device files are created by the kernel by the devtmpfs filesystem. Any driver that
- wishes to register a device node will go through devtmpfs (via the driver core) to do it.
When a devtmpfs instance is
mounted on /dev, the device node
@@ -113,53 +113,12 @@
change its permissions, owner, or group, or modify the internal
udevd database entry (name) for that object.
- The rules in these three directories are numbered in a similar
- fashion to the LFS-Bootscripts package and all three directories are
- merged together. If udevd can't find a rule for the
- device it is creating, it will leave the permissions and ownership at
- whatever devtmpfs used
- initially.
-
-
- Udev Bootscripts
-
- The first LFS bootscript,
- /etc/init.d/mountvirtfs will copy any devices
- located in /lib/udev/devices to
- /dev. 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 udevd itself.
- Creating static device nodes in /lib/udev/devices also provides an easy
- workaround for devices that are not supported by the dynamic device
- handling infrastructure.
-
- The /etc/rc.d/init.d/udev initscript starts
- udevd, 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
- /sbin/hotplug . This is done because the kernel no
- longer needs to call out to an external binary. Instead
- udevd will listen on a netlink socket for uevents that
- the kernel raises.
-
- The /etc/rc.d/init.d/udev_retry initscript takes
- care of re-triggering events for subsystems whose rules may rely on
- filesystems that are not mounted until the mountfs
- script is run (in particular, /usr
- and /var may cause this). This
- script runs after the mountfs script, so those rules
- (if re-triggered) should succeed the second time around. It is
- configured from the /etc/sysconfig/udev_retry 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
- udevadm info --attribute-walk <device> where
- <device> is an absolute path in /dev or /sys such as /dev/sr0 or
- /sys/class/rtc.
-
-
-
+ The rules in these three directories are numbered and all three
+ directories are merged together. If udevd can't find a
+ rule for the device it is creating, it will leave the permissions and
+ ownership at whatever devtmpfs used initially.
+
Module Loading
@@ -313,27 +272,6 @@
-
- Udev does not create a device
-
- 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.
-
- Udev has no information needed to create a device node if a kernel
- driver does not export its data to sysfs.
- This is most common with third party drivers from outside the kernel
- tree. Create a static device node in
- /lib/udev/devices with the appropriate major/minor
- numbers (see the file devices.txt inside the kernel
- documentation or the documentation provided by the third party driver
- vendor). The static device node will be copied to
- /dev by the
- udev bootscript.
-
-
-
Device naming order changes randomly after rebooting
diff --git a/chapter07/usage.xml b/chapter07/usage.xml
index 3250cd328..3eb323a6e 100644
--- a/chapter07/usage.xml
+++ b/chapter07/usage.xml
@@ -2,32 +2,36 @@
+
%general-entities;
]>
- How Do the System V Bootscripts Work?
+ System V Bootscript Usage and Configuration
Bootscripts
usage
- Linux uses a special booting facility named SysVinit that is based on a
- concept of run-levels. 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.
+
+ How Do the System V Bootscripts Work?
- SysVinit (which will be referred to as init
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 init(8) 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:
+ Linux uses a special booting facility named SysVinit that is based on a
+ concept of run-levels. 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.
+
+ SysVinit (which will be referred to as init
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 init(8) 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:
0: halt the computer
1: single-user mode
@@ -37,6 +41,8 @@
5: same as 4, it is usually used for GUI login (like X's xdm or KDE's kdm)
6: reboot the computer
+
+
Configuring Sysvinit
@@ -106,9 +112,7 @@ EOF
persistent across boots, however it is appended to the more permanent file
/var/log/boot.log at the end of the boot process.
-
-
-
+
Changing Run Levels
Changing run-levels is done with init
@@ -200,6 +204,430 @@ EOF
it is your own LFS system). The files given here are an example of how
it can be done.
+
+
+ Configuring the System Clock
+
+
+ System V Clock Configuration
+
+
+ setclock
+ configuring
+
+ The setclock 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
+ /etc/localtime file (which tells the
+ hwclock 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.
+
+ The setclock is run via
+ udev 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.
+
+ If you cannot remember whether or not the hardware clock is set to UTC,
+ find out by running the hwclock --localtime --show
+ 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 hwclock 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
+ hwclock. For example, if you are currently in the MST
+ timezone, which is also known as GMT -0700, add seven hours to the local
+ time.
+
+ Change the value of the UTC variable below
+ to a value of 0 (zero) if the hardware clock
+ is not set to UTC time.
+
+ Create a new file /etc/sysconfig/clock by running
+ the following:
+
+cat > /etc/sysconfig/clock << "EOF"
+# 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
+EOF
+
+ A good hint explaining how to deal with time on LFS is available
+ at . It explains issues such as
+ time zones, UTC, and the TZ environment variable.
+
+ The CLOCKPARAMS and UTC paramaters may be alternatively set
+ in the /etc/sysconfig/rc.site file.
+
+
+
+
+
+
+
+ Configuring the Linux Console
+
+
+ console
+ configuring
+
+
+ This section discusses how to configure the console
+ 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 rc.site), the
+ console bootscript will do nothing.
+
+ The console script reads the
+ /etc/sysconfig/console file for configuration
+ information. Decide which keymap and screen font will be used. Various
+ language-specific HOWTOs can also help with this, see . If still in
+ doubt, look in the /usr/share/keymaps
+ and /usr/share/consolefonts directories
+ for valid keymaps and screen fonts. Read loadkeys(1) and
+ setfont(8) manual pages to determine the correct
+ arguments for these programs.
+
+ The /etc/sysconfig/console file should contain lines
+ of the form: VARIABLE="value". The following variables are recognized:
+
+
+
+ LOGLEVEL
+
+ This variable specifies the log level for kernel messages sent
+ to the console as set by dmesg. Valid levels are
+ from "1" (no messages) to "8". The default level is "7".
+
+
+
+
+ KEYMAP
+
+ This variable specifies the arguments for the
+ loadkeys program, typically, the name of keymap
+ to load, e.g., es
. If this variable is not set, the
+ bootscript will not run the loadkeys program,
+ and the default kernel keymap will be used.
+
+
+
+
+ KEYMAP_CORRECTIONS
+
+ This (rarely used) variable
+ specifies the arguments for the second call to the
+ loadkeys 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 euro2
.
+
+
+
+
+ FONT
+
+ This variable specifies the arguments for the
+ setfont program. Typically, this includes the font
+ name, -m
, and the name of the application character
+ map to load. E.g., in order to load the lat1-16
font
+ together with the 8859-1
application character map
+ (as it is appropriate in the USA),
+
+ set this variable to lat1-16 -m 8859-1
.
+ 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.
+
+
+
+
+
+ UNICODE
+
+ Set this variable to 1
, yes
or
+ true
in order to put the
+ console into UTF-8 mode. This is useful in UTF-8 based locales and
+ harmful otherwise.
+
+
+
+
+ LEGACY_CHARSET
+
+ For many keyboard layouts, there is no stock Unicode keymap in
+ the Kbd package. The console 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.
+
+
+
+
+
+ Some examples:
+
+
+
+
+ For a non-Unicode setup, only the KEYMAP and FONT variables are
+ generally needed. E.g., for a Polish setup, one would use:
+cat > /etc/sysconfig/console << "EOF"
+# Begin /etc/sysconfig/console
+
+KEYMAP="pl2"
+FONT="lat2a-16 -m 8859-2"
+
+# End /etc/sysconfig/console
+EOF
+
+
+
+ As mentioned above, it is sometimes necessary to adjust a
+ stock keymap slightly. The following example adds the Euro symbol to the
+ German keymap:
+
+cat > /etc/sysconfig/console << "EOF"
+# Begin /etc/sysconfig/console
+
+KEYMAP="de-latin1"
+KEYMAP_CORRECTIONS="euro2"
+FONT="lat0-16 -m 8859-15"
+
+# End /etc/sysconfig/console
+EOF
+
+
+
+ The following is a Unicode-enabled example for Bulgarian, where a
+ stock UTF-8 keymap exists:
+
+cat > /etc/sysconfig/console << "EOF"
+# Begin /etc/sysconfig/console
+
+UNICODE="1"
+KEYMAP="bg_bds-utf8"
+FONT="LatArCyrHeb-16"
+
+# End /etc/sysconfig/console
+EOF
+
+
+
+ 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:
+
+cat > /etc/sysconfig/console << "EOF"
+# Begin /etc/sysconfig/console
+
+UNICODE="1"
+KEYMAP="bg_bds-utf8"
+FONT="cyr-sun16"
+
+# End /etc/sysconfig/console
+EOF
+
+
+
+ The following example illustrates keymap autoconversion from
+ ISO-8859-15 to UTF-8 and enabling dead keys in Unicode mode:
+
+cat > /etc/sysconfig/console << "EOF"
+# 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
+EOF
+
+
+
+ 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: press
+ Ctrl+. A E to get Æ
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 alpha
.
+ 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.
+
+
+
+ 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).
+
+
+
+
+
+
+ The /etc/sysconfig/console 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.
+
+
+
+
+
+ Creating Files at Boot
+
+
+ File creation at boot
+ configuring
+
+
+ At times, it is desired to create files at boot time. For instance,
+ the /tmp/.ICE-unix directory
+ may be desired. This can be done by creating an entry in the
+ /etc/sysconfig/createfiles configuration script.
+ The format of this file is embedded in the comments of the default
+ configuration file.
+
+
+
+ Configuring the sysklogd Script
+
+
+ sysklogd
+ configuring
+
+
+ The sysklogd script invokes the
+ syslogd program as a part of System V initialization. The
+ -m 0 option turns off the periodic timestamp mark that
+ syslogd writes to the log files every 20 minutes by
+ default. If you want to turn on this periodic timestamp mark, edit
+ /etc/sysconfig/rc.site and define the variable
+ SYSKLOGD_PARMS to the desired value. For instance, to remove all parameters,
+ set the variable to a null value:
+
+SYSKLOGD_PARMS=
+
+ See man syslogd for more options.
+
+
+
+
+ The rc.site File
+
+
+ rc.site
+
+
+ The optional /etc/sysconfig/rc.site file contains
+ settings that are automatically set for each SystemV boot script. It can
+ alternatively set the values specified in the hostname,
+ console, and clock files in the
+ /etc/sysconfig/ directory. If the
+ associated variables are present in both these separate files and
+ rc.site, the values in the script specific files have
+ precedence.
+
+ rc.site 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:
+
+
+ &site;
+
+
+ Customizing the Boot and Shutdown Scripts
+
+ 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 /etc/sysconfig/rc.site file above.
+
+
+
+ During the boot script udev, there is
+ a call to udev settle 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.
+
+ The boot script udev_retry also runs
+ udev settle by default. This command is only needed by
+ default if the /var directory is
+ separately mounted. This is because the clock needs the file
+ /var/lib/hwclock/adjtime. 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.
+
+
+ By default, the file system checks are silent. This can
+ appear to be a delay during the bootup process. To turn on the
+ fsck output, set the variable VERBOSE_FSCK=y.
+
+
+ When rebooting, you may want to skip the filesystem check,
+ fsck, completely. To do this, either create the file
+ /fastboot or reboot the system with the command
+ /sbin/shutdown -f -r now. On the other hand, you can
+ force all file systems to be checked by creating
+ /forcefsck or running shutdown with
+ the -F parameter instead of -f.
+
+
+ Setting the variable FASTBOOT=y will disable fsck
+ during the boot process until it is removed. This is not recommended
+ on a permanent basis.
+
+ Normally, all files in the /tmp 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.
+
+ During shutdown, the init 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 sendsignals
+ script for any processes that are not shut down by their own scripts. The
+ delay for init can be set by passing a parameter. For
+ example to remove the delay in init, pass the -t0
+ parameter when shutting down or rebooting (e.g. /sbin/shutdown
+ -t0 -r now). The delay for the sendsignals
+ script can be skipped by setting the parameter
+ KILLDELAY=0.
+
+
+
+
+
diff --git a/chapter08/grub.xml b/chapter08/grub.xml
index 1ff73d777..6d68f8605 100644
--- a/chapter08/grub.xml
+++ b/chapter08/grub.xml
@@ -113,8 +113,8 @@ xorriso -as cdrecord -v dev=/dev/cdrw blank=as_needed grub-img.iso
-->
-
- Creating the Configuration File
+
+ Creating the GRUB Configuration File
Generate /boot/grub/grub.cfg:
diff --git a/general.ent b/general.ent
index 11372b029..ac5a5ead0 100644
--- a/general.ent
+++ b/general.ent
@@ -1,5 +1,5 @@
-
-
+
+