diff options
Diffstat (limited to 'chapter07')
-rw-r--r-- | chapter07/bootscripts.xml | 9 | ||||
-rw-r--r-- | chapter07/chapter07.xml | 12 | ||||
-rw-r--r-- | chapter07/hostname.xml | 7 | ||||
-rw-r--r-- | chapter07/hosts.xml | 2 | ||||
-rw-r--r-- | chapter07/introduction.xml | 83 | ||||
-rw-r--r-- | chapter07/network.xml | 66 | ||||
-rw-r--r-- | chapter07/setclock.xml | 3 | ||||
-rw-r--r-- | chapter07/sysklogd.xml | 17 | ||||
-rw-r--r-- | chapter07/udev.xml | 8 | ||||
-rw-r--r-- | chapter07/usage.xml | 79 |
10 files changed, 224 insertions, 62 deletions
diff --git a/chapter07/bootscripts.xml b/chapter07/bootscripts.xml index b4e76ea48..151706572 100644 --- a/chapter07/bootscripts.xml +++ b/chapter07/bootscripts.xml @@ -49,7 +49,6 @@ <sect2 id="contents-bootscripts" role="content"> <title>Contents of LFS-Bootscripts</title> - <segmentedlist> <segtitle>Installed scripts</segtitle> <segtitle>Installed directories</segtitle> @@ -59,7 +58,7 @@ ifup, localnet, modules, mountfs, mountkernfs, network, rc, reboot, sendsignals, setclock, static, swap, sysctl, sysklogd, template, udev, and udev_retry</seg> - <seg>/etc/rc.d, /etc/sysconfig</seg> + <seg>/etc/rc.d, /etc/sysconfig, /lib/boot</seg> </seglistitem> </segmentedlist> @@ -140,7 +139,7 @@ <varlistentry id="ifdown-bootscripts"> <term><command>ifdown</command></term> <listitem> - <para>Assists the network script with stopping network devices</para> + <para>Stops a network device</para> <indexterm zone="ch-scripts-bootscripts ifdown-bootscripts"> <primary sortas="d-ifdown">ifdown</primary> </indexterm> @@ -150,7 +149,7 @@ <varlistentry id="ifup-bootscripts"> <term><command>ifup</command></term> <listitem> - <para>Assists the network script with starting network devices</para> + <para>Initializes a network device</para> <indexterm zone="ch-scripts-bootscripts ifup-bootscripts"> <primary sortas="d-ifup">ifup</primary> </indexterm> @@ -325,7 +324,7 @@ <term><command>udev_retry</command></term> <listitem> <para>Retries failed udev uevents, and copies generated rules - files from <filename class="directory">/dev/.udev</filename> to + files from to <filename class="directory">/etc/udev/rules.d</filename> if required</para> <indexterm zone="ch-scripts-bootscripts udev-retry-bootscripts"> <primary sortas="d-udev-retry">udev_retry</primary> diff --git a/chapter07/chapter07.xml b/chapter07/chapter07.xml index 2354ca9ea..dbf20b74d 100644 --- a/chapter07/chapter07.xml +++ b/chapter07/chapter07.xml @@ -12,17 +12,17 @@ <title>Setting Up System Bootscripts</title> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduction.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="symlinks.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bootscripts.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="usage.xml"/> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="hostname.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="setclock.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="console.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="sysklogd.xml"/> - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="inputrc.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="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="hostname.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="network.xml"/> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="inputrc.xml"/> </chapter> diff --git a/chapter07/hostname.xml b/chapter07/hostname.xml index 4046ccb88..9addc0f2a 100644 --- a/chapter07/hostname.xml +++ b/chapter07/hostname.xml @@ -8,10 +8,10 @@ <sect1 id="ch-scripts-hostname"> <?dbhtml filename="hostname.html"?> - <title>Configuring the localnet Script</title> + <title>Configuring the system hostname</title> <indexterm zone="ch-scripts-hostname"> - <primary sortas="d-localnet">localnet</primary> + <primary sortas="d-hostname">hostname</primary> <secondary>configuring</secondary> </indexterm> @@ -26,7 +26,6 @@ <para><replaceable><lfs></replaceable> needs to be replaced with the name given to the computer. Do not enter the Fully Qualified Domain Name (FQDN) here. That - information will be put in the <filename>/etc/hosts</filename> file in the next - section.</para> + information is put in the <filename>/etc/hosts</filename> file.</para> </sect1> diff --git a/chapter07/hosts.xml b/chapter07/hosts.xml index 2b1000037..13c0ccbbf 100644 --- a/chapter07/hosts.xml +++ b/chapter07/hosts.xml @@ -61,7 +61,7 @@ EOF</userinput></screen> <para>The <replaceable><192.168.1.1></replaceable> and <replaceable><HOSTNAME.example.org></replaceable> - values need to be changed for specific users or requirements (if + 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> diff --git a/chapter07/introduction.xml b/chapter07/introduction.xml index 8faa87840..b8afde239 100644 --- a/chapter07/introduction.xml +++ b/chapter07/introduction.xml @@ -10,18 +10,81 @@ <title>Introduction</title> - <para>This chapter details how to install and configure the LFS-Bootscripts - package. Most of these scripts will work without modification, but a few require - additional configuration files because they deal with hardware-dependent - information.</para> + <para>This chapter discusses configuration files and boot scripts. + First, the general configuration files needed to set up networking are + presented.</para> + + <itemizedlist> + <listitem> + <para><xref linkend="ch-scripts-network" role="."/></para> + </listitem> + <listitem> + <para><xref linkend="ch-scripts-hosts" role="."/></para> + </listitem> + </itemizedlist> + + <para>Second, issues that affect the proper setup of devices diescussed.</para> + <itemizedlist> + <listitem> + <para><xref linkend="ch-scripts-udev" role="."/></para> + </listitem> + <listitem> + <para><xref linkend="ch-scripts-symlinks" role="."/></para> + </listitem> + </itemizedlist> + + <para>The next sections detail how to install and configure the LFS system + scripts needed during the boot process. Most of these scripts will work + without modification, but a few require additional configuration files + because they deal with hardware-dependent information.</para> + <para>System-V style init scripts are employed in this book because they are - widely used. For additional options, a hint detailing the BSD style init setup - is available at <ulink url="&hints-root;bsd-init.txt"/>. - Searching the LFS mailing lists for <quote>depinit</quote> will also offer - additional choices.</para> + widely used and relatively simple. For additional options, a hint detailing + the BSD style init setup is available at <ulink + url="&hints-root;bsd-init.txt"/>. Searching the LFS mailing lists for + <quote>depinit</quote>, <quote>upstart</quote>, or <quote>systemd</quote> + will also offer additional information.</para> + + <para>If using an alternative style of init scripts, skip these sections.</para> + + <para>A listing of the boot scripts are found in <xref linkend="scripts" + role="."/>.</para> + + + <itemizedlist> + <listitem> + <para><xref linkend="ch-scripts-bootscripts" role="."/></para> + </listitem> + <listitem> + <para><xref linkend="ch-scripts-usage" role="."/></para> + </listitem> + <listitem> + <para><xref linkend="ch-scripts-hostname" role="."/></para> + </listitem> + <listitem> + <para><xref linkend="ch-scripts-setclock" role="."/></para> + </listitem> + <listitem> + <para><xref linkend="ch-scripts-console" role="."/></para> + </listitem> + <listitem> + <para><xref linkend="ch-scripts-sysklogd" role="."/></para> + </listitem> + </itemizedlist> + + + <para>Finally, there is a brief introduction to the scripts and configuration + files used when the user logs into the system.</para> + + <itemizedlist> + <listitem> + <para><xref linkend="ch-scripts-profile" role="."/></para> + </listitem> + <listitem> + <para><xref linkend="ch-scripts-inputrc" role="."/></para> + </listitem> + </itemizedlist> - <para>If using an alternative style of init scripts, skip this chapter - and move on to <xref linkend="chapter-bootable"/>.</para> </sect1> diff --git a/chapter07/network.xml b/chapter07/network.xml index 34c2679df..9556c0c05 100644 --- a/chapter07/network.xml +++ b/chapter07/network.xml @@ -8,7 +8,7 @@ <sect1 id="ch-scripts-network"> <?dbhtml filename="network.html"?> - <title>Configuring the network Script</title> + <title>General Network Configuration</title> <indexterm zone="ch-scripts-network"> <primary sortas="d-network">network</primary> @@ -26,6 +26,11 @@ <sect2> <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 @@ -112,21 +117,22 @@ done</userinput></screen> <title>Creating Network Interface Configuration Files</title> <para>Which interfaces are brought up and down by the network script - depends on the files and directories in the <filename - class="directory">/etc/sysconfig/network-devices</filename> hierarchy. - This directory should contain a sub-directory for each interface to be - configured, such as <filename>ifconfig.xyz</filename>, where - <quote>xyz</quote> is a network interface name. Inside this directory - would be files defining the attributes to this interface, such as its IP - address(es), subnet masks, and so forth.</para> - - <para>The following command creates a sample <filename>ipv4</filename> - file for the <emphasis>eth0</emphasis> device:</para> - -<screen><userinput>cd /etc/sysconfig/network-devices -mkdir -v ifconfig.eth0 -cat > ifconfig.eth0/ipv4 << "EOF" + depends on the files in <filename + class="directory">/etc/sysconfig/</filename>. This directory should + contain a file for each interface to be configured, such as + <filename>ifconfig.xyz</filename>, where <quote>xyz</quote> is is + meaningful to the administrator such as the device name (e.g. eth0). + Inside this file are attributes to this interface, such as its IP + address(es), subnet masks, and so forth. It is necessary that + the stem of the filename be <emphasis>ifconfig</emphasis>.</para> + + <para>The following command creates a sample file for the + <emphasis>eth0</emphasis> device with a static IP address:</para> + +<screen><userinput>cd /etc/sysconfig/ +cat > ifconfig.eth0 << "EOF" <literal>ONBOOT=yes +IFACE=eth0 SERVICE=ipv4-static IP=192.168.1.1 GATEWAY=192.168.1.2 @@ -135,19 +141,25 @@ BROADCAST=192.168.1.255</literal> EOF</userinput></screen> <para>The values of these variables must be changed in every file to match - the proper setup. If the <envar>ONBOOT</envar> variable is set to - <quote>yes</quote> the network script will bring up the Network Interface - Card (NIC) during booting of the system. If set to anything but - <quote>yes</quote> the NIC will be ignored by the network script and not - be brought up.</para> + the proper setup.</para> + + <para>If the <envar>ONBOOT</envar> variable is set to <quote>yes</quote> the + network script will bring up the Network Interface Card (NIC) during + booting of the system. If set to anything but <quote>yes</quote> the NIC + will be ignored by the network script and not be automatically brought up. + The interface can be manually started or stopped with the + <command>ifup</command> and <command>ifdown</command> commands.</para> + + <para>The <envar>IFACE</envar> variable defines the interface name, + for example, eth0. It is required for all network device configuration + files. </para> <para>The <envar>SERVICE</envar> variable defines the method used for obtaining the IP address. The LFS-Bootscripts package has a modular IP assignment format, and creating additional files in the <filename - class="directory">/etc/sysconfig/network-devices/services</filename> - directory allows other IP assignment methods. This is commonly used for - Dynamic Host Configuration Protocol (DHCP), which is addressed in the - BLFS book.</para> + class="directory">/lib/boot/</filename> directory allows other IP + assignment methods. This is commonly used for Dynamic Host Configuration + Protocol (DHCP), which is addressed in the BLFS book.</para> <para>The <envar>GATEWAY</envar> variable should contain the default gateway IP address, if one is present. If not, then comment out the @@ -189,6 +201,10 @@ nameserver <replaceable><IP address of your secondary nameserver></replace # End /etc/resolv.conf</literal> EOF</userinput></screen> + <para>The <varname>domain</varname> statement can be omitted + or replaced with a <varname>search</varname> statement. See the man page for + resolv.conf for more details.</para> + <para>Replace <replaceable><IP address of the nameserver></replaceable> with the IP address of the DNS most appropriate for the setup. There will often be more than one entry (requirements demand secondary servers for @@ -196,6 +212,8 @@ EOF</userinput></screen> second <emphasis>nameserver</emphasis> line from the file. The IP address may also be a router on the local network.</para> + <note><para>The Google Public IPv4 DNS addresses are 8.8.8.8 and 8.8.4.4.</para></note> + </sect2> </sect1> diff --git a/chapter07/setclock.xml b/chapter07/setclock.xml index 854b889c6..8acd27e54 100644 --- a/chapter07/setclock.xml +++ b/chapter07/setclock.xml @@ -62,4 +62,7 @@ EOF</userinput></screen> 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/init_params</filename> file.</para></note> + </sect1> diff --git a/chapter07/sysklogd.xml b/chapter07/sysklogd.xml index 3b34889a9..fe5de2503 100644 --- a/chapter07/sysklogd.xml +++ b/chapter07/sysklogd.xml @@ -16,11 +16,16 @@ </indexterm> <para>The <filename>sysklogd</filename> script invokes the - <command>syslogd</command> program with the <parameter>-m 0</parameter> option. - This option turns off the periodic timestamp mark that - <command>syslogd</command> writes to the log files every 20 minutes by default. - If you want to turn on this periodic timestamp mark, edit the - <filename>sysklogd</filename> script and make the changes accordingly. See - <userinput>man syslogd</userinput> for more information.</para> + <command>syslogd</command> program with the <parameter>-m 0</parameter> + option. This option turns off the periodic timestamp mark that + <command>syslogd</command> writes to the log files every 20 minutes by + default. If you want to turn on this periodic timestamp mark, create or edit + <filename>/etc/sysconfig/init_params</filename> and define the variable + SYSKLOGD_PARMS to the desired value. For instance, to remove all parameters, + set the variable to a null value:</para> + +<screen role="nodump">SYSKLOGD_PARMS=</screen> + + <para>See <userinput>man syslogd</userinput> for more options.</para> </sect1> diff --git a/chapter07/udev.xml b/chapter07/udev.xml index 8084b9ea6..5bb769caa 100644 --- a/chapter07/udev.xml +++ b/chapter07/udev.xml @@ -95,7 +95,7 @@ <sect3> <title>Udev Bootscript</title> - <para>The <command>S10udev</command> initscript takes care of creating + <para>The <command>/etc/rc.d/init.d/udev</command> initscript takes care of creating device nodes when Linux is booted. The script unsets the uevent handler from the default of <command>/sbin/hotplug</command>. This is done because the kernel no longer needs to call out to an external binary. @@ -200,7 +200,7 @@ class="filesystem">sysfs</systemitem>. In other cases, one should arrange module loading by other means. With Linux-&linux-version;, Udev is known to load properly-written drivers for INPUT, IDE, PCI, USB, SCSI, - SERIO and FireWire devices.</para> + SERIO, and FireWire devices.</para> <para>To determine if the device driver you require has the necessary support for Udev, run <command>modinfo</command> with the module name as @@ -243,7 +243,7 @@ /sbin/modprobe snd-pcm-oss ; true</literal></screen> <para>If the module in question is not a wrapper and is useful by itself, - configure the <command>S05modules</command> bootscript to load this + configure the <command>modules</command> bootscript to load this module on system boot. To do this, add the module name to the <filename>/etc/sysconfig/modules</filename> file on a separate line. This works for wrapper modules too, but is suboptimal in that case.</para> @@ -306,7 +306,7 @@ 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>S10udev</command> bootscript.</para> + <command>udev</command> bootscript.</para> </sect3> diff --git a/chapter07/usage.xml b/chapter07/usage.xml index 334c471b7..a679381c5 100644 --- a/chapter07/usage.xml +++ b/chapter07/usage.xml @@ -37,7 +37,80 @@ 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> - <para>The command used to change run-levels is <command>init + <sect2 id="conf-sysvinit" role="configuration"> + <title>Configuring Sysvinit</title> + + <indexterm zone="conf-sysvinit"> + <primary sortas="a-Sysvinit">Sysvinit</primary> + <secondary>configuring</secondary> + </indexterm> + + <indexterm zone="conf-sysvinit"> + <primary sortas="e-/etc/inittab">/etc/inittab</primary> + </indexterm> + + <para>During the kernel initialization, the first program that is run + is either specified on the command line or, by default + <command>init</command>. This program reads the initialization file + <filename>/etc/inittab</filename>. Create this file with:</para> + +<screen><userinput>cat > /etc/inittab << "EOF" +<literal># Begin /etc/inittab + +id:3:initdefault: + +si::sysinit:/etc/rc.d/init.d/rc sysinit + +l0:0:wait:/etc/rc.d/init.d/rc 0 +l1:S1:wait:/etc/rc.d/init.d/rc 1 +l2:2:wait:/etc/rc.d/init.d/rc 2 +l3:3:wait:/etc/rc.d/init.d/rc 3 +l4:4:wait:/etc/rc.d/init.d/rc 4 +l5:5:wait:/etc/rc.d/init.d/rc 5 +l6:6:wait:/etc/rc.d/init.d/rc 6 + +ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now + +su:S016:once:/sbin/sulogin + +1:2345:respawn:/sbin/agetty tty1 9600 +2:2345:respawn:/sbin/agetty tty2 9600 +3:2345:respawn:/sbin/agetty tty3 9600 +4:2345:respawn:/sbin/agetty tty4 9600 +5:2345:respawn:/sbin/agetty tty5 9600 +6:2345:respawn:/sbin/agetty tty6 9600 + +# End /etc/inittab</literal> +EOF</userinput></screen> + + <para>An explanation of this initialization file is in the man page for + <emphasis>inittab</emphasis>. For LFS, the key command that is run is + <command>rc</command>. The intialization file above will instruct + <command>rc</command> to run all the scripts starting with an S in the + <filename class="directory">/etc/rc.d/rcsysinit.d</filename> directory + followed by all the scripts starting with an S in the <filename + class="directory">/etc/rc.d/rc?.d</filename> directory where the question + mark is specified by the initdefault value.</para> + + <para>As a convenience, the <command>rc</command> script reads a library of + functions in <filename class="directory">/lib/boot/functions</filename>. + This library also reads an optional configuration file, + <filename>/etc/sysconfig/init_params</filename>. Any of the system + configuration file parameters described in subsequent sections can be + alternatively placed in this file allowing consolidation of all system + parameters in thsi one file.</para> + + <para>As a debugging convenience, the functions script also logs all output + to <filename>/run/var/bootlog</filename>. Since the <filename + class="directory">/run</filename> directory is a tmpfs, this file is not + persistent across boots.</para> + + </sect2> + + <sect2 id="init-levels" > + <title>Changing Run Levels</title> + + <para>Changing run-levels is done with <command>init <replaceable><runlevel></replaceable></command>, where <replaceable><runlevel></replaceable> is the target run-level. For example, to reboot the computer, a user could issue the <command>init 6</command> command, @@ -59,7 +132,7 @@ <para>The real scripts are in <filename class="directory">/etc/rc.d/init.d</filename>. They do the actual work, and - the symlinks all point to them. Killing links and starting links point to + the symlinks all point to them. K links and S links point to the same script in <filename class="directory">/etc/rc.d/init.d</filename>. This is because the scripts can be called with different parameters like <parameter>start</parameter>, <parameter>stop</parameter>, @@ -126,4 +199,6 @@ it is your own LFS system). The files given here are an example of how it can be done.</para> + </sect2> + </sect1> |