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