- Timestamp:
- 01/06/2006 02:59:05 AM (19 years ago)
- Children:
- e1ca33a
- Parents:
- 1714f1a
- Location:
- chapter07
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter07/bootscripts.xml
r1714f1a r46a2e9c 1 1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" 3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 3 4 <!ENTITY % general-entities SYSTEM "../general.ent"> 4 5 %general-entities; 5 6 ]> 7 6 8 <sect1 id="ch-scripts-bootscripts" role="wrap"> 7 <title>LFS-Bootscripts-&lfs-bootscripts-version;</title> 8 <?dbhtml filename="bootscripts.html"?> 9 10 <indexterm zone="ch-scripts-bootscripts"><primary sortas="a-Bootscripts">Bootscripts</primary></indexterm> 11 12 <sect2 role="package"><title/> 13 <para>The LFS-Bootscripts package contains a set of scripts to start/stop the 14 LFS system at bootup/shutdown.</para> 15 16 <segmentedlist> 17 <segtitle>&buildtime;</segtitle> 18 <segtitle>&diskspace;</segtitle> 19 <seglistitem><seg>0.1 SBU</seg><seg>516 KB</seg></seglistitem> 20 </segmentedlist> 21 22 <segmentedlist> 23 <segtitle>&dependencies;</segtitle> 24 <seglistitem><seg>Bash, Coreutils, and Make</seg></seglistitem> 25 </segmentedlist> 26 </sect2> 27 28 <sect2 role="installation"> 29 <title>Installation of LFS-Bootscripts</title> 30 31 <para>Install the package:</para> 9 <?dbhtml filename="bootscripts.html"?> 10 11 <title>LFS-Bootscripts-&lfs-bootscripts-version;</title> 12 13 <indexterm zone="ch-scripts-bootscripts"> 14 <primary sortas="a-Bootscripts">Bootscripts</primary> 15 </indexterm> 16 17 <sect2 role="package"> 18 <title/> 19 20 <para>The LFS-Bootscripts package contains a set of scripts to start/stop the 21 LFS system at bootup/shutdown.</para> 22 23 <segmentedlist> 24 <segtitle>&buildtime;</segtitle> 25 <segtitle>&diskspace;</segtitle> 26 27 <seglistitem> 28 <seg>0.1 SBU</seg> 29 <seg>516 KB</seg> 30 </seglistitem> 31 </segmentedlist> 32 33 <segmentedlist> 34 <segtitle>&dependencies;</segtitle> 35 36 <seglistitem> 37 <seg>Bash and Coreutils</seg> 38 </seglistitem> 39 </segmentedlist> 40 41 </sect2> 42 43 <sect2 role="installation"> 44 <title>Installation of LFS-Bootscripts</title> 45 46 <para>Install the package:</para> 32 47 33 48 <screen><userinput>make install</userinput></screen> 34 49 35 </sect2> 36 37 <sect2 id="contents-bootscripts" role="content"><title>Contents of LFS-Bootscripts</title> 38 39 <segmentedlist> 40 <segtitle>Installed scripts</segtitle> 41 <seglistitem><seg>checkfs, cleanfs, console, functions, halt, hotplug, ifdown, ifup, 42 localnet, mountfs, mountkernfs, network, rc, reboot, sendsignals, setclock, static, 43 swap, sysklogd, template, and udev</seg></seglistitem> 44 </segmentedlist> 45 46 <variablelist><bridgehead renderas="sect3">Short Descriptions</bridgehead> 47 <?dbfo list-presentation="list"?> 48 <?dbhtml list-presentation="table"?> 49 50 <varlistentry id="checkfs-bootscripts"> 51 <term><command>checkfs</command></term> 52 <listitem> 53 <para>Checks the integrity of the file systems before they are mounted (with the 54 exception of journal and network based file systems)</para> 55 <indexterm zone="ch-scripts-bootscripts checkfs-bootscripts"><primary sortas="d-checkfs">checkfs</primary></indexterm> 56 </listitem> 57 </varlistentry> 58 59 <varlistentry id="cleanfs-bootscripts"> 60 <term><command>cleanfs</command></term> 61 <listitem> 62 <para>Removes files that should not be 63 preserved between reboots, such as those in <filename class="directory">/var/run/</filename> and 64 <filename class="directory">/var/lock/</filename>; it re-creates <filename>/var/run/utmp</filename> 65 and removes the possibly present <filename>/etc/nologin</filename>, 66 <filename>/fastboot</filename>, and <filename>/forcefsck</filename> files</para> 67 <indexterm zone="ch-scripts-bootscripts cleanfs-bootscripts"><primary sortas="d-cleanfs">cleanfs</primary></indexterm> 68 </listitem> 69 </varlistentry> 70 71 <varlistentry id="console-bootscripts"> 72 <term><command>console</command></term> 73 <listitem> 74 <para>Loads the correct keymap table for the desired keyboard layout; it also 75 sets the screen font</para> 76 <indexterm zone="ch-scripts-bootscripts console-bootscripts"><primary sortas="d-console">console</primary></indexterm> 77 </listitem> 78 </varlistentry> 79 80 <varlistentry id="functions-bootscripts"> 81 <term><command>functions</command></term> 82 <listitem> 83 <para>Contains common functions, such as error and status checking, that are 84 used by several bootscripts</para> 85 <indexterm zone="ch-scripts-bootscripts functions-bootscripts"><primary sortas="d-functions">functions</primary></indexterm> 86 </listitem> 87 </varlistentry> 88 89 <varlistentry id="halt-bootscripts"> 90 <term><command>halt</command></term> 91 <listitem> 92 <para>Halts the system</para> 93 <indexterm zone="ch-scripts-bootscripts halt-bootscripts"><primary sortas="d-halt">halt</primary></indexterm> 94 </listitem> 95 </varlistentry> 96 97 <varlistentry id="hotplug-bootscripts"> 98 <term><command>hotplug</command></term> 99 <listitem> 100 <para>Loads modules for system devices</para> 101 <indexterm zone="ch-scripts-bootscripts hotplug-bootscripts"><primary sortas="d-hotplug">hotplug</primary></indexterm> 102 </listitem> 103 </varlistentry> 104 105 <varlistentry id="ifdown-bootscripts"> 106 <term><command>ifdown</command></term> 107 <listitem> 108 <para>Assists the network script with stopping network devices</para> 109 <indexterm zone="ch-scripts-bootscripts ifdown-bootscripts"><primary sortas="d-ifdown">ifdown</primary></indexterm> 110 </listitem> 111 </varlistentry> 112 113 <varlistentry id="ifup-bootscripts"> 114 <term><command>ifup</command></term> 115 <listitem> 116 <para>Assists the network script with starting network devices</para> 117 <indexterm zone="ch-scripts-bootscripts ifup-bootscripts"><primary sortas="d-ifup">ifup</primary></indexterm> 118 </listitem> 119 </varlistentry> 120 121 <varlistentry id="localnet-bootscripts"> 122 <term><command>localnet</command></term> 123 <listitem> 124 <para>Sets up the system's hostname and local loopback device</para> 125 <indexterm zone="ch-scripts-bootscripts localnet-bootscripts"><primary sortas="d-localnet">localnet</primary></indexterm> 126 </listitem> 127 </varlistentry> 128 129 <varlistentry id="mountfs-bootscripts"> 130 <term><command>mountfs</command></term> 131 <listitem> 132 <para>Mounts all file systems, except ones that are marked 133 <emphasis>noauto</emphasis> or are network based</para> 134 <indexterm zone="ch-scripts-bootscripts mountfs-bootscripts"><primary sortas="d-mountfs">mountfs</primary></indexterm> 135 </listitem> 136 </varlistentry> 137 138 <varlistentry id="mountkernfs-bootscripts"> 139 <term><command>mountkernfs</command></term> 140 <listitem> 141 <para>Mounts virtual kernel file systems, such as <systemitem 142 class="filesystem">proc</systemitem></para> 143 <indexterm zone="ch-scripts-bootscripts mountkernfs-bootscripts"><primary sortas="d-mountkernfs">mountkernfs</primary></indexterm> 144 </listitem> 145 </varlistentry> 146 147 <varlistentry id="network-bootscripts"> 148 <term><command>network</command></term> 149 <listitem> 150 <para>Sets up network interfaces, such as network cards, and sets up 151 the default gateway (where applicable)</para> 152 <indexterm zone="ch-scripts-bootscripts network-bootscripts"><primary sortas="d-network">network</primary></indexterm> 153 </listitem> 154 </varlistentry> 155 156 <varlistentry id="rc-bootscripts"> 157 <term><command>rc</command></term> 158 <listitem> 159 <para>The master run-level control script; it is responsible for running all the 160 other bootscripts one-by-one, in a sequence determined by the name of the 161 symbolic links being processed</para> 162 <indexterm zone="ch-scripts-bootscripts rc-bootscripts"><primary sortas="d-rc">rc</primary></indexterm> 163 </listitem> 164 </varlistentry> 165 166 <varlistentry id="reboot-bootscripts"> 167 <term><command>reboot</command></term> 168 <listitem> 169 <para>Reboots the system</para> 170 <indexterm zone="ch-scripts-bootscripts reboot-bootscripts"><primary sortas="d-reboot">reboot</primary></indexterm> 171 </listitem> 172 </varlistentry> 173 174 <varlistentry id="sendsignals-bootscripts"> 175 <term><command>sendsignals</command></term> 176 <listitem> 177 <para>Makes sure every process is terminated before the system reboots 178 or halts</para> 179 <indexterm zone="ch-scripts-bootscripts sendsignals-bootscripts"><primary sortas="d-sendsignals">sendsignals</primary></indexterm> 180 </listitem> 181 </varlistentry> 182 183 <varlistentry id="setclock-bootscripts"> 184 <term><command>setclock</command></term> 185 <listitem> 186 <para>Resets the kernel clock to local time in case the hardware clock 187 is not set to UTC time</para> 188 <indexterm zone="ch-scripts-bootscripts setclock-bootscripts"><primary sortas="d-setclock">setclock</primary></indexterm> 189 </listitem> 190 </varlistentry> 191 192 <varlistentry id="static-bootscripts"> 193 <term><command>static</command></term> 194 <listitem> 195 <para>Provides the functionality needed to assign a static Internet 196 Protocol (IP) address to a network interface</para> 197 <indexterm zone="ch-scripts-bootscripts static-bootscripts"><primary sortas="d-static">static</primary></indexterm> 198 </listitem> 199 </varlistentry> 200 201 <varlistentry id="swap-bootscripts"> 202 <term><command>swap</command></term> 203 <listitem> 204 <para>Enables and disables swap files and partitions</para> 205 <indexterm zone="ch-scripts-bootscripts swap-bootscripts"><primary sortas="d-swap">swap</primary></indexterm> 206 </listitem> 207 </varlistentry> 208 209 <varlistentry id="sysklogd-bootscripts"> 210 <term><command>sysklogd</command></term> 211 <listitem> 212 <para>Starts and stops the system and kernel log daemons</para> 213 <indexterm zone="ch-scripts-bootscripts sysklogd-bootscripts"><primary sortas="d-sysklogd">sysklogd</primary></indexterm> 214 </listitem> 215 </varlistentry> 216 217 <varlistentry id="template-bootscripts"> 218 <term><command>template</command></term> 219 <listitem> 220 <para>A template to create custom bootscripts for other 221 daemons</para> 222 <indexterm zone="ch-scripts-bootscripts template-bootscripts"><primary sortas="d-template">template</primary></indexterm> 223 </listitem> 224 </varlistentry> 225 226 <varlistentry id="udev-bootscripts"> 227 <term><command>udev</command></term> 228 <listitem> 229 <para>Prepares the <filename class="directory">/dev</filename> directory and 230 starts Udev</para> 231 <indexterm zone="ch-scripts-bootscripts udev-bootscripts"><primary sortas="d-udev">udev</primary></indexterm> 232 </listitem> 233 </varlistentry> 234 </variablelist> 235 236 </sect2> 50 </sect2> 51 52 <sect2 id="contents-bootscripts" role="content"> 53 <title>Contents of LFS-Bootscripts</title> 54 55 <segmentedlist> 56 <segtitle>Installed scripts</segtitle> 57 58 <seglistitem> 59 <seg>checkfs, cleanfs, console, functions, halt, hotplug, ifdown, ifup, 60 localnet, mountfs, mountkernfs, network, rc, reboot, sendsignals, 61 setclock, static, swap, sysklogd, template, and udev</seg> 62 </seglistitem> 63 </segmentedlist> 64 65 <variablelist> 66 <bridgehead renderas="sect3">Short Descriptions</bridgehead> 67 <?dbfo list-presentation="list"?> 68 <?dbhtml list-presentation="table"?> 69 70 <varlistentry id="checkfs-bootscripts"> 71 <term><command>checkfs</command></term> 72 <listitem> 73 <para>Checks the integrity of the file systems before they are mounted 74 (with the exception of journal and network based file systems)</para> 75 <indexterm zone="ch-scripts-bootscripts checkfs-bootscripts"> 76 <primary sortas="d-checkfs">checkfs</primary> 77 </indexterm> 78 </listitem> 79 </varlistentry> 80 81 <varlistentry id="cleanfs-bootscripts"> 82 <term><command>cleanfs</command></term> 83 <listitem> 84 <para>Removes files that should not be preserved between reboots, such 85 as those in <filename class="directory">/var/run/</filename> and 86 <filename class="directory">/var/lock/</filename>; it re-creates 87 <filename>/var/run/utmp</filename> and removes the possibly present 88 <filename>/etc/nologin</filename>, <filename>/fastboot</filename>, and 89 <filename>/forcefsck</filename> files</para> 90 <indexterm zone="ch-scripts-bootscripts cleanfs-bootscripts"> 91 <primary sortas="d-cleanfs">cleanfs</primary> 92 </indexterm> 93 </listitem> 94 </varlistentry> 95 96 <varlistentry id="console-bootscripts"> 97 <term><command>console</command></term> 98 <listitem> 99 <para>Loads the correct keymap table for the desired keyboard layout; 100 it also sets the screen font</para> 101 <indexterm zone="ch-scripts-bootscripts console-bootscripts"> 102 <primary sortas="d-console">console</primary> 103 </indexterm> 104 </listitem> 105 </varlistentry> 106 107 <varlistentry id="functions-bootscripts"> 108 <term><command>functions</command></term> 109 <listitem> 110 <para>Contains common functions, such as error and status checking, 111 that are used by several bootscripts</para> 112 <indexterm zone="ch-scripts-bootscripts functions-bootscripts"> 113 <primary sortas="d-functions">functions</primary> 114 </indexterm> 115 </listitem> 116 </varlistentry> 117 118 <varlistentry id="halt-bootscripts"> 119 <term><command>halt</command></term> 120 <listitem> 121 <para>Halts the system</para> 122 <indexterm zone="ch-scripts-bootscripts halt-bootscripts"> 123 <primary sortas="d-halt">halt</primary> 124 </indexterm> 125 </listitem> 126 </varlistentry> 127 128 <varlistentry id="hotplug-bootscripts"> 129 <term><command>hotplug</command></term> 130 <listitem> 131 <para>Loads modules for system devices</para> 132 <indexterm zone="ch-scripts-bootscripts hotplug-bootscripts"> 133 <primary sortas="d-hotplug">hotplug</primary> 134 </indexterm> 135 </listitem> 136 </varlistentry> 137 138 <varlistentry id="ifdown-bootscripts"> 139 <term><command>ifdown</command></term> 140 <listitem> 141 <para>Assists the network script with stopping network devices</para> 142 <indexterm zone="ch-scripts-bootscripts ifdown-bootscripts"> 143 <primary sortas="d-ifdown">ifdown</primary> 144 </indexterm> 145 </listitem> 146 </varlistentry> 147 148 <varlistentry id="ifup-bootscripts"> 149 <term><command>ifup</command></term> 150 <listitem> 151 <para>Assists the network script with starting network devices</para> 152 <indexterm zone="ch-scripts-bootscripts ifup-bootscripts"> 153 <primary sortas="d-ifup">ifup</primary> 154 </indexterm> 155 </listitem> 156 </varlistentry> 157 158 <varlistentry id="localnet-bootscripts"> 159 <term><command>localnet</command></term> 160 <listitem> 161 <para>Sets up the system's hostname and local loopback device</para> 162 <indexterm zone="ch-scripts-bootscripts localnet-bootscripts"> 163 <primary sortas="d-localnet">localnet</primary> 164 </indexterm> 165 </listitem> 166 </varlistentry> 167 168 <varlistentry id="mountfs-bootscripts"> 169 <term><command>mountfs</command></term> 170 <listitem> 171 <para>Mounts all file systems, except ones that are marked 172 <emphasis>noauto</emphasis> or are network based</para> 173 <indexterm zone="ch-scripts-bootscripts mountfs-bootscripts"> 174 <primary sortas="d-mountfs">mountfs</primary> 175 </indexterm> 176 </listitem> 177 </varlistentry> 178 179 <varlistentry id="mountkernfs-bootscripts"> 180 <term><command>mountkernfs</command></term> 181 <listitem> 182 <para>Mounts virtual kernel file systems, such as <systemitem 183 class="filesystem">proc</systemitem></para> 184 <indexterm zone="ch-scripts-bootscripts mountkernfs-bootscripts"> 185 <primary sortas="d-mountkernfs">mountkernfs</primary> 186 </indexterm> 187 </listitem> 188 </varlistentry> 189 190 <varlistentry id="network-bootscripts"> 191 <term><command>network</command></term> 192 <listitem> 193 <para>Sets up network interfaces, such as network cards, and sets up 194 the default gateway (where applicable)</para> 195 <indexterm zone="ch-scripts-bootscripts network-bootscripts"> 196 <primary sortas="d-network">network</primary> 197 </indexterm> 198 </listitem> 199 </varlistentry> 200 201 <varlistentry id="rc-bootscripts"> 202 <term><command>rc</command></term> 203 <listitem> 204 <para>The master run-level control script; it is responsible for 205 running all the other bootscripts one-by-one, in a sequence determined 206 by the name of the symbolic links being processed</para> 207 <indexterm zone="ch-scripts-bootscripts rc-bootscripts"> 208 <primary sortas="d-rc">rc</primary> 209 </indexterm> 210 </listitem> 211 </varlistentry> 212 213 <varlistentry id="reboot-bootscripts"> 214 <term><command>reboot</command></term> 215 <listitem> 216 <para>Reboots the system</para> 217 <indexterm zone="ch-scripts-bootscripts reboot-bootscripts"> 218 <primary sortas="d-reboot">reboot</primary> 219 </indexterm> 220 </listitem> 221 </varlistentry> 222 223 <varlistentry id="sendsignals-bootscripts"> 224 <term><command>sendsignals</command></term> 225 <listitem> 226 <para>Makes sure every process is terminated before the system reboots 227 or halts</para> 228 <indexterm zone="ch-scripts-bootscripts sendsignals-bootscripts"> 229 <primary sortas="d-sendsignals">sendsignals</primary> 230 </indexterm> 231 </listitem> 232 </varlistentry> 233 234 <varlistentry id="setclock-bootscripts"> 235 <term><command>setclock</command></term> 236 <listitem> 237 <para>Resets the kernel clock to local time in case the hardware clock 238 is not set to UTC time</para> 239 <indexterm zone="ch-scripts-bootscripts setclock-bootscripts"> 240 <primary sortas="d-setclock">setclock</primary> 241 </indexterm> 242 </listitem> 243 </varlistentry> 244 245 <varlistentry id="static-bootscripts"> 246 <term><command>static</command></term> 247 <listitem> 248 <para>Provides the functionality needed to assign a static Internet 249 Protocol (IP) address to a network interface</para> 250 <indexterm zone="ch-scripts-bootscripts static-bootscripts"> 251 <primary sortas="d-static">static</primary> 252 </indexterm> 253 </listitem> 254 </varlistentry> 255 256 <varlistentry id="swap-bootscripts"> 257 <term><command>swap</command></term> 258 <listitem> 259 <para>Enables and disables swap files and partitions</para> 260 <indexterm zone="ch-scripts-bootscripts swap-bootscripts"> 261 <primary sortas="d-swap">swap</primary> 262 </indexterm> 263 </listitem> 264 </varlistentry> 265 266 <varlistentry id="sysklogd-bootscripts"> 267 <term><command>sysklogd</command></term> 268 <listitem> 269 <para>Starts and stops the system and kernel log daemons</para> 270 <indexterm zone="ch-scripts-bootscripts sysklogd-bootscripts"> 271 <primary sortas="d-sysklogd">sysklogd</primary> 272 </indexterm> 273 </listitem> 274 </varlistentry> 275 276 <varlistentry id="template-bootscripts"> 277 <term><command>template</command></term> 278 <listitem> 279 <para>A template to create custom bootscripts for other 280 daemons</para> 281 <indexterm zone="ch-scripts-bootscripts template-bootscripts"> 282 <primary sortas="d-template">template</primary> 283 </indexterm> 284 </listitem> 285 </varlistentry> 286 287 <varlistentry id="udev-bootscripts"> 288 <term><command>udev</command></term> 289 <listitem> 290 <para>Prepares the <filename class="directory">/dev</filename> 291 directory and starts Udev</para> 292 <indexterm zone="ch-scripts-bootscripts udev-bootscripts"> 293 <primary sortas="d-udev">udev</primary> 294 </indexterm> 295 </listitem> 296 </varlistentry> 297 298 </variablelist> 299 300 </sect2> 237 301 238 302 </sect1> 239 -
chapter07/chapter07.xml
r1714f1a r46a2e9c 1 1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 2 <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" 3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 3 4 <!ENTITY % general-entities SYSTEM "../general.ent"> 4 5 %general-entities; 5 6 ]> 7 6 8 <chapter id="chapter-bootscripts" xreflabel="Chapter 7"> 7 <?dbhtml dir="chapter07"?> 8 <title>Setting Up System Bootscripts</title> 9 <?dbhtml filename="chapter07.html"?> 9 <?dbhtml dir="chapter07"?> 10 <?dbhtml filename="chapter07.html"?> 10 11 11 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="introduction.xml"/> 12 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="bootscripts.xml"/> 13 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="usage.xml"/> 14 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="udev.xml"/> 15 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="setclock.xml"/> 16 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="console.xml"/> 17 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="sysklogd.xml"/> 18 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="inputrc.xml"/> 19 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="profile.xml"/> 20 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="hostname.xml"/> 21 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="hosts.xml"/> 22 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="network.xml"/> 12 <title>Setting Up System Bootscripts</title> 13 14 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="introduction.xml"/> 15 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="bootscripts.xml"/> 16 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="usage.xml"/> 17 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="udev.xml"/> 18 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="setclock.xml"/> 19 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="console.xml"/> 20 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="sysklogd.xml"/> 21 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="inputrc.xml"/> 22 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="profile.xml"/> 23 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="hostname.xml"/> 24 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="hosts.xml"/> 25 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="network.xml"/> 23 26 24 27 </chapter> -
chapter07/console.xml
r1714f1a r46a2e9c 1 1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" 3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 3 4 <!ENTITY % general-entities SYSTEM "../general.ent"> 4 5 %general-entities; 5 6 ]> 7 6 8 <sect1 id="ch-scripts-console"> 7 <title>Configuring the Linux Console</title> 8 <?dbhtml filename="console.html"?> 9 10 <indexterm zone="ch-scripts-console"> 11 <primary sortas="d-console">console</primary> 12 <secondary>configuring</secondary></indexterm> 13 14 <para>This section discusses how to configure the <command>console</command> 15 bootscript that sets up the keyboard map and the console font. If non-ASCII 16 characters (e.g., the British pound sign and Euro character) will not be used 17 and the keyboard is a U.S. one, skip this section. Without the configuration 18 file, the <command>console</command> bootscript will do nothing.</para> 19 20 <para>The <command>console</command> script reads the 21 <filename>/etc/sysconfig/console</filename> file for configuration information. 22 Decide which keymap and screen font will be used. Various language-specific 23 HOWTO's can also help with this (see <ulink 24 url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>. A pre-made 25 <filename>/etc/sysconfig/console</filename> file with known settings for several 26 countries was installed with the LFS-Bootscripts package, so the relevant 27 section can be uncommented if the country is supported. If still in doubt, look 28 in the <filename class="directory">/usr/share/kbd</filename> directory for valid 29 keymaps and screen fonts. Read <filename>loadkeys(1)</filename> and 30 <filename>setfont(8)</filename> to determine the correct arguments for 31 these programs. Once decided, create the configuration file with the following 32 command:</para> 33 34 <screen><userinput>cat >/etc/sysconfig/console <<"EOF" 35 <literal>KEYMAP="<replaceable>[arguments for loadkeys]</replaceable>" 36 FONT="<replaceable>[arguments for setfont]</replaceable>"</literal> 37 EOF</userinput></screen> 38 39 <para>For example, for Spanish users who also want to use the Euro 40 character (accessible by pressing AltGr+E), the following settings are 41 correct:</para> 42 43 <screen role="nodump"><userinput>cat >/etc/sysconfig/console <<"EOF" 44 <literal>KEYMAP="es euro2" 45 FONT="lat9-16 -u iso01"</literal> 46 EOF</userinput></screen> 47 48 <note><para>The <envar>FONT</envar> line above is correct only for the ISO 8859-15 49 character set. If using ISO 8859-1 and, therefore, a pound sign 50 instead of Euro, the correct <envar>FONT</envar> line would be:</para> 51 52 <screen role="nodump"><userinput>FONT="lat1-16"</userinput></screen></note> 53 54 <para>If the <envar>KEYMAP</envar> or <envar>FONT</envar> variable is not set, the 55 <command>console</command> initscript will not run the corresponding 56 program.</para> 57 58 <para>In some keymaps, the Backspace and Delete keys send characters different 59 from ones in the default keymap built into the kernel. This confuses some 60 applications. For example, Emacs displays its help (instead of erasing the 61 character before the cursor) when Backspace is pressed. To check if the keymap 62 in use is affected (this works only for i386 keymaps):</para> 63 64 <screen role="nodump"><userinput>zgrep '\W14\W' <replaceable>[/path/to/your/keymap]</replaceable></userinput></screen> 65 66 <para>If the keycode 14 is Backspace instead of Delete, create the 67 following keymap snippet to fix this issue:</para> 68 69 <screen role="nodump"><userinput>mkdir -pv /etc/kbd && cat > /etc/kbd/bs-sends-del <<"EOF" 70 <literal> keycode 14 = Delete Delete Delete Delete 71 alt keycode 14 = Meta_Delete 72 altgr alt keycode 14 = Meta_Delete 73 keycode 111 = Remove 74 altgr control keycode 111 = Boot 75 control alt keycode 111 = Boot 76 altgr control alt keycode 111 = Boot</literal> 77 EOF</userinput></screen> 78 79 <para>Tell the <command>console</command> script to load this 80 snippet after the main keymap:</para> 81 82 <screen role="nodump"><userinput>cat >>/etc/sysconfig/console <<"EOF" 83 <literal>KEYMAP_CORRECTIONS="/etc/kbd/bs-sends-del"</literal> 84 EOF</userinput></screen> 85 86 <para>To compile the keymap directly into the kernel instead of 87 setting it every time from the <command>console</command> bootscript, 88 follow the instructions given in <xref linkend="ch-bootable-kernel" role="."/> 89 Doing this ensures that the keyboard will always work as expected, 90 even when booting into maintenance mode (by passing 91 <parameter>init=/bin/sh</parameter> to the kernel), because the 92 <command>console</command> bootscript will not be run in that 93 situation. Additionally, the kernel will not set the screen font 94 automatically. This should not pose many problems because ASCII characters 95 will be handled correctly, and it is unlikely that a user would need 96 to rely on non-ASCII characters while in maintenance mode.</para> 97 98 <para>Since the kernel will set up the keymap, it is possible to omit 99 the <envar>KEYMAP</envar> variable from the 100 <filename>/etc/sysconfig/console</filename> configuration file. It can 101 also be left in place, if desired, without consequence. Keeping it 102 could be beneficial if running several different kernels where it is 103 difficult to ensure that the keymap is compiled into every one of 104 them.</para> 9 <?dbhtml filename="console.html"?> 10 11 <title>Configuring the Linux Console</title> 12 13 <indexterm zone="ch-scripts-console"> 14 <primary sortas="d-console">console</primary> 15 <secondary>configuring</secondary> 16 </indexterm> 17 18 <para>This section discusses how to configure the <command>console</command> 19 bootscript that sets up the keyboard map and the console font. If non-ASCII 20 characters (e.g., the copyright sign, the British pound sign and Euro symbol) 21 will not be used and the keyboard is a U.S. one, skip this section. Without 22 the configuration file, the <command>console</command> bootscript will do 23 nothing.</para> 24 25 <para>The <command>console</command> script reads the 26 <filename>/etc/sysconfig/console</filename> file for configuration information. 27 Decide which keymap and screen font will be used. Various language-specific 28 HOWTOs can also help with this, see <ulink 29 url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>. If still in 30 doubt, look in the <filename class="directory">/usr/share/kbd</filename> 31 directory for valid keymaps and screen fonts. Read 32 <filename>loadkeys(1)</filename> and <filename>setfont(8)</filename> manual 33 pages to determine the correct arguments for these programs.</para> 34 35 <para>The <filename>/etc/sysconfig/console</filename> file should contain lines 36 of the form: VARIABLE="value". The following variables are recognized:</para> 37 38 <variablelist> 39 40 <varlistentry> 41 <term>KEYMAP</term> 42 <listitem> 43 <para>This variable specifies the arguments for the 44 <command>loadkeys</command> program, typically, the name of keymap 45 to load, e.g., <quote>es</quote>. If this variable is not set, the 46 bootscript will not run the <command>loadkeys</command> program, 47 and the default kernel keymap will be used.</para> 48 </listitem> 49 </varlistentry> 50 51 <varlistentry> 52 <term>KEYMAP_CORRECTIONS</term> 53 <listitem> 54 <para>This (rarely used) variable 55 specifies the arguments for the second call to the 56 <command>loadkeys</command> program. This is useful if the stock keymap 57 is not completely satisfactory and a small adjustment has to be made. E.g., 58 to include the Euro sign into a keymap that normally doesn't have it, 59 set this variable to <quote>euro2</quote>.</para> 60 </listitem> 61 </varlistentry> 62 63 <varlistentry> 64 <term>FONT</term> 65 <listitem> 66 <para>This variable specifies the arguments for the 67 <command>setfont</command> program. Typically, this includes the font 68 name, <quote>-m</quote>, and the name of the application character 69 map to load. E.g., in order to load the <quote>lat1-16</quote> font 70 together with the <quote>8859-1</quote> application character map 71 (as it is appropriate in the USA), <!-- because of the copyright sign --> 72 set this variable to <quote>lat1-16 -m 8859-1</quote>. 73 If this variable is not set, the bootscript will not run the 74 <command>setfont</command> program, and the default VGA font will be 75 used together with the default application character map.</para> 76 </listitem> 77 </varlistentry> 78 79 <varlistentry> 80 <term>UNICODE</term> 81 <listitem> 82 <para>Set this variable to <quote>1</quote>, <quote>yes</quote> or 83 <quote>true</quote> in order to put the 84 console into UTF-8 mode. This is useful in UTF-8 based locales and 85 harmful otherwise.</para> 86 </listitem> 87 </varlistentry> 88 89 <varlistentry> 90 <term>LEGACY_CHARSET</term> 91 <listitem> 92 <para>For many keyboard layouts, there is no stock Unicode keymap in 93 the Kbd package. The <command>console</command> bootscript will 94 convert an available keymap to UTF-8 on the fly if this variable is 95 set to the encoding of the available non-UTF-8 keymap. Note, however, 96 that dead keys (i.e., keys that don't produce a character by 97 themselves, but put an accent onto a character procuced by the next 98 key; there are no dead keys on the standard US keyboard) and composing 99 (i.e., pressing Ctrl+. A E in order to produce the Æ character) 100 will not work in UTF-8 mode without the special kernel patch. 101 This variable is useful only in UTF-8 mode.</para> 102 </listitem> 103 </varlistentry> 104 105 <varlistentry> 106 <term>BROKEN_COMPOSE</term> 107 <listitem> 108 <para>Set this to <quote>0</quote> if you are going to apply the kernel patch in 109 Chapter 8. Note that you also have to add the character set expected 110 by composition rules in your keymap to the FONT variable after the 111 <quote>-m</quote> switch. This variable is useful only in UTF-8 mode.</para> 112 </listitem> 113 </varlistentry> 114 115 </variablelist> 116 117 <para>Support for compiling the keymap directly into the kernel has been 118 removed because there were reports that it leads to incorrect results.</para> 119 120 <para>Some examples:</para> 121 122 <itemizedlist> 123 124 <listitem> 125 <para>For a non-Unicode setup, only the KEYMAP and FONT variables are 126 generally needed. E.g., for a Polish setup, one would use:</para> 127 128 <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF" 129 <literal># Begin /etc/sysconfig/console 130 131 KEYMAP="pl2" 132 FONT="lat2a-16 -m 8859-2" 133 134 # End /etc/sysconfig/console</literal> 135 EOF</userinput></screen> 136 </listitem> 137 138 <listitem> 139 <para>As mentioned above, it is sometimes necessary to adjust a 140 stock keymap slightly. The following example adds the Euro symbol to the 141 German keymap:</para> 142 143 <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF" 144 <literal># Begin /etc/sysconfig/console 145 146 KEYMAP="de-latin1" 147 KEYMAP_CORRECTIONS="euro2" 148 FONT="lat0-16 -m 8859-15" 149 150 # End /etc/sysconfig/console</literal> 151 EOF</userinput></screen> 152 </listitem> 153 154 <listitem> 155 <para>The following is a Unicode-enabled example for Bulgarian, where a stock 156 UTF-8 keymap exists and defines no dead keys or composition rules:</para> 157 158 <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF" 159 <literal># Begin /etc/sysconfig/console 160 161 UNICODE="1" 162 KEYMAP="bg_bds-utf8" 163 FONT="LatArCyrHeb-16" 164 165 # End /etc/sysconfig/console</literal> 166 EOF</userinput></screen> 167 </listitem> 168 169 <listitem> 170 <para>Due to the use of a 512-glyph LatArCyrHeb-16 font in the previous 171 example, bright colors are no longer available on the Linux console unless 172 a framebuffer is used. If one wants to have bright colors without 173 framebuffer and can live without characters not belonging to his language, 174 it is still possible to use a language-specific 256-glyph font, as 175 illustrated below.</para> 176 177 <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF" 178 <literal># Begin /etc/sysconfig/console 179 180 UNICODE="1" 181 KEYMAP="bg_bds-utf8" 182 FONT="cyr-sun16" 183 184 # End /etc/sysconfig/console</literal> 185 EOF</userinput></screen> 186 </listitem> 187 188 <listitem> 189 <para>The following example illustrates keymap autoconversion from 190 ISO-8859-15 to UTF-8 and enabling dead keys in Unicode mode:</para> 191 192 <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF" 193 <literal># Begin /etc/sysconfig/console 194 195 UNICODE="1" 196 KEYMAP="de-latin1" 197 KEYMAP_CORRECTIONS="euro2" 198 LEGACY_CHARSET="iso-8859-15" 199 BROKEN_COMPOSE="0" 200 FONT="LatArCyrHeb-16 -m 8859-15" 201 202 # End /etc/sysconfig/console</literal> 203 EOF</userinput></screen> 204 </listitem> 205 206 <listitem> 207 <para>For Chinese, Japanese, Korean and some other languages, the Linux 208 console cannot be configured to display the needed characters. Users 209 who need such languages should install the X Window System, fonts that 210 cover the necessary character ranges, and the proper input method (e.g., 211 SCIM, it supports a wide variety of languages).</para> 212 </listitem> 213 214 </itemizedlist> 215 216 <!-- Added because folks keep posting their console file with X questions 217 to blfs-support list --> 218 <note> 219 <para>The <filename>/etc/sysconfig/console</filename> file only controls the 220 Linux text console localization. It has nothing to do with setting the proper 221 keyboard layout and terminal fonts in the X Window System, with ssh sessions 222 or with a serial console.</para> 223 </note> 105 224 106 225 </sect1> 107 -
chapter07/hostname.xml
r1714f1a r46a2e9c 1 1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" 3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 3 4 <!ENTITY % general-entities SYSTEM "../general.ent"> 4 5 %general-entities; 5 6 ]> 7 6 8 <sect1 id="ch-scripts-hostname"> 7 <title>Configuring the localnet Script</title> 8 <?dbhtml filename="hostname.html"?> 9 <?dbhtml filename="hostname.html"?> 9 10 10 <indexterm zone="ch-scripts-hostname"> 11 <primary sortas="d-localnet">localnet</primary> 12 <secondary>configuring</secondary></indexterm> 11 <title>Configuring the localnet Script</title> 13 12 14 <para>Part of the job of the <command>localnet</command> script is setting the 15 system's hostname. This needs to be configured in the 16 <filename>/etc/sysconfig/network</filename> file.</para> 13 <indexterm zone="ch-scripts-hostname"> 14 <primary sortas="d-localnet">localnet</primary> 15 <secondary>configuring</secondary> 16 </indexterm> 17 17 18 <para>Create the <filename>/etc/sysconfig/network</filename> file and enter a 19 hostname by running:</para> 18 <para>Part of the job of the <command>localnet</command> script is setting the 19 system's hostname. This needs to be configured in the 20 <filename>/etc/sysconfig/network</filename> file.</para> 21 22 <para>Create the <filename>/etc/sysconfig/network</filename> file and enter a 23 hostname by running:</para> 20 24 21 25 <screen><userinput>echo "HOSTNAME=<replaceable>[lfs]</replaceable>" > /etc/sysconfig/network</userinput></screen> 22 26 23 <para><replaceable>[lfs]</replaceable> needs to be replaced with the name given24 to the computer. Do not enter the Fully Qualified Domain Name (FQDN) here. That25 information will be put in the <filename>/etc/hosts</filename> file in the next26 section.</para>27 <para><replaceable>[lfs]</replaceable> needs to be replaced with the name given 28 to the computer. Do not enter the Fully Qualified Domain Name (FQDN) here. That 29 information will be put in the <filename>/etc/hosts</filename> file in the next 30 section.</para> 27 31 28 32 </sect1> 29 -
chapter07/hosts.xml
r1714f1a r46a2e9c 1 1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" 3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 3 4 <!ENTITY % general-entities SYSTEM "../general.ent"> 4 5 %general-entities; 5 6 ]> 7 6 8 <sect1 id="ch-scripts-hosts"> 7 <title>Creating the /etc/hosts File</title> 8 <?dbhtml filename="hosts.html"?> 9 <?dbhtml filename="hosts.html"?> 9 10 10 <indexterm zone="ch-scripts-hosts"><primary sortas="e-/etc/hosts">/etc/hosts</primary></indexterm>11 <title>Creating the /etc/hosts File</title> 11 12 12 <indexterm zone="ch-scripts-hosts">13 <primary sortas="d-localnet">localnet</primary>14 <secondary>/etc/hosts</secondary></indexterm>13 <indexterm zone="ch-scripts-hosts"> 14 <primary sortas="e-/etc/hosts">/etc/hosts</primary> 15 </indexterm> 15 16 16 <indexterm zone="ch-scripts-hosts">17 <primary sortas="d-network">network</primary>18 <secondary>/etc/hosts</secondary></indexterm>17 <indexterm zone="ch-scripts-hosts"> 18 <primary sortas="d-localnet">localnet</primary> 19 <secondary>/etc/hosts</secondary></indexterm> 19 20 20 <para>If a network card is to be configured, decide on the IP address, 21 FQDN, and possible aliases for use in the 22 <filename>/etc/hosts</filename> file. The syntax is:</para>21 <indexterm zone="ch-scripts-hosts"> 22 <primary sortas="d-network">network</primary> 23 <secondary>/etc/hosts</secondary></indexterm> 23 24 24 <screen><IP address> myhost.example.org aliases</screen> 25 <para>If a network card is to be configured, decide on the IP address, 26 FQDN, and possible aliases for use in the 27 <filename>/etc/hosts</filename> file. The syntax is:</para> 25 28 26 <para>Unless the computer is to be visible to the Internet (i.e., 27 there is a registered domain and a valid block of assigned IP 28 addresses—most users do not have this), make sure that the IP 29 address is in the private network IP address range. Valid ranges 30 are:</para> 29 <screen><literal><IP address> myhost.example.org aliases</literal></screen> 31 30 32 <screen> Class Networks 31 <para>Unless the computer is to be visible to the Internet (i.e., 32 there is a registered domain and a valid block of assigned IP 33 addresses—most users do not have this), make sure that the IP 34 address is in the private network IP address range. Valid ranges 35 are:</para> 36 37 <screen><literal> Class Networks 33 38 A 10.0.0.0 34 39 B 172.16.0.0 through 172.31.0.255 35 C 192.168.0.0 through 192.168.255.255</ screen>40 C 192.168.0.0 through 192.168.255.255</literal></screen> 36 41 37 <para>A valid IP address could be 192.168.1.1. A valid FQDN for this38 IP could be www.linuxfromscratch.org (not recommended because this is39 a valid registered domain address and could cause domain name server40 issues).</para>42 <para>A valid IP address could be 192.168.1.1. A valid FQDN for this 43 IP could be www.linuxfromscratch.org (not recommended because this is 44 a valid registered domain address and could cause domain name server 45 issues).</para> 41 46 42 <para>Even if not using a network card, an FQDN is still required.43 This is necessary for certain programs to operate correctly.</para>47 <para>Even if not using a network card, an FQDN is still required. 48 This is necessary for certain programs to operate correctly.</para> 44 49 45 <para>Create the <filename>/etc/hosts</filename> file by running:</para>50 <para>Create the <filename>/etc/hosts</filename> file by running:</para> 46 51 47 52 <screen><userinput>cat > /etc/hosts << "EOF" … … 54 59 EOF</userinput></screen> 55 60 56 <para>The <replaceable>[192.168.1.1]</replaceable> and57 <replaceable>[<HOSTNAME>.example.org]</replaceable>58 values need to be changed for specific users or requirements (if59 assigned an IP address by a network/system administrator and the60 machine will be connected to an existing network).</para>61 <para>The <replaceable>[192.168.1.1]</replaceable> and 62 <replaceable>[<HOSTNAME>.example.org]</replaceable> 63 values need to be changed for specific users or requirements (if 64 assigned an IP address by a network/system administrator and the 65 machine will be connected to an existing network).</para> 61 66 62 <para>If a network card is not going to be configured, create the63 <filename>/etc/hosts</filename> file by running:</para>67 <para>If a network card is not going to be configured, create the 68 <filename>/etc/hosts</filename> file by running:</para> 64 69 65 70 <screen role="nodump"><userinput>cat > /etc/hosts << "EOF" … … 72 77 73 78 </sect1> 74 -
chapter07/inputrc.xml
r1714f1a r46a2e9c 1 1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" 3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 3 4 <!ENTITY % general-entities SYSTEM "../general.ent"> 4 5 %general-entities; 5 6 ]> 7 6 8 <sect1 id="ch-scripts-inputrc"> 7 <title>Creating the /etc/inputrc File</title> 8 <?dbhtml filename="inputrc.html"?> 9 <?dbhtml filename="inputrc.html"?> 9 10 10 <indexterm zone="ch-scripts-inputrc"><primary sortas="e-/etc/inputrc">/etc/inputrc</primary></indexterm>11 <title>Creating the /etc/inputrc File</title> 11 12 12 <para>The <filename>inputrc</filename> file handles keyboard mapping for 13 specific situations. This file is the startup file used by Readline — the 14 input-related library — used by Bash and most other shells.</para>13 <indexterm zone="ch-scripts-inputrc"> 14 <primary sortas="e-/etc/inputrc">/etc/inputrc</primary> 15 </indexterm> 15 16 16 <para>Most people do not need user-specific keyboard mappings so the command 17 below creates a global <filename>/etc/inputrc</filename> used by everyone who 18 logs in. If you later decide you need to override the defaults on a per-user 19 basis, you can create a <filename>.inputrc</filename> file in the user's home 20 directory with the modified mappings.</para> 17 <para>The <filename>inputrc</filename> file handles keyboard mapping for 18 specific situations. This file is the startup file used by Readline — the 19 input-related library — used by Bash and most other shells.</para> 21 20 22 <para>For more information on how to edit the <filename>inputrc</filename> file, 23 see <command>info bash</command> under the <emphasis>Readline Init File</emphasis> 24 section. <command>info readline</command> is also a good source of information.</para> 21 <para>Most people do not need user-specific keyboard mappings so the command 22 below creates a global <filename>/etc/inputrc</filename> used by everyone who 23 logs in. If you later decide you need to override the defaults on a per-user 24 basis, you can create a <filename>.inputrc</filename> file in the user's home 25 directory with the modified mappings.</para> 25 26 26 <para>Below is a generic global <filename>inputrc</filename> along with comments 27 to explain what the various options do. Note that comments cannot be on the same 28 line as commands. Create the file using the following command:</para> 27 <para>For more information on how to edit the <filename>inputrc</filename> 28 file, see <command>info bash</command> under the <emphasis>Readline Init 29 File</emphasis> section. <command>info readline</command> is also a good 30 source of information.</para> 31 32 <para>Below is a generic global <filename>inputrc</filename> along with comments 33 to explain what the various options do. Note that comments cannot be on the same 34 line as commands. Create the file using the following command:</para> 29 35 30 36 <screen><userinput>cat > /etc/inputrc << "EOF" … … 75 81 76 82 </sect1> 77 -
chapter07/introduction.xml
r1714f1a r46a2e9c 1 1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" 3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 3 4 <!ENTITY % general-entities SYSTEM "../general.ent"> 4 5 %general-entities; 5 6 ]> 7 6 8 <sect1 id="ch-scripts-introduction"> 7 <title>Introduction</title> 8 <?dbhtml filename="introduction.html"?> 9 <?dbhtml filename="introduction.html"?> 9 10 10 <para>This chapter details how to install and configure the LFS-Bootscripts 11 package. Most of these scripts will work without modification, but a few require 12 additional configuration files because they deal with hardware-dependent 13 information.</para> 11 <title>Introduction</title> 14 12 15 <para>System-V style init scripts are employed in this book because they are 16 widely used. For additional options, a hint detailing the BSD style 17 init setup is available at 18 <ulink 19 url="http://www.linuxfromscratch.org/hints/downloads/files/bsd-init.txt"/>. 20 Searching the LFS mailing lists for <quote>depinit</quote> will also offer 21 additional choices.</para> 13 <para>This chapter details how to install and configure the LFS-Bootscripts 14 package. Most of these scripts will work without modification, but a few require 15 additional configuration files because they deal with hardware-dependent 16 information.</para> 22 17 23 <para>If using an alternative style of init scripts, skip this chapter 24 and move on to <xref linkend="chapter-bootable"/>.</para> 18 <para>System-V style init scripts are employed in this book because they are 19 widely used. For additional options, a hint detailing the BSD style init setup 20 is available at <ulink 21 url="http://www.linuxfromscratch.org/hints/downloads/files/bsd-init.txt"/>. 22 Searching the LFS mailing lists for <quote>depinit</quote> will also offer 23 additional choices.</para> 24 25 <para>If using an alternative style of init scripts, skip this chapter 26 and move on to <xref linkend="chapter-bootable"/>.</para> 25 27 26 28 </sect1> 27 -
chapter07/network.xml
r1714f1a r46a2e9c 1 1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" 3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 3 4 <!ENTITY % general-entities SYSTEM "../general.ent"> 4 5 %general-entities; 5 6 ]> 7 6 8 <sect1 id="ch-scripts-network"> 7 <title>Configuring the network Script</title> 8 <?dbhtml filename="network.html"?> 9 <?dbhtml filename="network.html"?> 9 10 10 <indexterm zone="ch-scripts-network"> 11 <primary sortas="d-network">network</primary> 12 <secondary>configuring</secondary></indexterm> 11 <title>Configuring the network Script</title> 13 12 14 <para>This section only applies if a network card is to be 15 configured.</para> 13 <indexterm zone="ch-scripts-network"> 14 <primary sortas="d-network">network</primary> 15 <secondary>configuring</secondary></indexterm> 16 16 17 <para>If a network card will not be used, there is likely no need to 18 create any configuration files relating to network cards. If that is 19 the case, remove the <filename class="symlink">network</filename> 20 symlinks from all run-level directories (<filename 21 class="directory">/etc/rc.d/rc*.d</filename>).</para> 17 <para>This section only applies if a network card is to be 18 configured.</para> 22 19 23 <sect2> 24 <title>Creating Network Interface Configuration Files</title> 20 <para>If a network card will not be used, there is likely no need to 21 create any configuration files relating to network cards. If that is 22 the case, remove the <filename class="symlink">network</filename> 23 symlinks from all run-level directories (<filename 24 class="directory">/etc/rc.d/rc*.d</filename>).</para> 25 25 26 <!-- Edit Me --> 27 <para>Which interfaces are brought up and down by the network script 28 depends on the files and directories in the <filename 29 class="directory">/etc/sysconfig/network-devices</filename> hierarchy. 30 This directory should contain a sub-directory for each interface to be configured, 31 such as <filename>ifconfig.xyz</filename>, where <quote>xyz</quote> is a 32 network interface name. Inside this directory would be files defining 33 the attributes to this interface, such as its IP address(es), subnet 34 masks, and so forth.</para> 26 <sect2> 27 <title>Creating Network Interface Configuration Files</title> 35 28 36 <para>The following command creates a sample <filename>ipv4</filename> file for 37 the <emphasis>eth0</emphasis> device:</para> 29 <para>Which interfaces are brought up and down by the network script 30 depends on the files and directories in the <filename 31 class="directory">/etc/sysconfig/network-devices</filename> hierarchy. 32 This directory should contain a sub-directory for each interface to be 33 configured, such as <filename>ifconfig.xyz</filename>, where 34 <quote>xyz</quote> is a network interface name. Inside this directory 35 would be files defining the attributes to this interface, such as its IP 36 address(es), subnet masks, and so forth.</para> 37 38 <para>The following command creates a sample <filename>ipv4</filename> 39 file for the <emphasis>eth0</emphasis> device:</para> 38 40 39 41 <screen><userinput>cd /etc/sysconfig/network-devices && … … 48 50 EOF</userinput></screen> 49 51 50 <para>The values of these variables must be changed in every file to match the 51 proper setup. If the <envar>ONBOOT</envar> variable is set to <quote>yes</quote> 52 the network script will bring up the Network Interface Card (NIC) during booting 53 of the system. If set to anything but <quote>yes</quote> the NIC will be ignored 54 by the network script and not be brought up.</para> 52 <para>The values of these variables must be changed in every file to match 53 the proper setup. If the <envar>ONBOOT</envar> variable is set to 54 <quote>yes</quote> the network script will bring up the Network Interface 55 Card (NIC) during booting of the system. If set to anything but 56 <quote>yes</quote> the NIC will be ignored by the network script and not 57 be brought up.</para> 55 58 56 <para>The <envar>SERVICE</envar> variable defines the method used for obtaining 57 the IP address. The LFS-Bootscripts package has a modular IP assignment format, 58 and creating additional files in the <filename 59 class="directory">/etc/sysconfig/network-devices/services</filename> directory 60 allows other IP assignment methods. This is commonly used for Dynamic Host 61 Configuration Protocol (DHCP), which is addressed in the BLFS book.</para> 59 <para>The <envar>SERVICE</envar> variable defines the method used for 60 obtaining the IP address. The LFS-Bootscripts package has a modular IP 61 assignment format, and creating additional files in the <filename 62 class="directory">/etc/sysconfig/network-devices/services</filename> 63 directory allows other IP assignment methods. This is commonly used for 64 Dynamic Host Configuration Protocol (DHCP), which is addressed in the 65 BLFS book.</para> 62 66 63 <para>The <envar>GATEWAY</envar> variable should contain 64 the default gateway IP address, if one is present. If not, then comment out 65 thevariable entirely.</para>67 <para>The <envar>GATEWAY</envar> variable should contain the default 68 gateway IP address, if one is present. If not, then comment out the 69 variable entirely.</para> 66 70 67 <para>The <envar>PREFIX</envar> variable needs to contain the number of bits 68 used in the subnet. Each octet in an IP address is 8 bits. If the subnet's 69 netmask is 255.255.255.0, then it is using the first three octets (24 bits) to 70 specify the network number. If the netmask is 255.255.255.240, it would be using 71 the first 28 bits. Prefixes longer than 24 bits are commonly used by DSL and 72 cable-based Internet Service Providers (ISPs). In this example (PREFIX=24), the 73 netmask is 255.255.255.0. Adjust the <envar>PREFIX</envar> variable according to 74 your specific subnet.</para>71 <para>The <envar>PREFIX</envar> variable needs to contain the number of 72 bits used in the subnet. Each octet in an IP address is 8 bits. If the 73 subnet's netmask is 255.255.255.0, then it is using the first three octets 74 (24 bits) to specify the network number. If the netmask is 255.255.255.240, 75 it would be using the first 28 bits. Prefixes longer than 24 bits are 76 commonly used by DSL and cable-based Internet Service Providers (ISPs). 77 In this example (PREFIX=24), the netmask is 255.255.255.0. Adjust the 78 <envar>PREFIX</envar> variable according to your specific subnet.</para> 75 79 76 </sect2>80 </sect2> 77 81 78 <sect2 id="resolv.conf"> 79 <title>Creating the /etc/resolv.conf File</title> 80 <indexterm zone="resolv.conf"><primary sortas="e-/etc/resolv.conf">/etc/resolv.conf</primary></indexterm> 82 <sect2 id="resolv.conf"> 83 <title>Creating the /etc/resolv.conf File</title> 81 84 82 <para>If the system is going to be connected to the Internet, it will 83 need some means of Domain Name Service (DNS) name resolution to 84 resolve Internet domain names to IP addresses, and vice versa. This is 85 best achieved by placing the IP address of the DNS server, available 86 from the ISP or network administrator, into 87 <filename>/etc/resolv.conf</filename>. Create the file by running the 88 following:</para> 85 <indexterm zone="resolv.conf"> 86 <primary sortas="e-/etc/resolv.conf">/etc/resolv.conf</primary> 87 </indexterm> 88 89 <para>If the system is going to be connected to the Internet, it will 90 need some means of Domain Name Service (DNS) name resolution to 91 resolve Internet domain names to IP addresses, and vice versa. This is 92 best achieved by placing the IP address of the DNS server, available 93 from the ISP or network administrator, into 94 <filename>/etc/resolv.conf</filename>. Create the file by running the 95 following:</para> 89 96 90 97 <screen><userinput>cat > /etc/resolv.conf << "EOF" … … 98 105 EOF</userinput></screen> 99 106 100 <para>Replace <replaceable>[IP address of the 101 nameserver]</replaceable> with the IP address of the DNS most 102 appropriate for the setup. There will often be more than one entry 103 (requirements demand secondary servers for fallback capability). If 104 you only need or want one DNS server, remove the second 105 <emphasis>nameserver</emphasis> line from the file. The IP address may 106 also be a router on the local network.</para> 107 </sect2>107 <para>Replace <replaceable>[IP address of the nameserver]</replaceable> 108 with the IP address of the DNS most appropriate for the setup. There will 109 often be more than one entry (requirements demand secondary servers for 110 fallback capability). If you only need or want one DNS server, remove the 111 second <emphasis>nameserver</emphasis> line from the file. The IP address 112 may also be a router on the local network.</para> 113 114 </sect2> 108 115 109 116 </sect1> 110 -
chapter07/profile.xml
r1714f1a r46a2e9c 1 1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" 3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 3 4 <!ENTITY % general-entities SYSTEM "../general.ent"> 4 5 %general-entities; 5 6 ]> 7 6 8 <sect1 id="ch-scripts-profile"> 7 <title>The Bash Shell Startup Files</title> 8 <?dbhtml filename="profile.html"?> 9 <?dbhtml filename="profile.html"?> 9 10 10 <indexterm zone="ch-scripts-profile"><primary sortas="e-/etc/profile">/etc/profile</primary></indexterm>11 <title>The Bash Shell Startup Files</title> 11 12 12 <para>The shell program <command>/bin/bash</command> (hereafter 13 referred to as <quote>the shell</quote>) uses a collection of startup 14 files to help create an environment to run in. Each file has a 15 specific use and may affect login and interactive environments 16 differently. The files in the <filename 17 class="directory">/etc</filename> directory provide global settings. 18 If an equivalent file exists in the home directory, it may override 19 the global settings.</para> 13 <indexterm zone="ch-scripts-profile"> 14 <primary sortas="e-/etc/profile">/etc/profile</primary> 15 </indexterm> 20 16 21 <para>An interactive login shell is started after a successful login, 22 using <command>/bin/login</command>, by reading the 23 <filename>/etc/passwd</filename> file. An interactive non-login shell 24 is started at the command-line (e.g., 25 <prompt>[prompt]$</prompt><command>/bin/bash</command>). A 26 non-interactive shell is usually present when a shell script is 27 running. It is non-interactive because it is processing a script and 28 not waiting for user input between commands.</para> 17 <para>The shell program <command>/bin/bash</command> (hereafter referred to 18 as <quote>the shell</quote>) uses a collection of startup files to help 19 create an environment to run in. Each file has a specific use and may affect 20 login and interactive environments differently. The files in the <filename 21 class="directory">/etc</filename> directory provide global settings. If an 22 equivalent file exists in the home directory, it may override the global 23 settings.</para> 29 24 30 <para>For more information, see <command>info bash</command> under the 31 <emphasis>Bash Startup Files and Interactive Shells</emphasis> section.</para> 25 <para>An interactive login shell is started after a successful login, using 26 <command>/bin/login</command>, by reading the <filename>/etc/passwd</filename> 27 file. An interactive non-login shell is started at the command-line (e.g., 28 <prompt>[prompt]$</prompt><command>/bin/bash</command>). A non-interactive 29 shell is usually present when a shell script is running. It is non-interactive 30 because it is processing a script and not waiting for user input between 31 commands.</para> 32 32 33 <para>The files <filename>/etc/profile</filename> and 34 <filename>~/.bash_profile</filename> are read when the shell is 35 invoked as an interactive login shell.</para> 33 <para>For more information, see <command>info bash</command> under the 34 <emphasis>Bash Startup Files and Interactive Shells</emphasis> section.</para> 36 35 37 <para>The base <filename>/etc/profile</filename> below sets some 38 environment variables necessary for native language support. Setting 39 them properly results in:</para>36 <para>The files <filename>/etc/profile</filename> and 37 <filename>~/.bash_profile</filename> are read when the shell is 38 invoked as an interactive login shell.</para> 40 39 41 <itemizedlist> 42 <listitem><para>The output of programs translated into the native 43 language</para></listitem> 44 <listitem><para>Correct classification of characters into letters, digits and 45 other classes. This is necessary for <command>bash</command> to properly accept 46 non-ASCII characters in command lines in non-English locales</para></listitem> 47 <listitem><para>The correct alphabetical sorting order for the 48 country</para></listitem> 49 <listitem><para>Appropriate default paper size</para></listitem> 50 <listitem><para>Correct formatting of monetary, time, and date 51 values</para></listitem> 52 </itemizedlist> 40 <para>The base <filename>/etc/profile</filename> below sets some 41 environment variables necessary for native language support. Setting 42 them properly results in:</para> 53 43 54 <para>This script also sets the <envar>INPUTRC</envar> environment variable that 55 makes Bash and Readline use the <filename>/etc/inputrc</filename> file created 56 earlier.</para> 44 <itemizedlist> 45 <listitem> 46 <para>The output of programs translated into the native language</para> 47 </listitem> 48 <listitem> 49 <para>Correct classification of characters into letters, digits and other 50 classes. This is necessary for <command>bash</command> to properly accept 51 non-ASCII characters in command lines in non-English locales</para> 52 </listitem> 53 <listitem> 54 <para>The correct alphabetical sorting order for the country</para> 55 </listitem> 56 <listitem> 57 <para>Appropriate default paper size</para> 58 </listitem> 59 <listitem> 60 <para>Correct formatting of monetary, time, and date values</para> 61 </listitem> 62 </itemizedlist> 57 63 58 <para>Replace <replaceable>[ll]</replaceable> below with the 59 two-letter code for the desired language (e.g., <quote>en</quote>) and 60 <replaceable>[CC]</replaceable> with the two-letter code for the 61 appropriate country (e.g., <quote>GB</quote>). 62 <replaceable>[charmap]</replaceable> should be replaced with the 63 canonical charmap for your chosen locale.</para> 64 <para>This script also sets the <envar>INPUTRC</envar> environment variable that 65 makes Bash and Readline use the <filename>/etc/inputrc</filename> file created 66 earlier.</para> 64 67 65 <para>The list of all locales supported by Glibc can be obtained by running 66 the following command:</para> 68 <para>Replace <replaceable>[ll]</replaceable> below with the two-letter code 69 for the desired language (e.g., <quote>en</quote>) and 70 <replaceable>[CC]</replaceable> with the two-letter code for the appropriate 71 country (e.g., <quote>GB</quote>). <replaceable>[charmap]</replaceable> should 72 be replaced with the canonical charmap for your chosen locale. Optional 73 modifiers such as <quote>@euro</quote> may also be present.</para> 74 75 <para>The list of all locales supported by Glibc can be obtained by running 76 the following command:</para> 67 77 68 78 <screen role="nodump"><userinput>locale -a</userinput></screen> 69 79 70 <para>Locales can have a number of synonyms, e.g. <quote>ISO-8859-1</quote> is 71 also referred to as <quote>iso8859-1</quote> and <quote>iso88591</quote>. 72 Some applications cannot handle the various synonyms correctly, so it is safest 73 to choose the canonical name for a particular locale. To determine the 74 canonical name, run the following command, where 75 <replaceable>[locale name]</replaceable> is the output given by 76 <command>locale -a</command> for your preferred locale 77 (<quote>en_GB.iso88591</quote> in our example).</para> 80 <para>Charmaps can have a number of aliases, e.g., <quote>ISO-8859-1</quote> 81 is also referred to as <quote>iso8859-1</quote> and <quote>iso88591</quote>. 82 Some applications cannot handle the various synonyms correctly (e.g., require 83 that <quote>UTF-8</quote> is written as <quote>UTF-8</quote>, not 84 <quote>utf8</quote>), so it is safest in most 85 cases to choose the canonical name for a particular locale. To determine 86 the canonical name, run the following command, where <replaceable>[locale 87 name]</replaceable> is the output given by <command>locale -a</command> for 88 your preferred locale (<quote>en_GB.iso88591</quote> in our example).</para> 78 89 79 90 <screen role="nodump"><userinput>LC_ALL=<replaceable>[locale name]</replaceable> locale charmap</userinput></screen> 80 91 81 <para>For the <quote>en_GB.iso88591</quote> locale, the above command82 will print:</para>92 <para>For the <quote>en_GB.iso88591</quote> locale, the above command 93 will print:</para> 83 94 84 <screen> ISO-8859-1</screen>95 <screen><computeroutput>ISO-8859-1</computeroutput></screen> 85 96 86 <para>This results in a final locale setting of <quote>en_GB.ISO-8859-1</quote>.</para> 97 <para>This results in a final locale setting of <quote>en_GB.ISO-8859-1</quote>. 98 It is important that the locale found using the heuristic above is tested prior 99 to it being added to the Bash startup files:</para> 87 100 88 <para>Once the proper locale settings have been determined, create the 89 <filename>/etc/profile</filename> file:</para> 101 <screen role="nodump"><userinput>LC_ALL=[locale name] locale country 102 LC_ALL=[locale name] locale language 103 LC_ALL=[locale name] locale charmap 104 LC_ALL=[locale name] locale int_curr_symbol 105 LC_ALL=[locale name] locale int_prefix</userinput></screen> 106 107 <para>The above commands should print the country and language names, the 108 character encoding used by the locale, the local currency and the prefix to dial 109 before the telephone number in order to get into the country. If any of the 110 commands above fail with a message similar to the one shown below, this means 111 that your locale was either not installed in Chapter 6 or is not supported by 112 the default installation of Glibc.</para> 113 114 <screen><computeroutput>locale: Cannot set LC_* to default locale: No such file or directory</computeroutput></screen> 115 116 <para>If this happens, you should either install the desired locale using the 117 <command>localedef</command> command, or consider choosing a different locale. 118 Further instructions assume that there are no such error messages from 119 Glibc.</para> 120 121 <!-- FIXME: the xlib example will became obsolete real soon --> 122 <para>Some packages beyond LFS may also lack support for your chosen locale. One 123 example is the X library (part of the X Window System), which outputs the 124 following error message:</para> 125 126 <screen><computeroutput>Warning: locale not supported by Xlib, locale set to C</computeroutput></screen> 127 128 <para>Sometimes it is possible to fix this by removing the charmap part of the 129 locale specification, as long as that does not change the character map that 130 Glibc associates with the locale (this can be checked by running the 131 <command>locale charmap</command> command in both locales). For example, one 132 would have to change "de_DE.ISO-8859-15@euro" to 133 "de_DE@euro" in order to get this locale recognized by Xlib.</para> 134 135 <para>Other packages can also function incorrectly (but may not necessarily 136 display any error messages) if the locale name does not meet their expectations. 137 In those cases, investigating how other Linux distributions support your locale 138 might provide some useful information.</para> 139 140 <para>Once the proper locale settings have been determined, create the 141 <filename>/etc/profile</filename> file:</para> 90 142 91 143 <screen><userinput>cat > /etc/profile << "EOF" 92 144 <literal># Begin /etc/profile 93 145 94 export LANG=<replaceable>[ll]</replaceable>_<replaceable>[CC]</replaceable>.<replaceable>[charmap]</replaceable> 146 export LANG=<replaceable>[ll]</replaceable>_<replaceable>[CC]</replaceable>.<replaceable>[charmap]</replaceable><replaceable>[@modifiers]</replaceable> 95 147 export INPUTRC=/etc/inputrc 96 148 … … 98 150 EOF</userinput></screen> 99 151 100 <note><para>The <quote>C</quote> (default) and <quote>en_US</quote> 101 (the recommended one for United States English users) locales are 102 different.</para></note> 152 <para>The <quote>C</quote> (default) and <quote>en_US</quote> (the recommended 153 one for United States English users) locales are different. <quote>C</quote> 154 uses the US-ASCII 7-bit character set, and treats bytes with the high bit set 155 as invalid characters. That's why, e.g., the <command>ls</command> command 156 substitutes them with question marks in that locale. Also, an attempt to send 157 mail with such characters from Mutt or Pine results in non-RFC-conforming 158 messages being sent (the charset in the outgoing mail is indicated as <quote>unknown 159 8-bit</quote>). So you can use the <quote>C</quote> locale only if you are sure that 160 you will never need 8-bit characters.</para> 103 161 104 <para>Setting the keyboard layout, screen font, and 105 locale-related environment variables are the only internationalization 106 steps needed to support locales that use ordinary single-byte 107 encodings and left-to-right writing direction. More complex cases 108 (including UTF-8 based locales) require additional steps and 109 additional patches because many applications tend to not work properly 110 under such conditions. These steps and patches are not included in 111 the LFS book and such locales are not yet supported by LFS.</para> 162 <para>UTF-8 based locales are not supported well by many programs. E.g., the 163 <command>watch</command> program displays only ASCII characters in UTF-8 164 locales and has no such restriction in traditional 8-bit locales like en_US. 165 Without patches and/or installing software beyond BLFS, in UTF-8 based locales 166 you will not be able to do such basic tasks as printing plain-text files from 167 the command line, recording Windows-readable CDs with filenames containing 168 non-ASCII characters, viewing ID3v1 tags in MP3 files and so on. Work is in 169 progress to document and, if possible, fix such problems, see 170 <ulink url="&blfs-root;view/svn/introduction/locale-issues.html"/>. 171 It is, however, safe to use UTF-8 based locales if you are going to use only 172 KDE or GNOME and never open the terminal.</para> 173 <!-- All abovementioned problems except "watch" have a known fix beyond BLFS --> 112 174 113 175 </sect1> 114 -
chapter07/setclock.xml
r1714f1a r46a2e9c 1 1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" 3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 3 4 <!ENTITY % general-entities SYSTEM "../general.ent"> 4 5 %general-entities; 5 6 ]> 7 6 8 <sect1 id="ch-scripts-setclock"> 7 <title>Configuring the setclock Script</title> 8 <?dbhtml filename="setclock.html"?> 9 <?dbhtml filename="setclock.html"?> 9 10 10 <indexterm zone="ch-scripts-setclock"> 11 <primary sortas="d-setclock">setclock</primary> 12 <secondary>configuring</secondary></indexterm> 11 <title>Configuring the setclock Script</title> 13 12 14 <para>The <command>setclock</command> script reads the time from the hardware 15 clock, also known as the BIOS or the Complementary Metal Oxide Semiconductor 16 (CMOS) clock. If the hardware clock is set to UTC, this script will convert the 17 hardware clock's time to the local time using the 18 <filename>/etc/localtime</filename> file (which tells the 19 <command>hwclock</command> program which timezone the user is in). There is no 20 way to detect whether or not the hardware clock is set to UTC, so this 21 needs to be configured manually.</para> 13 <indexterm zone="ch-scripts-setclock"> 14 <primary sortas="d-setclock">setclock</primary> 15 <secondary>configuring</secondary></indexterm> 22 16 23 <para>If you cannot remember whether or not the hardware clock is set to UTC, 24 find out by running the <userinput>hwclock --localtime --show</userinput> 25 command. This will display what the current time is according to the hardware 26 clock. If this time matches whatever your watch says, then the hardware clock is 27 set to local time. If the output from <command>hwclock</command> is not local 28 time, chances are it is set to UTC time. Verify this by adding or subtracting 29 the proper amount of hours for the timezone to the time shown by 30 <command>hwclock</command>. For example, if you are currently in the MST 31 timezone, which is also known as GMT -0700, add seven hours to the local 32 time.</para> 17 <para>The <command>setclock</command> script reads the time from the hardware 18 clock, also known as the BIOS or the Complementary Metal Oxide Semiconductor 19 (CMOS) clock. If the hardware clock is set to UTC, this script will convert the 20 hardware clock's time to the local time using the 21 <filename>/etc/localtime</filename> file (which tells the 22 <command>hwclock</command> program which timezone the user is in). There is no 23 way to detect whether or not the hardware clock is set to UTC, so this 24 needs to be configured manually.</para> 33 25 34 <para>Change the value of the <envar>UTC</envar> variable below 35 to a value of <parameter>0</parameter> (zero) if the hardware clock 36 is <emphasis>not</emphasis> set to UTC time.</para> 26 <para>If you cannot remember whether or not the hardware clock is set to UTC, 27 find out by running the <userinput>hwclock --localtime --show</userinput> 28 command. This will display what the current time is according to the hardware 29 clock. If this time matches whatever your watch says, then the hardware clock is 30 set to local time. If the output from <command>hwclock</command> is not local 31 time, chances are it is set to UTC time. Verify this by adding or subtracting 32 the proper amount of hours for the timezone to the time shown by 33 <command>hwclock</command>. For example, if you are currently in the MST 34 timezone, which is also known as GMT -0700, add seven hours to the local 35 time.</para> 37 36 38 <para>Create a new file <filename>/etc/sysconfig/clock</filename> by running 39 the following:</para> 37 <para>Change the value of the <envar>UTC</envar> variable below 38 to a value of <parameter>0</parameter> (zero) if the hardware clock 39 is <emphasis>not</emphasis> set to UTC time.</para> 40 41 <para>Create a new file <filename>/etc/sysconfig/clock</filename> by running 42 the following:</para> 40 43 41 44 <screen><userinput>cat > /etc/sysconfig/clock << "EOF" … … 47 50 EOF</userinput></screen> 48 51 49 <para>A good hint explaining how to deal with time on LFS is available50 at <ulink url="&hints-root;time.txt"/>. It explains issues such as51 time zones, UTC, and the <envar>TZ</envar> environment variable.</para>52 <para>A good hint explaining how to deal with time on LFS is available 53 at <ulink url="&hints-root;time.txt"/>. It explains issues such as 54 time zones, UTC, and the <envar>TZ</envar> environment variable.</para> 52 55 53 56 </sect1> 54 -
chapter07/sysklogd.xml
r1714f1a r46a2e9c 1 1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" 3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 3 4 <!ENTITY % general-entities SYSTEM "../general.ent"> 4 5 %general-entities; 5 6 ]> 7 6 8 <sect1 id="ch-scripts-sysklogd"> 7 <title>Configuring the sysklogd script</title> 8 <?dbhtml filename="sysklogd.html"?> 9 <?dbhtml filename="sysklogd.html"?> 9 10 10 <indexterm zone="ch-scripts-sysklogd"> 11 <primary sortas="d-sysklogd">sysklogd</primary> 12 <secondary>configuring</secondary></indexterm> 11 <title>Configuring the sysklogd script</title> 13 12 14 <para>The <filename>sysklogd</filename> script invokes the 15 <command>syslogd</command> program with the <parameter>-m 0</parameter> option. 16 This option turns off the periodic timestamp mark that 17 <command>syslogd</command> writes to the log files every 20 minutes by default. 18 If you want to turn on this periodic timestamp mark, edit the 19 <filename>sysklogd</filename> script and make the changes accordingly. See 20 <userinput>man syslogd</userinput> for more information.</para> 13 <indexterm zone="ch-scripts-sysklogd"> 14 <primary sortas="d-sysklogd">sysklogd</primary> 15 <secondary>configuring</secondary> 16 </indexterm> 17 18 <para>The <filename>sysklogd</filename> script invokes the 19 <command>syslogd</command> program with the <parameter>-m 0</parameter> option. 20 This option turns off the periodic timestamp mark that 21 <command>syslogd</command> writes to the log files every 20 minutes by default. 22 If you want to turn on this periodic timestamp mark, edit the 23 <filename>sysklogd</filename> script and make the changes accordingly. See 24 <userinput>man syslogd</userinput> for more information.</para> 21 25 22 26 </sect1> -
chapter07/udev.xml
r1714f1a r46a2e9c 1 1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" 3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 3 4 <!ENTITY % general-entities SYSTEM "../general.ent"> 4 5 %general-entities; 5 6 ]> 7 6 8 <sect1 id="ch-scripts-udev"> 7 <title>Device and Module Handling on an LFS System</title> 8 <?dbhtml filename="udev.html"?> 9 10 <indexterm zone="ch-scripts-udev"> 11 <primary sortas="a-Udev">Udev</primary> 12 <secondary>usage</secondary></indexterm> 13 14 <para>In <xref linkend="chapter-building-system"/>, we installed the Udev 15 package. Before we go into the details regarding how this works, 16 a brief history of previous methods of handling devices is in 17 order.</para> 18 19 <para>Linux systems in general traditionally use a static device creation 20 method, whereby a great many device nodes are created under <filename 21 class="directory">/dev</filename> (sometimes literally thousands of nodes), 22 regardless of whether the corresponding hardware devices actually exist. This is 23 typically done via a <command>MAKEDEV</command> script, which contains a number 24 of calls to the <command>mknod</command> program with the relevant major and 25 minor device numbers for every possible device that might exist in the world. 26 Using the Udev method, only those devices which are detected by the kernel get 27 device nodes created for them. Because these device nodes will be created each 28 time the system boots, they will be stored on a <systemitem 29 class="filesystem">tmpfs</systemitem> file system (a virtual file system that 30 resides entirely in system memory). Device nodes do not require much space, so 31 the memory that is used is negligible.</para> 32 33 <sect2> 34 <title>History</title> 35 36 <para>In February 2000, a new filesystem called <systemitem 37 class="filesystem">devfs</systemitem> was merged into the 2.3.46 38 kernel and was made available during the 2.4 series of 39 stable kernels. Although it was present in the kernel source itself, 40 this method of creating devices dynamically never received 41 overwhelming support from the core kernel developers.</para> 42 43 <para>The main problem with the approach adopted by <systemitem 44 class="filesystem">devfs</systemitem> was the way it handled 45 device detection, creation, and naming. The latter issue, that of 46 device node naming, was perhaps the most critical. It is generally 47 accepted that if device names are allowed to be configurable, then 48 the device naming policy should be up to a system administrator, not 49 imposed on them by any particular developer(s). The <systemitem 50 class="filesystem">devfs</systemitem> file system also suffers from race 51 conditions that are inherent in its design and cannot be fixed 52 without a substantial revision to the kernel. It has also been marked 53 as deprecated due to a lack of recent maintenance.</para> 54 55 <para>With the development of the unstable 2.5 kernel tree, later released as 56 the 2.6 series of stable kernels, a new virtual filesystem called <systemitem 57 class="filesystem">sysfs</systemitem> came to be. The job of <systemitem 58 class="filesystem">sysfs</systemitem> is to export a view of the system's 59 hardrware configuration to userspace processes. With this userspace-visible 60 representation, the possibility of seeing a userspace replacement for 61 <systemitem class="filesystem">devfs</systemitem> became much more 62 realistic.</para> 63 64 </sect2> 65 66 <sect2> 67 <title>Udev Implementation</title> 68 69 <para>The <systemitem class="filesystem">sysfs</systemitem> filesystem was 70 mentioned briefly above. One may wonder how <systemitem 71 class="filesystem">sysfs</systemitem> knows about the devices present on a 72 system and what device numbers should be used for them. Drivers that have been 73 compiled into the kernel directly register their objects with <systemitem 74 class="filesystem">sysfs</systemitem> as they are detected by the kernel. For 75 drivers compiled as modules, this registration will happen when the module is 76 loaded. Once the <systemitem class="filesystem">sysfs</systemitem> filesystem is 77 mounted (on <filename class="directory">/sys</filename>), data which the 78 built-in drivers registered with <systemitem 79 class="filesystem">sysfs</systemitem> are available to userspace processes and 80 to <command>udev</command> for device node creation.</para> 81 82 <para>The <command>S10udev</command> initscript takes care of creating these 83 device nodes when Linux is booted. This script starts by registering 84 <command>/sbin/udevsend</command> as a hotplug event handler. Hotplug events 85 (discussed below) are not usually generated during this stage, but 86 <command>udev</command> is registered just in case they do occur. The 87 <command>udevstart</command> program then walks through the <systemitem 88 class="filesystem">/sys</systemitem> filesystem and creates devices under 89 <filename class="directory">/dev</filename> that match the descriptions. For 90 example, <filename>/sys/class/tty/vcs/dev</filename> contains the string 91 <quote>7:0</quote> This string is used by <command>udevstart</command> to create 92 <filename>/dev/vcs</filename> with major number <emphasis>7</emphasis> and minor 93 <emphasis>0</emphasis>. The names and permissions of the nodes created under 94 the <filename class="directory">/dev</filename> directory are configured 95 according to the rules specified in the files within the <filename 96 class="directory">/etc/udev/rules.d/</filename> directory. These are numbered in 97 a similar fashion to the LFS-Bootscripts package. If <command>udev</command> 98 can't find a rule for the device it is creating, it will default permissions to 99 <emphasis>660</emphasis> and ownership to <emphasis>root:root</emphasis>.</para> 100 101 <para>Once the above stage is complete, all devices that were already present 102 and have compiled-in drivers will be available for use. This leads us to the 103 devices that have modular drivers.</para> 104 105 <para>Earlier, we mentioned the concept of a <quote>hotplug event 106 handler.</quote> When a new device connection is detected by the kernel, the 107 kernel will generate a hotplug event and look at the file 108 <filename>/proc/sys/kernel/hotplug</filename> to determine the userspace program 109 that handles the device's connection. The <command>udev</command> bootscript 110 registered <command>udevsend</command> as this handler. When these hotplug 111 events are generated, the kernel will tell <command>udev</command> to check the 112 <filename class="directory">/sys</filename> filesystem for the information 113 pertaining to this new device and create the <filename 114 class="directory">/dev</filename> entry for it.</para> 115 116 <para>This brings us to one problem that exists with <command>udev</command>, 117 and likewise with <systemitem class="filesystem">devfs</systemitem> before it. 118 It is commonly referred to as the <quote>chicken and egg</quote> problem. Most 119 Linux distributions handle loading modules via entries in 120 <filename>/etc/modules.conf</filename>. Access to a device node causes the 121 appropriate kernel module to load. With <command>udev</command>, this method 122 will not work because the device node does not exist until the module is loaded. 123 To solve this, the <command>S05modules</command> bootscript was added to the 124 LFS-Bootscripts package, along with the 125 <filename>/etc/sysconfig/modules</filename> file. By adding module names to the 126 <filename>modules</filename> file, these modules will be loaded when the 127 computer starts up. This allows <command>udev</command> to detect the devices 128 and create the appropriate device nodes.</para> 129 130 <para>Note that on slower machines or for drivers that create a lot 131 of device nodes, the process of creating devices may take a few 132 seconds to complete. This means that some device nodes may not be 133 immediately accessible.</para> 134 </sect2> 135 136 <sect2> 137 <title>Handling Hotpluggable/Dynamic Devices</title> 138 139 <para>When you plug in a device, such as a Universal Serial Bus (USB) MP3 player, the kernel 140 recognizes that the device is now connected and generates a hotplug 141 event. If the driver is already loaded (either because it was compiled 142 into the kernel or because it was loaded via the 143 <command>S05modules</command> bootscript), <command>udev</command> will 144 be called upon to create the relevant device node(s) according to the 145 <systemitem class="filesystem">sysfs</systemitem> data available in 146 <filename class="directory">/sys</filename>.</para> 147 148 <para>If the driver for the just plugged in device is available as a module but 149 currently unloaded, the Hotplug package will load the appropriate module 150 and make this device available by creating the device node(s) for it.</para> 151 </sect2> 152 153 <sect2> 154 <title>Problems with Creating Devices</title> 155 156 <para>There are a few known problems when it comes to automatically creating 157 device nodes:</para> 158 159 <para>1) A kernel driver may not export its data to <systemitem 160 class="filesystem">sysfs</systemitem>.</para> 161 162 <para>This is most common with third party drivers from outside the kernel tree. 163 Udev will be unable to automatically create device nodes for such drivers. Use 164 the <filename>/etc/sysconfig/createfiles</filename> configuration file to 165 manually create the devices. Consult the <filename>devices.txt</filename> file 166 inside the kernel documentation or the documentation for that driver to find the 167 proper major/minor numbers.</para> 168 169 <para>2) A non-hardware device is required. This is most common with 170 the Advanced Linux Sound Architecture (ALSA) project's Open Sound 171 System (OSS) compatibility module. These types of devices can be 172 handled in one of two ways:</para> 173 174 <itemizedlist> 175 176 <listitem><para>Adding the module names to 177 <filename>/etc/sysconfig/modules</filename></para></listitem> 178 <listitem><para>Using an 179 <quote>install</quote> line in 180 <filename>/etc/modprobe.conf</filename>. This tells the 181 <command>modprobe</command> command <quote>when loading this module, 182 also load this other module, at the same time.</quote> For example:</para> 9 <?dbhtml filename="udev.html"?> 10 11 <title>Device and Module Handling on an LFS System</title> 12 13 <indexterm zone="ch-scripts-udev"> 14 <primary sortas="a-Udev">Udev</primary> 15 <secondary>usage</secondary> 16 </indexterm> 17 18 <para>In <xref linkend="chapter-building-system"/>, we installed the Udev 19 package. Before we go into the details regarding how this works, 20 a brief history of previous methods of handling devices is in 21 order.</para> 22 23 <para>Linux systems in general traditionally use a static device creation 24 method, whereby a great many device nodes are created under <filename 25 class="directory">/dev</filename> (sometimes literally thousands of nodes), 26 regardless of whether the corresponding hardware devices actually exist. This is 27 typically done via a <command>MAKEDEV</command> script, which contains a number 28 of calls to the <command>mknod</command> program with the relevant major and 29 minor device numbers for every possible device that might exist in the world. 30 Using the Udev method, only those devices which are detected by the kernel get 31 device nodes created for them. Because these device nodes will be created each 32 time the system boots, they will be stored on a <systemitem 33 class="filesystem">tmpfs</systemitem> file system (a virtual file system that 34 resides entirely in system memory). Device nodes do not require much space, so 35 the memory that is used is negligible.</para> 36 37 <sect2> 38 <title>History</title> 39 40 <para>In February 2000, a new filesystem called <systemitem 41 class="filesystem">devfs</systemitem> was merged into the 2.3.46 kernel 42 and was made available during the 2.4 series of stable kernels. Although 43 it was present in the kernel source itself, this method of creating devices 44 dynamically never received overwhelming support from the core kernel 45 developers.</para> 46 47 <para>The main problem with the approach adopted by <systemitem 48 class="filesystem">devfs</systemitem> was the way it handled device 49 detection, creation, and naming. The latter issue, that of device node 50 naming, was perhaps the most critical. It is generally accepted that if 51 device names are allowed to be configurable, then the device naming policy 52 should be up to a system administrator, not imposed on them by any 53 particular developer(s). The <systemitem class="filesystem">devfs</systemitem> 54 file system also suffers from race conditions that are inherent in its design 55 and cannot be fixed without a substantial revision to the kernel. It has also 56 been marked as deprecated due to a lack of recent maintenance.</para> 57 58 <para>With the development of the unstable 2.5 kernel tree, later released as 59 the 2.6 series of stable kernels, a new virtual filesystem called <systemitem 60 class="filesystem">sysfs</systemitem> came to be. The job of <systemitem 61 class="filesystem">sysfs</systemitem> is to export a view of the system's 62 hardrware configuration to userspace processes. With this userspace-visible 63 representation, the possibility of seeing a userspace replacement for 64 <systemitem class="filesystem">devfs</systemitem> became much more 65 realistic.</para> 66 67 </sect2> 68 69 <sect2> 70 <title>Udev Implementation</title> 71 72 <para>The <systemitem class="filesystem">sysfs</systemitem> filesystem was 73 mentioned briefly above. One may wonder how <systemitem 74 class="filesystem">sysfs</systemitem> knows about the devices present on 75 a system and what device numbers should be used for them. Drivers that have 76 been compiled into the kernel directly register their objects with 77 <systemitem class="filesystem">sysfs</systemitem> as they are detected by 78 the kernel. For drivers compiled as modules, this registration will happen 79 when the module is loaded. Once the <systemitem 80 class="filesystem">sysfs</systemitem> filesystem is mounted (on <filename 81 class="directory">/sys</filename>), data which the built-in drivers 82 registered with <systemitem class="filesystem">sysfs</systemitem> are 83 available to userspace processes and to <command>udev</command> for device 84 node creation.</para> 85 86 <para>The <command>S10udev</command> initscript takes care of creating 87 these device nodes when Linux is booted. This script starts by registering 88 <command>/sbin/udevsend</command> as a hotplug event handler. Hotplug events 89 (discussed below) are not usually generated during this stage, but 90 <command>udev</command> is registered just in case they do occur. The 91 <command>udevstart</command> program then walks through the <systemitem 92 class="filesystem">/sys</systemitem> filesystem and creates devices under 93 <filename class="directory">/dev</filename> that match the descriptions. 94 For example, <filename>/sys/class/tty/vcs/dev</filename> contains the 95 string <quote>7:0</quote> This string is used by <command>udevstart</command> 96 to create <filename>/dev/vcs</filename> with major number 97 <emphasis>7</emphasis> and minor <emphasis>0</emphasis>. The names and 98 permissions of the nodes created under the <filename 99 class="directory">/dev</filename> directory are configured according to the 100 rules specified in the files within the <filename 101 class="directory">/etc/udev/rules.d/</filename> directory. These are 102 numbered in a similar fashion to the LFS-Bootscripts package. If 103 <command>udev</command> can't find a rule for the device it is creating, 104 it will default permissions to <emphasis>660</emphasis> and ownership to 105 <emphasis>root:root</emphasis>.</para> 106 107 <para>Once the above stage is complete, all devices that were already present 108 and have compiled-in drivers will be available for use. This leads us to the 109 devices that have modular drivers.</para> 110 111 <para>Earlier, we mentioned the concept of a <quote>hotplug event 112 handler.</quote> When a new device connection is detected by the kernel, 113 the kernel will generate a hotplug event and look at the file 114 <filename>/proc/sys/kernel/hotplug</filename> to determine the userspace 115 program that handles the device's connection. The <command>udev</command> 116 bootscript registered <command>udevsend</command> as this handler. When 117 these hotplug events are generated, the kernel will tell 118 <command>udev</command> to check the <filename 119 class="directory">/sys</filename> filesystem for the information pertaining 120 to this new device and create the <filename class="directory">/dev</filename> 121 entry for it.</para> 122 123 <para>This brings us to one problem that exists with <command>udev</command>, 124 and likewise with <systemitem class="filesystem">devfs</systemitem> before it. 125 It is commonly referred to as the <quote>chicken and egg</quote> problem. Most 126 Linux distributions handle loading modules via entries in 127 <filename>/etc/modules.conf</filename>. Access to a device node causes the 128 appropriate kernel module to load. With <command>udev</command>, this method 129 will not work because the device node does not exist until the module is loaded. 130 To solve this, the <command>S05modules</command> bootscript was added to the 131 LFS-Bootscripts package, along with the 132 <filename>/etc/sysconfig/modules</filename> file. By adding module names to the 133 <filename>modules</filename> file, these modules will be loaded when the 134 computer starts up. This allows <command>udev</command> to detect the devices 135 and create the appropriate device nodes.</para> 136 137 <para>Note that on slower machines or for drivers that create a lot of device 138 nodes, the process of creating devices may take a few seconds to complete. 139 This means that some device nodes may not be immediately accessible.</para> 140 141 </sect2> 142 143 <sect2> 144 <title>Handling Hotpluggable/Dynamic Devices</title> 145 146 <para>When you plug in a device, such as a Universal Serial Bus (USB) MP3 147 player, the kernel recognizes that the device is now connected and generates 148 a hotplug event. If the driver is already loaded (either because it was 149 compiled into the kernel or because it was loaded via the 150 <command>S05modules</command> bootscript), <command>udev</command> will be 151 called upon to create the relevant device node(s) according to the 152 <systemitem class="filesystem">sysfs</systemitem> data available in 153 <filename class="directory">/sys</filename>.</para> 154 155 <para>If the driver for the just plugged in device is available as a module but 156 currently unloaded, the Hotplug package will load the appropriate module 157 and make this device available by creating the device node(s) for it.</para> 158 159 </sect2> 160 161 <sect2> 162 <title>Problems with Creating Devices</title> 163 164 <para>There are a few known problems when it comes to automatically creating 165 device nodes:</para> 166 167 <para>1) A kernel driver may not export its data to <systemitem 168 class="filesystem">sysfs</systemitem>.</para> 169 170 <para>This is most common with third party drivers from outside the kernel 171 tree. Udev will be unable to automatically create device nodes for such 172 drivers. Use the <filename>/etc/sysconfig/createfiles</filename> 173 configuration file to manually create the devices. Consult the 174 <filename>devices.txt</filename> file inside the kernel documentation or 175 the documentation for that driver to find the proper major/minor 176 numbers.</para> 177 178 <para>2) A non-hardware device is required. This is most common with 179 the Advanced Linux Sound Architecture (ALSA) project's Open Sound 180 System (OSS) compatibility module. These types of devices can be 181 handled in one of two ways:</para> 182 183 <itemizedlist> 184 185 <listitem> 186 <para>Adding the module names to 187 <filename>/etc/sysconfig/modules</filename></para> 188 </listitem> 189 190 <listitem> 191 <para>Using an <quote>install</quote> line in 192 <filename>/etc/modprobe.conf</filename>. This tells the 193 <command>modprobe</command> command <quote>when loading this module, 194 also load this other module, at the same time.</quote> 195 For example:</para> 183 196 184 197 <screen role="nodump"><userinput>install snd-pcm modprobe -i snd-pcm ; modprobe \ 185 198 snd-pcm-oss ; true</userinput></screen> 186 199 187 <para>This will cause the system to load both the 188 <emphasis>snd-pcm</emphasis> and <emphasis>snd-pcm-oss</emphasis> 189 modules when any request is made to load the driver 190 <emphasis>snd-pcm</emphasis>.</para></listitem> 191 </itemizedlist> 192 </sect2> 193 194 <sect2> 195 <title>Useful Reading</title> 196 197 <para>Additional helpful documentation is available at the following 198 sites:</para> 199 200 <itemizedlist> 201 <listitem><para>A Userspace Implementation of <systemitem class="filesystem">devfs</systemitem> 202 <ulink url="http://www.kroah.com/linux/talks/ols_2003_udev_paper/Reprint-Kroah-Hartman-OLS2003.pdf"/></para></listitem> 203 204 <listitem><para>udev FAQ 205 <ulink url="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev-FAQ"/></para></listitem> 206 207 <listitem><para>The Linux Kernel Driver Model 208 <ulink url="http://public.planetmirror.com/pub/lca/2003/proceedings/papers/Patrick_Mochel/Patrick_Mochel.pdf"/></para></listitem> 209 </itemizedlist> 210 </sect2> 200 <para>This will cause the system to load both the 201 <emphasis>snd-pcm</emphasis> and <emphasis>snd-pcm-oss</emphasis> 202 modules when any request is made to load the driver 203 <emphasis>snd-pcm</emphasis>.</para> 204 </listitem> 205 206 </itemizedlist> 207 208 </sect2> 209 210 <sect2> 211 <title>Useful Reading</title> 212 213 <para>Additional helpful documentation is available at the following 214 sites:</para> 215 216 <itemizedlist> 217 218 <listitem> 219 <para>A Userspace Implementation of <systemitem class="filesystem">devfs</systemitem> 220 <ulink url="http://www.kroah.com/linux/talks/ols_2003_udev_paper/Reprint-Kroah-Hartman-OLS2003.pdf"/></para> 221 </listitem> 222 223 <listitem> 224 <para>udev FAQ 225 <ulink url="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev-FAQ"/></para> 226 </listitem> 227 228 <listitem> 229 <para>The Linux Kernel Driver Model 230 <ulink url="http://public.planetmirror.com/pub/lca/2003/proceedings/papers/Patrick_Mochel/Patrick_Mochel.pdf"/></para> 231 </listitem> 232 233 </itemizedlist> 234 235 </sect2> 211 236 212 237 </sect1> 213 -
chapter07/usage.xml
r1714f1a r46a2e9c 1 1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" 3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ 3 4 <!ENTITY % general-entities SYSTEM "../general.ent"> 4 5 %general-entities; 5 6 ]> 7 6 8 <sect1 id="ch-scripts-usage"> 7 <title>How Do These Bootscripts Work?</title> 8 <?dbhtml filename="usage.html"?> 9 <?dbhtml filename="usage.html"?> 9 10 10 <indexterm zone="ch-scripts-usage"> 11 <primary sortas="a-Bootscripts">Bootscripts</primary> 12 <secondary>usage</secondary></indexterm> 11 <title>How Do These Bootscripts Work?</title> 13 12 14 <para>Linux uses a special booting facility named SysVinit that is based on a 15 concept of <emphasis>run-levels</emphasis>. It can be quite different from one 16 system to another, so it cannot be assumed that because things worked in one 17 particular Linux distribution, they should work the same in LFS too. LFS has its 18 own way of doing things, but it respects generally accepted standards.</para> 13 <indexterm zone="ch-scripts-usage"> 14 <primary sortas="a-Bootscripts">Bootscripts</primary> 15 <secondary>usage</secondary> 16 </indexterm> 19 17 20 <para>SysVinit (which will be referred to as <quote>init</quote> from now on) 21 works using a run-levels scheme. There are seven (numbered 0 to 6) run-levels 22 (actually, there are more run-levels, but they are for special cases and are 23 generally not used. See <filename>init(8)</filename> for more details), and each one 24 of those corresponds to the actions the computer is supposed to perform when it 25 starts up. The default run-level is 3. Here are the descriptions of the 26 different run-levels as they are implemented:</para> 18 <para>Linux uses a special booting facility named SysVinit that is based on a 19 concept of <emphasis>run-levels</emphasis>. It can be quite different from one 20 system to another, so it cannot be assumed that because things worked in one 21 particular Linux distribution, they should work the same in LFS too. LFS has its 22 own way of doing things, but it respects generally accepted standards.</para> 23 24 <para>SysVinit (which will be referred to as <quote>init</quote> from now on) 25 works using a run-levels scheme. There are seven (numbered 0 to 6) run-levels 26 (actually, there are more run-levels, but they are for special cases and are 27 generally not used. See <filename>init(8)</filename> for more details), and 28 each one of those corresponds to the actions the computer is supposed to 29 perform when it starts up. The default run-level is 3. Here are the 30 descriptions of the different run-levels as they are implemented:</para> 27 31 28 32 <literallayout>0: halt the computer … … 34 38 6: reboot the computer</literallayout> 35 39 36 <para>The command used to change run-levels is <command>init37 <replaceable>[runlevel]</replaceable></command>, where38 <replaceable>[runlevel]</replaceable> is the target run-level. For example, to39 reboot the computer, a user could issue the <command>init 6</command> command,40 which is an alias for the <command>reboot</command> command. Likewise,41 <command>init 0</command> is an alias for the <command>halt</command>42 command.</para>40 <para>The command used to change run-levels is <command>init 41 <replaceable>[runlevel]</replaceable></command>, where 42 <replaceable>[runlevel]</replaceable> is the target run-level. For example, to 43 reboot the computer, a user could issue the <command>init 6</command> command, 44 which is an alias for the <command>reboot</command> command. Likewise, 45 <command>init 0</command> is an alias for the <command>halt</command> 46 command.</para> 43 47 44 <para>There are a number of directories under <filename45 class="directory">/etc/rc.d</filename> that look like <filename46 class="directory">rc?.d</filename> (where ? is the number of the run-level) and47 <filename class="directory">rcsysinit.d</filename>, all containing a number of48 symbolic links. Some begin with a <emphasis>K</emphasis>, the others begin with49 an <emphasis>S</emphasis>, and all of them have two numbers following the50 initial letter. The K means to stop (kill) a service and the S means to start a51 service. The numbers determine the order in which the scripts are run, from 0052 to 99—the lower the number the earlier it gets executed. When53 <command>init</command> switches to another run-level, the appropriate services54 are either started or stopped, depending on the runlevel chosen.</para>48 <para>There are a number of directories under <filename 49 class="directory">/etc/rc.d</filename> that look like <filename 50 class="directory">rc?.d</filename> (where ? is the number of the run-level) and 51 <filename class="directory">rcsysinit.d</filename>, all containing a number of 52 symbolic links. Some begin with a <emphasis>K</emphasis>, the others begin with 53 an <emphasis>S</emphasis>, and all of them have two numbers following the 54 initial letter. The K means to stop (kill) a service and the S means to start a 55 service. The numbers determine the order in which the scripts are run, from 00 56 to 99—the lower the number the earlier it gets executed. When 57 <command>init</command> switches to another run-level, the appropriate services 58 are either started or stopped, depending on the runlevel chosen.</para> 55 59 56 <para>The real scripts are in <filename 57 class="directory">/etc/rc.d/init.d</filename>. They do the actual 58 work, and the symlinks all point to them. Killing links and starting 59 links point to the same script in <filename 60 class="directory">/etc/rc.d/init.d</filename>. This is because the 61 scripts can be called with different parameters like 62 <parameter>start</parameter>, <parameter>stop</parameter>, 63 <parameter>restart</parameter>, <parameter>reload</parameter>, and 64 <parameter>status</parameter>. When a K link is encountered, the 65 appropriate script is run with the <parameter>stop</parameter> 66 argument. When an S link is encountered, the appropriate script is run 67 with the <parameter>start</parameter> argument.</para> 60 <para>The real scripts are in <filename 61 class="directory">/etc/rc.d/init.d</filename>. They do the actual work, and 62 the symlinks all point to them. Killing links and starting links point to 63 the same script in <filename class="directory">/etc/rc.d/init.d</filename>. 64 This is because the scripts can be called with different parameters like 65 <parameter>start</parameter>, <parameter>stop</parameter>, 66 <parameter>restart</parameter>, <parameter>reload</parameter>, and 67 <parameter>status</parameter>. When a K link is encountered, the appropriate 68 script is run with the <parameter>stop</parameter> argument. When an S link 69 is encountered, the appropriate script is run with the 70 <parameter>start</parameter> argument.</para> 68 71 69 <para>There is one exception to this explanation. Links that start70 with an <emphasis>S</emphasis> in the <filename71 class="directory">rc0.d</filename> and <filename72 class="directory">rc6.d</filename> directories will not cause anything73 to be started. They will be called with the parameter74 <parameter>stop</parameter> to stop something. The logic behind this75 is that when a user is going to reboot or halt the system, nothing76 needs to be started. The system only needs to be stopped.</para>72 <para>There is one exception to this explanation. Links that start 73 with an <emphasis>S</emphasis> in the <filename 74 class="directory">rc0.d</filename> and <filename 75 class="directory">rc6.d</filename> directories will not cause anything 76 to be started. They will be called with the parameter 77 <parameter>stop</parameter> to stop something. The logic behind this 78 is that when a user is going to reboot or halt the system, nothing 79 needs to be started. The system only needs to be stopped.</para> 77 80 78 <para>These are descriptions of what the arguments make the scripts79 do:</para>81 <para>These are descriptions of what the arguments make the scripts 82 do:</para> 80 83 81 <variablelist> 82 <varlistentry> 83 <term><parameter>start</parameter></term> 84 <listitem><para>The service is started.</para></listitem> 85 </varlistentry> 84 <variablelist> 86 85 87 <varlistentry> 88 <term><parameter>stop</parameter></term> 89 <listitem><para>The service is stopped.</para></listitem> 90 </varlistentry> 86 <varlistentry> 87 <term><parameter>start</parameter></term> 88 <listitem> 89 <para>The service is started.</para> 90 </listitem> 91 </varlistentry> 91 92 92 <varlistentry> 93 <term><parameter>restart</parameter></term> 94 <listitem><para>The service is stopped and then started again.</para></listitem> 95 </varlistentry> 93 <varlistentry> 94 <term><parameter>stop</parameter></term> 95 <listitem> 96 <para>The service is stopped.</para> 97 </listitem> 98 </varlistentry> 96 99 97 <varlistentry>98 <term><parameter>reload</parameter></term>99 <listitem><para>The configuration of the service is updated. 100 This is used after the configuration file of a service was modified, when 101 the service does not need to be restarted.</para></listitem>102 </varlistentry>100 <varlistentry> 101 <term><parameter>restart</parameter></term> 102 <listitem> 103 <para>The service is stopped and then started again.</para> 104 </listitem> 105 </varlistentry> 103 106 104 <varlistentry> 105 <term><parameter>status</parameter></term> 106 <listitem><para>Tells if the service is running and with which PIDs.</para></listitem> 107 </varlistentry> 108 </variablelist> 107 <varlistentry> 108 <term><parameter>reload</parameter></term> 109 <listitem> 110 <para>The configuration of the service is updated. 111 This is used after the configuration file of a service was modified, when 112 the service does not need to be restarted.</para> 113 </listitem> 114 </varlistentry> 109 115 110 <para>Feel free to modify the way the boot process works (after all, 111 it is your own LFS system). The files given here are an example of how 112 it can be done.</para> 116 <varlistentry> 117 <term><parameter>status</parameter></term> 118 <listitem> 119 <para>Tells if the service is running and with which PIDs.</para> 120 </listitem> 121 </varlistentry> 122 123 </variablelist> 124 125 <para>Feel free to modify the way the boot process works (after all, 126 it is your own LFS system). The files given here are an example of how 127 it can be done.</para> 113 128 114 129 </sect1> 115
Note:
See TracChangeset
for help on using the changeset viewer.