[673b0d8] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[b06ca36] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[673b0d8] | 4 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
[bf58c1e] | 5 | <!ENTITY site SYSTEM "../appendices/rc.site.script">
|
---|
[673b0d8] | 6 | %general-entities;
|
---|
| 7 | ]>
|
---|
[d781ffb] | 8 |
|
---|
[afcfd74] | 9 | <sect1 id="ch-config-usage" revision="sysv">
|
---|
[d781ffb] | 10 | <?dbhtml filename="usage.html"?>
|
---|
| 11 |
|
---|
[bf58c1e] | 12 | <title>System V Bootscript Usage and Configuration</title>
|
---|
[d781ffb] | 13 |
|
---|
[afcfd74] | 14 | <indexterm zone="ch-config-usage">
|
---|
[d781ffb] | 15 | <primary sortas="a-Bootscripts">Bootscripts</primary>
|
---|
| 16 | <secondary>usage</secondary>
|
---|
| 17 | </indexterm>
|
---|
| 18 |
|
---|
[bf58c1e] | 19 | <sect2>
|
---|
| 20 | <title>How Do the System V Bootscripts Work?</title>
|
---|
| 21 |
|
---|
| 22 | <para>Linux uses a special booting facility named SysVinit that is based on a
|
---|
| 23 | concept of <emphasis>run-levels</emphasis>. It can be quite different from one
|
---|
| 24 | system to another, so it cannot be assumed that because things worked in one
|
---|
| 25 | particular Linux distribution, they should work the same in LFS too. LFS has its
|
---|
| 26 | own way of doing things, but it respects generally accepted standards.</para>
|
---|
| 27 |
|
---|
| 28 | <para>SysVinit (which will be referred to as <quote>init</quote> from now on)
|
---|
| 29 | works using a run-levels scheme. There are seven (numbered 0 to 6) run-levels
|
---|
| 30 | (actually, there are more run-levels, but they are for special cases and are
|
---|
| 31 | generally not used. See <filename>init(8)</filename> for more details), and
|
---|
| 32 | each one of those corresponds to the actions the computer is supposed to
|
---|
| 33 | perform when it starts up. The default run-level is 3. Here are the
|
---|
| 34 | descriptions of the different run-levels as they are implemented:</para>
|
---|
[81fd230] | 35 |
|
---|
| 36 | <literallayout>0: halt the computer
|
---|
| 37 | 1: single-user mode
|
---|
| 38 | 2: multi-user mode without networking
|
---|
| 39 | 3: multi-user mode with networking
|
---|
| 40 | 4: reserved for customization, otherwise does the same as 3
|
---|
| 41 | 5: same as 4, it is usually used for GUI login (like X's <command>xdm</command> or KDE's <command>kdm</command>)
|
---|
| 42 | 6: reboot the computer</literallayout>
|
---|
| 43 |
|
---|
[bf58c1e] | 44 | </sect2>
|
---|
| 45 |
|
---|
[0cda898] | 46 | <sect2 id="conf-sysvinit" role="configuration">
|
---|
| 47 | <title>Configuring Sysvinit</title>
|
---|
| 48 |
|
---|
| 49 | <indexterm zone="conf-sysvinit">
|
---|
| 50 | <primary sortas="a-Sysvinit">Sysvinit</primary>
|
---|
| 51 | <secondary>configuring</secondary>
|
---|
| 52 | </indexterm>
|
---|
| 53 |
|
---|
| 54 | <indexterm zone="conf-sysvinit">
|
---|
| 55 | <primary sortas="e-/etc/inittab">/etc/inittab</primary>
|
---|
| 56 | </indexterm>
|
---|
| 57 |
|
---|
| 58 | <para>During the kernel initialization, the first program that is run
|
---|
[2ca8941] | 59 | is either specified on the command line or, by default
|
---|
[0cda898] | 60 | <command>init</command>. This program reads the initialization file
|
---|
| 61 | <filename>/etc/inittab</filename>. Create this file with:</para>
|
---|
| 62 |
|
---|
| 63 | <screen><userinput>cat > /etc/inittab << "EOF"
|
---|
| 64 | <literal># Begin /etc/inittab
|
---|
| 65 |
|
---|
| 66 | id:3:initdefault:
|
---|
| 67 |
|
---|
[f874424] | 68 | si::sysinit:/etc/rc.d/init.d/rc S
|
---|
[0cda898] | 69 |
|
---|
| 70 | l0:0:wait:/etc/rc.d/init.d/rc 0
|
---|
| 71 | l1:S1:wait:/etc/rc.d/init.d/rc 1
|
---|
| 72 | l2:2:wait:/etc/rc.d/init.d/rc 2
|
---|
| 73 | l3:3:wait:/etc/rc.d/init.d/rc 3
|
---|
| 74 | l4:4:wait:/etc/rc.d/init.d/rc 4
|
---|
| 75 | l5:5:wait:/etc/rc.d/init.d/rc 5
|
---|
| 76 | l6:6:wait:/etc/rc.d/init.d/rc 6
|
---|
| 77 |
|
---|
| 78 | ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
|
---|
| 79 |
|
---|
| 80 | su:S016:once:/sbin/sulogin
|
---|
| 81 |
|
---|
[776f1dc] | 82 | 1:2345:respawn:/sbin/agetty --noclear tty1 9600
|
---|
[0cda898] | 83 | 2:2345:respawn:/sbin/agetty tty2 9600
|
---|
| 84 | 3:2345:respawn:/sbin/agetty tty3 9600
|
---|
| 85 | 4:2345:respawn:/sbin/agetty tty4 9600
|
---|
| 86 | 5:2345:respawn:/sbin/agetty tty5 9600
|
---|
| 87 | 6:2345:respawn:/sbin/agetty tty6 9600
|
---|
| 88 |
|
---|
| 89 | # End /etc/inittab</literal>
|
---|
| 90 | EOF</userinput></screen>
|
---|
| 91 |
|
---|
| 92 | <para>An explanation of this initialization file is in the man page for
|
---|
| 93 | <emphasis>inittab</emphasis>. For LFS, the key command that is run is
|
---|
[acc3ca3] | 94 | <command>rc</command>. The initialization file above will instruct
|
---|
[0cda898] | 95 | <command>rc</command> to run all the scripts starting with an S in the
|
---|
[a03cebd] | 96 | <filename class="directory">/etc/rc.d/rcS.d</filename> directory
|
---|
[0cda898] | 97 | followed by all the scripts starting with an S in the <filename
|
---|
| 98 | class="directory">/etc/rc.d/rc?.d</filename> directory where the question
|
---|
| 99 | mark is specified by the initdefault value.</para>
|
---|
| 100 |
|
---|
| 101 | <para>As a convenience, the <command>rc</command> script reads a library of
|
---|
[f874424] | 102 | functions in <filename class="directory">/lib/lsb/init-functions</filename>.
|
---|
[0cda898] | 103 | This library also reads an optional configuration file,
|
---|
[916c906] | 104 | <filename>/etc/sysconfig/rc.site</filename>. Any of the system
|
---|
[0cda898] | 105 | configuration file parameters described in subsequent sections can be
|
---|
| 106 | alternatively placed in this file allowing consolidation of all system
|
---|
[b777a9e] | 107 | parameters in this one file.</para>
|
---|
[0cda898] | 108 |
|
---|
| 109 | <para>As a debugging convenience, the functions script also logs all output
|
---|
| 110 | to <filename>/run/var/bootlog</filename>. Since the <filename
|
---|
| 111 | class="directory">/run</filename> directory is a tmpfs, this file is not
|
---|
[72f3ca7] | 112 | persistent across boots, however it is appended to the more permanent file
|
---|
| 113 | <filename>/var/log/boot.log</filename> at the end of the boot process.</para>
|
---|
[0cda898] | 114 |
|
---|
[bf58c1e] | 115 | <sect3 id="init-levels" >
|
---|
[0cda898] | 116 | <title>Changing Run Levels</title>
|
---|
| 117 |
|
---|
| 118 | <para>Changing run-levels is done with <command>init
|
---|
[0090db5] | 119 | <replaceable><runlevel></replaceable></command>, where
|
---|
| 120 | <replaceable><runlevel></replaceable> is the target run-level. For example, to
|
---|
[d781ffb] | 121 | reboot the computer, a user could issue the <command>init 6</command> command,
|
---|
| 122 | which is an alias for the <command>reboot</command> command. Likewise,
|
---|
| 123 | <command>init 0</command> is an alias for the <command>halt</command>
|
---|
| 124 | command.</para>
|
---|
| 125 |
|
---|
| 126 | <para>There are a number of directories under <filename
|
---|
| 127 | class="directory">/etc/rc.d</filename> that look like <filename
|
---|
| 128 | class="directory">rc?.d</filename> (where ? is the number of the run-level) and
|
---|
| 129 | <filename class="directory">rcsysinit.d</filename>, all containing a number of
|
---|
| 130 | symbolic links. Some begin with a <emphasis>K</emphasis>, the others begin with
|
---|
| 131 | an <emphasis>S</emphasis>, and all of them have two numbers following the
|
---|
| 132 | initial letter. The K means to stop (kill) a service and the S means to start a
|
---|
| 133 | service. The numbers determine the order in which the scripts are run, from 00
|
---|
| 134 | to 99—the lower the number the earlier it gets executed. When
|
---|
| 135 | <command>init</command> switches to another run-level, the appropriate services
|
---|
| 136 | are either started or stopped, depending on the runlevel chosen.</para>
|
---|
| 137 |
|
---|
| 138 | <para>The real scripts are in <filename
|
---|
| 139 | class="directory">/etc/rc.d/init.d</filename>. They do the actual work, and
|
---|
[0cda898] | 140 | the symlinks all point to them. K links and S links point to
|
---|
[d781ffb] | 141 | the same script in <filename class="directory">/etc/rc.d/init.d</filename>.
|
---|
| 142 | This is because the scripts can be called with different parameters like
|
---|
| 143 | <parameter>start</parameter>, <parameter>stop</parameter>,
|
---|
| 144 | <parameter>restart</parameter>, <parameter>reload</parameter>, and
|
---|
| 145 | <parameter>status</parameter>. When a K link is encountered, the appropriate
|
---|
| 146 | script is run with the <parameter>stop</parameter> argument. When an S link
|
---|
| 147 | is encountered, the appropriate script is run with the
|
---|
| 148 | <parameter>start</parameter> argument.</para>
|
---|
| 149 |
|
---|
| 150 | <para>There is one exception to this explanation. Links that start
|
---|
| 151 | with an <emphasis>S</emphasis> in the <filename
|
---|
| 152 | class="directory">rc0.d</filename> and <filename
|
---|
| 153 | class="directory">rc6.d</filename> directories will not cause anything
|
---|
| 154 | to be started. They will be called with the parameter
|
---|
| 155 | <parameter>stop</parameter> to stop something. The logic behind this
|
---|
| 156 | is that when a user is going to reboot or halt the system, nothing
|
---|
| 157 | needs to be started. The system only needs to be stopped.</para>
|
---|
| 158 |
|
---|
| 159 | <para>These are descriptions of what the arguments make the scripts
|
---|
| 160 | do:</para>
|
---|
| 161 |
|
---|
| 162 | <variablelist>
|
---|
| 163 |
|
---|
| 164 | <varlistentry>
|
---|
| 165 | <term><parameter>start</parameter></term>
|
---|
| 166 | <listitem>
|
---|
| 167 | <para>The service is started.</para>
|
---|
| 168 | </listitem>
|
---|
| 169 | </varlistentry>
|
---|
| 170 |
|
---|
| 171 | <varlistentry>
|
---|
| 172 | <term><parameter>stop</parameter></term>
|
---|
| 173 | <listitem>
|
---|
| 174 | <para>The service is stopped.</para>
|
---|
| 175 | </listitem>
|
---|
| 176 | </varlistentry>
|
---|
| 177 |
|
---|
| 178 | <varlistentry>
|
---|
| 179 | <term><parameter>restart</parameter></term>
|
---|
| 180 | <listitem>
|
---|
| 181 | <para>The service is stopped and then started again.</para>
|
---|
| 182 | </listitem>
|
---|
| 183 | </varlistentry>
|
---|
| 184 |
|
---|
| 185 | <varlistentry>
|
---|
| 186 | <term><parameter>reload</parameter></term>
|
---|
| 187 | <listitem>
|
---|
| 188 | <para>The configuration of the service is updated.
|
---|
| 189 | This is used after the configuration file of a service was modified, when
|
---|
| 190 | the service does not need to be restarted.</para>
|
---|
| 191 | </listitem>
|
---|
| 192 | </varlistentry>
|
---|
| 193 |
|
---|
| 194 | <varlistentry>
|
---|
| 195 | <term><parameter>status</parameter></term>
|
---|
| 196 | <listitem>
|
---|
| 197 | <para>Tells if the service is running and with which PIDs.</para>
|
---|
| 198 | </listitem>
|
---|
| 199 | </varlistentry>
|
---|
| 200 |
|
---|
| 201 | </variablelist>
|
---|
| 202 |
|
---|
| 203 | <para>Feel free to modify the way the boot process works (after all,
|
---|
| 204 | it is your own LFS system). The files given here are an example of how
|
---|
| 205 | it can be done.</para>
|
---|
[0ad6d9a] | 206 |
|
---|
[bf58c1e] | 207 | </sect3>
|
---|
| 208 | </sect2>
|
---|
| 209 |
|
---|
[976040f] | 210 | <sect2>
|
---|
| 211 | <title>Udev Bootscripts</title>
|
---|
| 212 |
|
---|
| 213 | <para>The <filename>/etc/rc.d/init.d/udev</filename> initscript starts
|
---|
| 214 | <command>udevd</command>, triggers any "coldplug" devices that have
|
---|
| 215 | already been created by the kernel and waits for any rules to complete.
|
---|
| 216 | The script also unsets the uevent handler from the default of
|
---|
| 217 | <filename>/sbin/hotplug </filename>. This is done because the kernel no
|
---|
| 218 | longer needs to call out to an external binary. Instead
|
---|
| 219 | <command>udevd</command> will listen on a netlink socket for uevents that
|
---|
| 220 | the kernel raises.</para>
|
---|
| 221 |
|
---|
| 222 | <para>The <command>/etc/rc.d/init.d/udev_retry</command> initscript takes
|
---|
| 223 | care of re-triggering events for subsystems whose rules may rely on
|
---|
| 224 | filesystems that are not mounted until the <command>mountfs</command>
|
---|
| 225 | script is run (in particular, <filename class="directory">/usr</filename>
|
---|
| 226 | and <filename class="directory">/var</filename> may cause this). This
|
---|
| 227 | script runs after the <command>mountfs</command> script, so those rules
|
---|
| 228 | (if re-triggered) should succeed the second time around. It is
|
---|
| 229 | configured from the <filename>/etc/sysconfig/udev_retry</filename> file;
|
---|
| 230 | any words in this file other than comments are considered subsystem names
|
---|
| 231 | to trigger at retry time. To find the subsystem of a device, use
|
---|
| 232 | <command>udevadm info --attribute-walk <device></command> where
|
---|
| 233 | <device> is an absolute path in /dev or /sys such as /dev/sr0 or
|
---|
| 234 | /sys/class/rtc.</para>
|
---|
| 235 |
|
---|
[36d2dcc] | 236 | <para>For information on kernel module loading and udev, see
|
---|
| 237 | <xref linkend="module-loading"/>.</para>
|
---|
[976040f] | 238 | </sect2>
|
---|
| 239 |
|
---|
[afcfd74] | 240 | <sect2 id="ch-config-clock">
|
---|
[bf58c1e] | 241 | <title>Configuring the System Clock</title>
|
---|
| 242 |
|
---|
[afcfd74] | 243 | <indexterm zone="ch-config-clock">
|
---|
| 244 | <primary sortas="d-setclock">setclock</primary>
|
---|
[bf58c1e] | 245 | <secondary>configuring</secondary></indexterm>
|
---|
| 246 |
|
---|
| 247 | <para>The <command>setclock</command> script reads the time from the hardware
|
---|
| 248 | clock, also known as the BIOS or the Complementary Metal Oxide Semiconductor
|
---|
| 249 | (CMOS) clock. If the hardware clock is set to UTC, this script will convert the
|
---|
| 250 | hardware clock's time to the local time using the
|
---|
| 251 | <filename>/etc/localtime</filename> file (which tells the
|
---|
[a3d0817] | 252 | <command>hwclock</command> program which timezone to use). There is no
|
---|
[bf58c1e] | 253 | way to detect whether or not the hardware clock is set to UTC, so this
|
---|
| 254 | needs to be configured manually.</para>
|
---|
| 255 |
|
---|
[a3d0817] | 256 | <para>The <command>setclock</command> program is run via
|
---|
[bf58c1e] | 257 | <application>udev</application> when the kernel detects the hardware
|
---|
| 258 | capability upon boot. It can also be run manually with the stop parameter to
|
---|
| 259 | store the system time to the CMOS clock.</para>
|
---|
| 260 |
|
---|
| 261 | <para>If you cannot remember whether or not the hardware clock is set to UTC,
|
---|
| 262 | find out by running the <userinput>hwclock --localtime --show</userinput>
|
---|
| 263 | command. This will display what the current time is according to the hardware
|
---|
| 264 | clock. If this time matches whatever your watch says, then the hardware clock is
|
---|
| 265 | set to local time. If the output from <command>hwclock</command> is not local
|
---|
| 266 | time, chances are it is set to UTC time. Verify this by adding or subtracting
|
---|
| 267 | the proper amount of hours for the timezone to the time shown by
|
---|
| 268 | <command>hwclock</command>. For example, if you are currently in the MST
|
---|
| 269 | timezone, which is also known as GMT -0700, add seven hours to the local
|
---|
| 270 | time.</para>
|
---|
| 271 |
|
---|
| 272 | <para>Change the value of the <envar>UTC</envar> variable below
|
---|
| 273 | to a value of <parameter>0</parameter> (zero) if the hardware clock
|
---|
[a3d0817] | 274 | is <emphasis>NOT</emphasis> set to UTC time.</para>
|
---|
[bf58c1e] | 275 |
|
---|
| 276 | <para>Create a new file <filename>/etc/sysconfig/clock</filename> by running
|
---|
| 277 | the following:</para>
|
---|
| 278 |
|
---|
| 279 | <screen><userinput>cat > /etc/sysconfig/clock << "EOF"
|
---|
| 280 | <literal># Begin /etc/sysconfig/clock
|
---|
| 281 |
|
---|
| 282 | UTC=1
|
---|
| 283 |
|
---|
| 284 | # Set this to any options you might need to give to hwclock,
|
---|
| 285 | # such as machine hardware clock type for Alphas.
|
---|
| 286 | CLOCKPARAMS=
|
---|
| 287 |
|
---|
| 288 | # End /etc/sysconfig/clock</literal>
|
---|
| 289 | EOF</userinput></screen>
|
---|
| 290 |
|
---|
| 291 | <para>A good hint explaining how to deal with time on LFS is available
|
---|
| 292 | at <ulink url="&hints-root;time.txt"/>. It explains issues such as
|
---|
| 293 | time zones, UTC, and the <envar>TZ</envar> environment variable.</para>
|
---|
| 294 |
|
---|
[a3d0817] | 295 | <note><para>The CLOCKPARAMS and UTC paramaters may also be set
|
---|
[bf58c1e] | 296 | in the <filename>/etc/sysconfig/rc.site</filename> file.</para></note>
|
---|
| 297 |
|
---|
[0cda898] | 298 | </sect2>
|
---|
| 299 |
|
---|
[afcfd74] | 300 | <sect2 id="ch-config-console">
|
---|
[bf58c1e] | 301 | <?dbhtml filename="console.html"?>
|
---|
| 302 |
|
---|
| 303 | <title>Configuring the Linux Console</title>
|
---|
| 304 |
|
---|
[afcfd74] | 305 | <indexterm zone="ch-config-console">
|
---|
[bf58c1e] | 306 | <primary sortas="d-console">console</primary>
|
---|
| 307 | <secondary>configuring</secondary>
|
---|
| 308 | </indexterm>
|
---|
| 309 |
|
---|
| 310 | <para>This section discusses how to configure the <command>console</command>
|
---|
[a3d0817] | 311 | bootscript that sets up the keyboard map, console font, and console kernel log
|
---|
[bf58c1e] | 312 | level. If non-ASCII characters (e.g., the copyright sign, the British pound
|
---|
| 313 | sign and Euro symbol) will not be used and the keyboard is a U.S. one, much
|
---|
| 314 | of this section can be skipped. Without the configuration file, (or
|
---|
| 315 | equivalent settings in <filename>rc.site</filename>), the
|
---|
| 316 | <command>console</command> bootscript will do nothing.</para>
|
---|
| 317 |
|
---|
| 318 | <para>The <command>console</command> script reads the
|
---|
| 319 | <filename>/etc/sysconfig/console</filename> file for configuration
|
---|
| 320 | information. Decide which keymap and screen font will be used. Various
|
---|
| 321 | language-specific HOWTOs can also help with this, see <ulink
|
---|
| 322 | url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>. If still in
|
---|
| 323 | doubt, look in the <filename class="directory">/usr/share/keymaps</filename>
|
---|
| 324 | and <filename class="directory">/usr/share/consolefonts</filename> directories
|
---|
| 325 | for valid keymaps and screen fonts. Read <filename>loadkeys(1)</filename> and
|
---|
| 326 | <filename>setfont(8)</filename> manual pages to determine the correct
|
---|
| 327 | arguments for these programs.</para>
|
---|
| 328 |
|
---|
| 329 | <para>The <filename>/etc/sysconfig/console</filename> file should contain lines
|
---|
| 330 | of the form: VARIABLE="value". The following variables are recognized:</para>
|
---|
| 331 | <variablelist>
|
---|
| 332 |
|
---|
| 333 | <varlistentry>
|
---|
| 334 | <term>LOGLEVEL</term>
|
---|
| 335 | <listitem>
|
---|
| 336 | <para>This variable specifies the log level for kernel messages sent
|
---|
[77d2a882] | 337 | to the console as set by <command>dmesg -n</command>. Valid levels are
|
---|
[bf58c1e] | 338 | from "1" (no messages) to "8". The default level is "7".</para>
|
---|
| 339 | </listitem>
|
---|
| 340 | </varlistentry>
|
---|
| 341 |
|
---|
| 342 | <varlistentry>
|
---|
| 343 | <term>KEYMAP</term>
|
---|
| 344 | <listitem>
|
---|
| 345 | <para>This variable specifies the arguments for the
|
---|
| 346 | <command>loadkeys</command> program, typically, the name of keymap
|
---|
[3d2cea9] | 347 | to load, e.g., <quote>it</quote>. If this variable is not set, the
|
---|
[bf58c1e] | 348 | bootscript will not run the <command>loadkeys</command> program,
|
---|
[2cf50d29] | 349 | and the default kernel keymap will be used. Note that a few keymaps
|
---|
| 350 | have multiple versions with the same name (cz and its variants in
|
---|
| 351 | qwerty/ and qwertz/, es in olpc/ and qwerty/, and trf in fgGIod/ and
|
---|
| 352 | qwerty/). In these cases the parent directory should also be specified
|
---|
| 353 | (e.g. qwerty/es) to ensure the proper keymap is loaded.
|
---|
[3d2cea9] | 354 | </para>
|
---|
[bf58c1e] | 355 | </listitem>
|
---|
| 356 | </varlistentry>
|
---|
| 357 |
|
---|
| 358 | <varlistentry>
|
---|
| 359 | <term>KEYMAP_CORRECTIONS</term>
|
---|
| 360 | <listitem>
|
---|
| 361 | <para>This (rarely used) variable
|
---|
| 362 | specifies the arguments for the second call to the
|
---|
| 363 | <command>loadkeys</command> program. This is useful if the stock keymap
|
---|
| 364 | is not completely satisfactory and a small adjustment has to be made. E.g.,
|
---|
| 365 | to include the Euro sign into a keymap that normally doesn't have it,
|
---|
| 366 | set this variable to <quote>euro2</quote>.</para>
|
---|
| 367 | </listitem>
|
---|
| 368 | </varlistentry>
|
---|
| 369 |
|
---|
| 370 | <varlistentry>
|
---|
| 371 | <term>FONT</term>
|
---|
| 372 | <listitem>
|
---|
| 373 | <para>This variable specifies the arguments for the
|
---|
| 374 | <command>setfont</command> program. Typically, this includes the font
|
---|
| 375 | name, <quote>-m</quote>, and the name of the application character
|
---|
| 376 | map to load. E.g., in order to load the <quote>lat1-16</quote> font
|
---|
| 377 | together with the <quote>8859-1</quote> application character map
|
---|
| 378 | (as it is appropriate in the USA),
|
---|
| 379 | <!-- because of the copyright sign -->
|
---|
| 380 | set this variable to <quote>lat1-16 -m 8859-1</quote>.
|
---|
| 381 | In UTF-8 mode, the kernel uses the application character map for
|
---|
| 382 | conversion of composed 8-bit key codes in the keymap to UTF-8, and thus
|
---|
| 383 | the argument of the "-m" parameter should be set to the encoding of the
|
---|
| 384 | composed key codes in the keymap.</para>
|
---|
| 385 |
|
---|
| 386 | </listitem>
|
---|
| 387 | </varlistentry>
|
---|
| 388 |
|
---|
| 389 | <varlistentry>
|
---|
| 390 | <term>UNICODE</term>
|
---|
| 391 | <listitem>
|
---|
| 392 | <para>Set this variable to <quote>1</quote>, <quote>yes</quote> or
|
---|
| 393 | <quote>true</quote> in order to put the
|
---|
| 394 | console into UTF-8 mode. This is useful in UTF-8 based locales and
|
---|
| 395 | harmful otherwise.</para>
|
---|
| 396 | </listitem>
|
---|
| 397 | </varlistentry>
|
---|
| 398 |
|
---|
| 399 | <varlistentry>
|
---|
| 400 | <term>LEGACY_CHARSET</term>
|
---|
| 401 | <listitem>
|
---|
| 402 | <para>For many keyboard layouts, there is no stock Unicode keymap in
|
---|
| 403 | the Kbd package. The <command>console</command> bootscript will
|
---|
| 404 | convert an available keymap to UTF-8 on the fly if this variable is
|
---|
| 405 | set to the encoding of the available non-UTF-8 keymap.</para>
|
---|
| 406 | </listitem>
|
---|
| 407 | </varlistentry>
|
---|
| 408 |
|
---|
| 409 | </variablelist>
|
---|
| 410 |
|
---|
| 411 | <para>Some examples:</para>
|
---|
| 412 |
|
---|
| 413 | <itemizedlist>
|
---|
| 414 |
|
---|
| 415 | <listitem>
|
---|
| 416 | <para>For a non-Unicode setup, only the KEYMAP and FONT variables are
|
---|
| 417 | generally needed. E.g., for a Polish setup, one would use:</para>
|
---|
| 418 | <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF"
|
---|
| 419 | <literal># Begin /etc/sysconfig/console
|
---|
| 420 |
|
---|
| 421 | KEYMAP="pl2"
|
---|
| 422 | FONT="lat2a-16 -m 8859-2"
|
---|
| 423 |
|
---|
| 424 | # End /etc/sysconfig/console</literal>
|
---|
| 425 | EOF</userinput></screen>
|
---|
| 426 | </listitem>
|
---|
| 427 |
|
---|
| 428 | <listitem>
|
---|
| 429 | <para>As mentioned above, it is sometimes necessary to adjust a
|
---|
| 430 | stock keymap slightly. The following example adds the Euro symbol to the
|
---|
| 431 | German keymap:</para>
|
---|
| 432 |
|
---|
| 433 | <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF"
|
---|
| 434 | <literal># Begin /etc/sysconfig/console
|
---|
| 435 |
|
---|
| 436 | KEYMAP="de-latin1"
|
---|
| 437 | KEYMAP_CORRECTIONS="euro2"
|
---|
| 438 | FONT="lat0-16 -m 8859-15"
|
---|
[054a1c8] | 439 | UNICODE="1"
|
---|
[bf58c1e] | 440 |
|
---|
| 441 | # End /etc/sysconfig/console</literal>
|
---|
| 442 | EOF</userinput></screen>
|
---|
| 443 | </listitem>
|
---|
| 444 |
|
---|
| 445 | <listitem>
|
---|
| 446 | <para>The following is a Unicode-enabled example for Bulgarian, where a
|
---|
| 447 | stock UTF-8 keymap exists:</para>
|
---|
[8154126] | 448 | <!-- This is what is used by jhalfs for creating the console file: whenever
|
---|
| 449 | you change the following, please inform the jhalfs maintainer(s). -->
|
---|
| 450 | <screen><userinput>cat > /etc/sysconfig/console << "EOF"
|
---|
[bf58c1e] | 451 | <literal># Begin /etc/sysconfig/console
|
---|
| 452 |
|
---|
| 453 | UNICODE="1"
|
---|
| 454 | KEYMAP="bg_bds-utf8"
|
---|
| 455 | FONT="LatArCyrHeb-16"
|
---|
| 456 |
|
---|
| 457 | # End /etc/sysconfig/console</literal>
|
---|
| 458 | EOF</userinput></screen>
|
---|
| 459 | </listitem>
|
---|
| 460 |
|
---|
| 461 | <listitem>
|
---|
| 462 | <para>Due to the use of a 512-glyph LatArCyrHeb-16 font in the previous
|
---|
| 463 | example, bright colors are no longer available on the Linux console unless
|
---|
[a3d0817] | 464 | a framebuffer is used. If one wants to have bright colors without a
|
---|
[bf58c1e] | 465 | framebuffer and can live without characters not belonging to his language,
|
---|
| 466 | it is still possible to use a language-specific 256-glyph font, as
|
---|
| 467 | illustrated below:</para>
|
---|
| 468 |
|
---|
| 469 | <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF"
|
---|
| 470 | <literal># Begin /etc/sysconfig/console
|
---|
| 471 |
|
---|
| 472 | UNICODE="1"
|
---|
| 473 | KEYMAP="bg_bds-utf8"
|
---|
| 474 | FONT="cyr-sun16"
|
---|
| 475 |
|
---|
| 476 | # End /etc/sysconfig/console</literal>
|
---|
| 477 | EOF</userinput></screen>
|
---|
| 478 | </listitem>
|
---|
| 479 |
|
---|
| 480 | <listitem>
|
---|
| 481 | <para>The following example illustrates keymap autoconversion from
|
---|
| 482 | ISO-8859-15 to UTF-8 and enabling dead keys in Unicode mode:</para>
|
---|
| 483 |
|
---|
| 484 | <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF"
|
---|
| 485 | <literal># Begin /etc/sysconfig/console
|
---|
| 486 |
|
---|
| 487 | UNICODE="1"
|
---|
| 488 | KEYMAP="de-latin1"
|
---|
| 489 | KEYMAP_CORRECTIONS="euro2"
|
---|
| 490 | LEGACY_CHARSET="iso-8859-15"
|
---|
| 491 | FONT="LatArCyrHeb-16 -m 8859-15"
|
---|
| 492 |
|
---|
| 493 | # End /etc/sysconfig/console</literal>
|
---|
| 494 | EOF</userinput></screen>
|
---|
| 495 | </listitem>
|
---|
| 496 |
|
---|
| 497 | <listitem>
|
---|
| 498 | <para>Some keymaps have dead keys (i.e., keys that don't produce a
|
---|
| 499 | character by themselves, but put an accent on the character produced
|
---|
| 500 | by the next key) or define composition rules (such as: <quote>press
|
---|
| 501 | Ctrl+. A E to get Æ</quote> in the default keymap).
|
---|
| 502 | Linux-&linux-version; interprets dead keys and composition rules in the
|
---|
| 503 | keymap correctly only when the source characters to be composed together
|
---|
| 504 | are not multibyte. This deficiency doesn't affect keymaps for European
|
---|
| 505 | languages, because there accents are added to unaccented ASCII
|
---|
| 506 | characters, or two ASCII characters are composed together. However, in
|
---|
[a3d0817] | 507 | UTF-8 mode it is a problem; e.g., for the Greek language, where one
|
---|
[bf58c1e] | 508 | sometimes needs to put an accent on the letter <quote>alpha</quote>.
|
---|
| 509 | The solution is either to avoid the use of UTF-8, or to install the
|
---|
| 510 | X window system that doesn't have this limitation in its input
|
---|
| 511 | handling.</para>
|
---|
| 512 | </listitem>
|
---|
| 513 |
|
---|
| 514 | <listitem>
|
---|
[a3d0817] | 515 | <para>For Chinese, Japanese, Korean, and some other languages, the Linux
|
---|
[bf58c1e] | 516 | console cannot be configured to display the needed characters. Users
|
---|
| 517 | who need such languages should install the X Window System, fonts that
|
---|
| 518 | cover the necessary character ranges, and the proper input method (e.g.,
|
---|
[a3d0817] | 519 | SCIM, supports a wide variety of languages).</para>
|
---|
[bf58c1e] | 520 | </listitem>
|
---|
| 521 |
|
---|
| 522 | </itemizedlist>
|
---|
| 523 |
|
---|
| 524 | <!-- Added because folks keep posting their console file with X questions
|
---|
| 525 | to blfs-support list -->
|
---|
| 526 | <note>
|
---|
| 527 | <para>The <filename>/etc/sysconfig/console</filename> file only controls
|
---|
| 528 | the Linux text console localization. It has nothing to do with setting
|
---|
| 529 | the proper keyboard layout and terminal fonts in the X Window System, with
|
---|
[a3d0817] | 530 | ssh sessions, or with a serial console. In such situations, limitations
|
---|
[bf58c1e] | 531 | mentioned in the last two list items above do not apply.</para>
|
---|
| 532 | </note>
|
---|
| 533 |
|
---|
| 534 | </sect2>
|
---|
| 535 |
|
---|
[afcfd74] | 536 | <sect2 id="ch-config-createfiles">
|
---|
[bf58c1e] | 537 | <title>Creating Files at Boot</title>
|
---|
| 538 |
|
---|
[afcfd74] | 539 | <indexterm zone="ch-config-createfiles">
|
---|
[bf58c1e] | 540 | <primary sortas="d-createfiles">File creation at boot</primary>
|
---|
| 541 | <secondary>configuring</secondary>
|
---|
| 542 | </indexterm>
|
---|
| 543 |
|
---|
[a3d0817] | 544 | <para>At times, it is desirable to create files at boot time. For instance,
|
---|
[bf58c1e] | 545 | the <filename class="directory">/tmp/.ICE-unix</filename> directory
|
---|
[a3d0817] | 546 | is often needed. This can be done by creating an entry in the
|
---|
[bf58c1e] | 547 | <filename>/etc/sysconfig/createfiles</filename> configuration script.
|
---|
| 548 | The format of this file is embedded in the comments of the default
|
---|
| 549 | configuration file.</para>
|
---|
| 550 | </sect2>
|
---|
| 551 |
|
---|
[afcfd74] | 552 | <sect2 id="ch-config-sysklogd">
|
---|
[bf58c1e] | 553 | <title>Configuring the sysklogd Script</title>
|
---|
| 554 |
|
---|
[afcfd74] | 555 | <indexterm zone="ch-config-sysklogd">
|
---|
[bf58c1e] | 556 | <primary sortas="d-sysklogd">sysklogd</primary>
|
---|
| 557 | <secondary>configuring</secondary>
|
---|
| 558 | </indexterm>
|
---|
| 559 |
|
---|
| 560 | <para>The <filename>sysklogd</filename> script invokes the
|
---|
| 561 | <command>syslogd</command> program as a part of System V initialization. The
|
---|
| 562 | <parameter>-m 0</parameter> option turns off the periodic timestamp mark that
|
---|
| 563 | <command>syslogd</command> writes to the log files every 20 minutes by
|
---|
| 564 | default. If you want to turn on this periodic timestamp mark, edit
|
---|
| 565 | <filename>/etc/sysconfig/rc.site</filename> and define the variable
|
---|
| 566 | SYSKLOGD_PARMS to the desired value. For instance, to remove all parameters,
|
---|
| 567 | set the variable to a null value:</para>
|
---|
| 568 |
|
---|
| 569 | <screen role="nodump">SYSKLOGD_PARMS=</screen>
|
---|
| 570 |
|
---|
| 571 | <para>See <userinput>man syslogd</userinput> for more options.</para>
|
---|
| 572 |
|
---|
| 573 | </sect2>
|
---|
| 574 |
|
---|
[afcfd74] | 575 | <sect2 id="ch-config-site">
|
---|
[bf58c1e] | 576 | <title>The rc.site File</title>
|
---|
| 577 |
|
---|
[afcfd74] | 578 | <indexterm zone="ch-config-site">
|
---|
[bf58c1e] | 579 | <primary sortas="a-rc.site">rc.site</primary>
|
---|
| 580 | </indexterm>
|
---|
| 581 |
|
---|
| 582 | <para>The optional <filename>/etc/sysconfig/rc.site</filename> file contains
|
---|
| 583 | settings that are automatically set for each SystemV boot script. It can
|
---|
| 584 | alternatively set the values specified in the <filename>hostname</filename>,
|
---|
| 585 | <filename>console</filename>, and <filename>clock</filename> files in the
|
---|
| 586 | <filename class='directory'>/etc/sysconfig/</filename> directory. If the
|
---|
| 587 | associated variables are present in both these separate files and
|
---|
| 588 | <filename>rc.site</filename>, the values in the script specific files have
|
---|
| 589 | precedence. </para>
|
---|
| 590 |
|
---|
| 591 | <para><filename>rc.site</filename> also contains parameters that can
|
---|
| 592 | customize other aspects of the boot process. Setting the IPROMPT variable
|
---|
| 593 | will enable selective running of bootscripts. Other options are described
|
---|
| 594 | in the file comments. The default version of the file is as follows:</para>
|
---|
| 595 |
|
---|
| 596 | <!-- Use role to fix a pdf generation problem -->
|
---|
| 597 | <screen role="auto">&site;</screen>
|
---|
| 598 |
|
---|
| 599 | <sect3>
|
---|
| 600 | <title>Customizing the Boot and Shutdown Scripts</title>
|
---|
| 601 |
|
---|
| 602 | <para>The LFS boot scripts boot and shut down a system in a fairly
|
---|
| 603 | efficient manner, but there are a few tweaks that you can make in the
|
---|
| 604 | rc.site file to improve speed even more and to adjust messages according
|
---|
| 605 | to your preferences. To do this, adjust the settings in
|
---|
| 606 | the <filename>/etc/sysconfig/rc.site</filename> file above.</para>
|
---|
| 607 |
|
---|
| 608 | <itemizedlist>
|
---|
| 609 |
|
---|
| 610 | <listitem><para>During the boot script <filename>udev</filename>, there is
|
---|
| 611 | a call to <command>udev settle</command> that requires some time to
|
---|
| 612 | complete. This time may or may not be required depending on devices present
|
---|
| 613 | in the system. If you only have simple partitions and a single ethernet
|
---|
| 614 | card, the boot process will probably not need to wait for this command. To
|
---|
| 615 | skip it, set the variable OMIT_UDEV_SETTLE=y.</para></listitem>
|
---|
| 616 |
|
---|
| 617 | <listitem><para>The boot script <filename>udev_retry</filename> also runs
|
---|
| 618 | <command>udev settle</command> by default. This command is only needed by
|
---|
| 619 | default if the <filename class='directory'>/var</filename> directory is
|
---|
| 620 | separately mounted. This is because the clock needs the file
|
---|
| 621 | <filename>/var/lib/hwclock/adjtime</filename>. Other customizations may
|
---|
| 622 | also need to wait for udev to complete, but in many installations it is not
|
---|
| 623 | needed. Skip the command by setting the variable OMIT_UDEV_RETRY_SETTLE=y.
|
---|
| 624 | </para></listitem>
|
---|
| 625 |
|
---|
| 626 | <listitem><para>By default, the file system checks are silent. This can
|
---|
| 627 | appear to be a delay during the bootup process. To turn on the
|
---|
| 628 | <command>fsck</command> output, set the variable VERBOSE_FSCK=y.
|
---|
| 629 | </para></listitem>
|
---|
| 630 |
|
---|
| 631 | <listitem><para>When rebooting, you may want to skip the filesystem check,
|
---|
| 632 | <command>fsck</command>, completely. To do this, either create the file
|
---|
| 633 | <filename>/fastboot</filename> or reboot the system with the command
|
---|
| 634 | <command>/sbin/shutdown -f -r now</command>. On the other hand, you can
|
---|
| 635 | force all file systems to be checked by creating
|
---|
| 636 | <filename>/forcefsck</filename> or running <command>shutdown</command> with
|
---|
| 637 | the <parameter>-F</parameter> parameter instead of <parameter>-f</parameter>.
|
---|
| 638 | </para>
|
---|
| 639 |
|
---|
| 640 | <para>Setting the variable FASTBOOT=y will disable <command>fsck</command>
|
---|
| 641 | during the boot process until it is removed. This is not recommended
|
---|
| 642 | on a permanent basis.</para></listitem>
|
---|
| 643 |
|
---|
| 644 | <listitem><para>Normally, all files in the <filename
|
---|
| 645 | class='directory'>/tmp</filename> directory are deleted at boot time.
|
---|
| 646 | Depending on the number of files or directories present, this can cause a
|
---|
| 647 | noticeable delay in the boot process. To skip removing these files set the
|
---|
| 648 | variable SKIPTMPCLEAN=y.</para></listitem>
|
---|
| 649 |
|
---|
| 650 | <listitem><para>During shutdown, the <command>init</command> program sends
|
---|
| 651 | a TERM signal to each program it has started (e.g. agetty), waits for a set
|
---|
| 652 | time (default 3 seconds), and sends each process a KILL signal and waits
|
---|
| 653 | again. This process is repeated in the <command>sendsignals</command>
|
---|
| 654 | script for any processes that are not shut down by their own scripts. The
|
---|
| 655 | delay for <command>init</command> can be set by passing a parameter. For
|
---|
| 656 | example to remove the delay in <command>init</command>, pass the -t0
|
---|
| 657 | parameter when shutting down or rebooting (e.g. <command>/sbin/shutdown
|
---|
| 658 | -t0 -r now</command>). The delay for the <command>sendsignals</command>
|
---|
| 659 | script can be skipped by setting the parameter
|
---|
| 660 | KILLDELAY=0.</para></listitem>
|
---|
| 661 |
|
---|
| 662 | </itemizedlist>
|
---|
| 663 |
|
---|
| 664 | </sect3>
|
---|
| 665 | </sect2>
|
---|
[0ad6d9a] | 666 | </sect1>
|
---|