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