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