Changeset bf58c1e for chapter07/usage.xml
- Timestamp:
- 04/21/2014 09:44:04 PM (10 years ago)
- Branches:
- 10.0, 10.0-rc1, 10.1, 10.1-rc1, 11.0, 11.0-rc1, 11.0-rc2, 11.0-rc3, 11.1, 11.1-rc1, 11.2, 11.2-rc1, 11.3, 11.3-rc1, 12.0, 12.0-rc1, 12.1, 12.1-rc1, 7.6, 7.7, 7.8, 7.9, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1, arm, bdubbs/gcc13, ml-11.0, multilib, renodr/libudev-from-systemd, s6-init, trunk, xry111/arm64, xry111/arm64-12.0, xry111/clfs-ng, xry111/lfs-next, xry111/loongarch, xry111/loongarch-12.0, xry111/loongarch-12.1, xry111/mips64el, xry111/pip3, xry111/rust-wip-20221008, xry111/update-glibc
- Children:
- 5af3f9e
- Parents:
- c65dd23e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter07/usage.xml
rc65dd23e rbf58c1e 3 3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ 4 4 <!ENTITY % general-entities SYSTEM "../general.ent"> 5 <!ENTITY site SYSTEM "../appendices/rc.site.script"> 5 6 %general-entities; 6 7 ]> … … 9 10 <?dbhtml filename="usage.html"?> 10 11 11 <title> How Do the System V Bootscripts Work?</title>12 <title>System V Bootscript Usage and Configuration</title> 12 13 13 14 <indexterm zone="ch-scripts-usage"> … … 16 17 </indexterm> 17 18 18 <para>Linux uses a special booting facility named SysVinit that is based on a 19 concept of <emphasis>run-levels</emphasis>. It can be quite different from one 20 system to another, so it cannot be assumed that because things worked in one 21 particular Linux distribution, they should work the same in LFS too. LFS has its 22 own way of doing things, but it respects generally accepted standards.</para> 23 24 <para>SysVinit (which will be referred to as <quote>init</quote> from now on) 25 works using a run-levels scheme. There are seven (numbered 0 to 6) run-levels 26 (actually, there are more run-levels, but they are for special cases and are 27 generally not used. See <filename>init(8)</filename> for more details), and 28 each one of those corresponds to the actions the computer is supposed to 29 perform when it starts up. The default run-level is 3. Here are the 30 descriptions of the different run-levels as they are implemented:</para> 19 <sect2> 20 <title>How Do the System V Bootscripts Work?</title> 21 22 <para>Linux uses a special booting facility named SysVinit that is based on a 23 concept of <emphasis>run-levels</emphasis>. It can be quite different from one 24 system to another, so it cannot be assumed that because things worked in one 25 particular Linux distribution, they should work the same in LFS too. LFS has its 26 own way of doing things, but it respects generally accepted standards.</para> 27 28 <para>SysVinit (which will be referred to as <quote>init</quote> from now on) 29 works using a run-levels scheme. There are seven (numbered 0 to 6) run-levels 30 (actually, there are more run-levels, but they are for special cases and are 31 generally not used. See <filename>init(8)</filename> for more details), and 32 each one of those corresponds to the actions the computer is supposed to 33 perform when it starts up. The default run-level is 3. Here are the 34 descriptions of the different run-levels as they are implemented:</para> 31 35 32 36 <literallayout>0: halt the computer … … 37 41 5: same as 4, it is usually used for GUI login (like X's <command>xdm</command> or KDE's <command>kdm</command>) 38 42 6: reboot the computer</literallayout> 43 44 </sect2> 39 45 40 46 <sect2 id="conf-sysvinit" role="configuration"> … … 107 113 <filename>/var/log/boot.log</filename> at the end of the boot process.</para> 108 114 109 </sect2> 110 111 <sect2 id="init-levels" > 115 <sect3 id="init-levels" > 112 116 <title>Changing Run Levels</title> 113 117 … … 201 205 it can be done.</para> 202 206 207 </sect3> 203 208 </sect2> 204 209 210 <sect2 id="ch-scripts-clock"> 211 <title>Configuring the System Clock</title> 212 213 <sect3 id="ch-scripts-setclock"> 214 <title>System V Clock Configuration</title> 215 216 <indexterm zone="ch-scripts-setclock"> 217 <primary sortas="d-setclock">setclock</primary> 218 <secondary>configuring</secondary></indexterm> 219 220 <para>The <command>setclock</command> script reads the time from the hardware 221 clock, also known as the BIOS or the Complementary Metal Oxide Semiconductor 222 (CMOS) clock. If the hardware clock is set to UTC, this script will convert the 223 hardware clock's time to the local time using the 224 <filename>/etc/localtime</filename> file (which tells the 225 <command>hwclock</command> program which timezone the user is in). There is no 226 way to detect whether or not the hardware clock is set to UTC, so this 227 needs to be configured manually.</para> 228 229 <para>The <command>setclock</command> is run via 230 <application>udev</application> when the kernel detects the hardware 231 capability upon boot. It can also be run manually with the stop parameter to 232 store the system time to the CMOS clock.</para> 233 234 <para>If you cannot remember whether or not the hardware clock is set to UTC, 235 find out by running the <userinput>hwclock --localtime --show</userinput> 236 command. This will display what the current time is according to the hardware 237 clock. If this time matches whatever your watch says, then the hardware clock is 238 set to local time. If the output from <command>hwclock</command> is not local 239 time, chances are it is set to UTC time. Verify this by adding or subtracting 240 the proper amount of hours for the timezone to the time shown by 241 <command>hwclock</command>. For example, if you are currently in the MST 242 timezone, which is also known as GMT -0700, add seven hours to the local 243 time.</para> 244 245 <para>Change the value of the <envar>UTC</envar> variable below 246 to a value of <parameter>0</parameter> (zero) if the hardware clock 247 is <emphasis>not</emphasis> set to UTC time.</para> 248 249 <para>Create a new file <filename>/etc/sysconfig/clock</filename> by running 250 the following:</para> 251 252 <screen><userinput>cat > /etc/sysconfig/clock << "EOF" 253 <literal># Begin /etc/sysconfig/clock 254 255 UTC=1 256 257 # Set this to any options you might need to give to hwclock, 258 # such as machine hardware clock type for Alphas. 259 CLOCKPARAMS= 260 261 # End /etc/sysconfig/clock</literal> 262 EOF</userinput></screen> 263 264 <para>A good hint explaining how to deal with time on LFS is available 265 at <ulink url="&hints-root;time.txt"/>. It explains issues such as 266 time zones, UTC, and the <envar>TZ</envar> environment variable.</para> 267 268 <note><para>The CLOCKPARAMS and UTC paramaters may be alternatively set 269 in the <filename>/etc/sysconfig/rc.site</filename> file.</para></note> 270 271 </sect3> 272 </sect2> 273 274 <sect2 id="ch-scripts-console"> 275 <?dbhtml filename="console.html"?> 276 277 <title>Configuring the Linux Console</title> 278 279 <indexterm zone="ch-scripts-console"> 280 <primary sortas="d-console">console</primary> 281 <secondary>configuring</secondary> 282 </indexterm> 283 284 <para>This section discusses how to configure the <command>console</command> 285 bootscript that sets up the keyboard map, console font and console kernel log 286 level. If non-ASCII characters (e.g., the copyright sign, the British pound 287 sign and Euro symbol) will not be used and the keyboard is a U.S. one, much 288 of this section can be skipped. Without the configuration file, (or 289 equivalent settings in <filename>rc.site</filename>), the 290 <command>console</command> bootscript will do nothing.</para> 291 292 <para>The <command>console</command> script reads the 293 <filename>/etc/sysconfig/console</filename> file for configuration 294 information. Decide which keymap and screen font will be used. Various 295 language-specific HOWTOs can also help with this, see <ulink 296 url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>. If still in 297 doubt, look in the <filename class="directory">/usr/share/keymaps</filename> 298 and <filename class="directory">/usr/share/consolefonts</filename> directories 299 for valid keymaps and screen fonts. Read <filename>loadkeys(1)</filename> and 300 <filename>setfont(8)</filename> manual pages to determine the correct 301 arguments for these programs.</para> 302 303 <para>The <filename>/etc/sysconfig/console</filename> file should contain lines 304 of the form: VARIABLE="value". The following variables are recognized:</para> 305 <variablelist> 306 307 <varlistentry> 308 <term>LOGLEVEL</term> 309 <listitem> 310 <para>This variable specifies the log level for kernel messages sent 311 to the console as set by <command>dmesg</command>. Valid levels are 312 from "1" (no messages) to "8". The default level is "7".</para> 313 </listitem> 314 </varlistentry> 315 316 <varlistentry> 317 <term>KEYMAP</term> 318 <listitem> 319 <para>This variable specifies the arguments for the 320 <command>loadkeys</command> program, typically, the name of keymap 321 to load, e.g., <quote>es</quote>. If this variable is not set, the 322 bootscript will not run the <command>loadkeys</command> program, 323 and the default kernel keymap will be used.</para> 324 </listitem> 325 </varlistentry> 326 327 <varlistentry> 328 <term>KEYMAP_CORRECTIONS</term> 329 <listitem> 330 <para>This (rarely used) variable 331 specifies the arguments for the second call to the 332 <command>loadkeys</command> program. This is useful if the stock keymap 333 is not completely satisfactory and a small adjustment has to be made. E.g., 334 to include the Euro sign into a keymap that normally doesn't have it, 335 set this variable to <quote>euro2</quote>.</para> 336 </listitem> 337 </varlistentry> 338 339 <varlistentry> 340 <term>FONT</term> 341 <listitem> 342 <para>This variable specifies the arguments for the 343 <command>setfont</command> program. Typically, this includes the font 344 name, <quote>-m</quote>, and the name of the application character 345 map to load. E.g., in order to load the <quote>lat1-16</quote> font 346 together with the <quote>8859-1</quote> application character map 347 (as it is appropriate in the USA), 348 <!-- because of the copyright sign --> 349 set this variable to <quote>lat1-16 -m 8859-1</quote>. 350 In UTF-8 mode, the kernel uses the application character map for 351 conversion of composed 8-bit key codes in the keymap to UTF-8, and thus 352 the argument of the "-m" parameter should be set to the encoding of the 353 composed key codes in the keymap.</para> 354 355 </listitem> 356 </varlistentry> 357 358 <varlistentry> 359 <term>UNICODE</term> 360 <listitem> 361 <para>Set this variable to <quote>1</quote>, <quote>yes</quote> or 362 <quote>true</quote> in order to put the 363 console into UTF-8 mode. This is useful in UTF-8 based locales and 364 harmful otherwise.</para> 365 </listitem> 366 </varlistentry> 367 368 <varlistentry> 369 <term>LEGACY_CHARSET</term> 370 <listitem> 371 <para>For many keyboard layouts, there is no stock Unicode keymap in 372 the Kbd package. The <command>console</command> bootscript will 373 convert an available keymap to UTF-8 on the fly if this variable is 374 set to the encoding of the available non-UTF-8 keymap.</para> 375 </listitem> 376 </varlistentry> 377 378 </variablelist> 379 380 <para>Some examples:</para> 381 382 <itemizedlist> 383 384 <listitem> 385 <para>For a non-Unicode setup, only the KEYMAP and FONT variables are 386 generally needed. E.g., for a Polish setup, one would use:</para> 387 <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF" 388 <literal># Begin /etc/sysconfig/console 389 390 KEYMAP="pl2" 391 FONT="lat2a-16 -m 8859-2" 392 393 # End /etc/sysconfig/console</literal> 394 EOF</userinput></screen> 395 </listitem> 396 397 <listitem> 398 <para>As mentioned above, it is sometimes necessary to adjust a 399 stock keymap slightly. The following example adds the Euro symbol to the 400 German keymap:</para> 401 402 <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF" 403 <literal># Begin /etc/sysconfig/console 404 405 KEYMAP="de-latin1" 406 KEYMAP_CORRECTIONS="euro2" 407 FONT="lat0-16 -m 8859-15" 408 409 # End /etc/sysconfig/console</literal> 410 EOF</userinput></screen> 411 </listitem> 412 413 <listitem> 414 <para>The following is a Unicode-enabled example for Bulgarian, where a 415 stock UTF-8 keymap exists:</para> 416 417 <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF" 418 <literal># Begin /etc/sysconfig/console 419 420 UNICODE="1" 421 KEYMAP="bg_bds-utf8" 422 FONT="LatArCyrHeb-16" 423 424 # End /etc/sysconfig/console</literal> 425 EOF</userinput></screen> 426 </listitem> 427 428 <listitem> 429 <para>Due to the use of a 512-glyph LatArCyrHeb-16 font in the previous 430 example, bright colors are no longer available on the Linux console unless 431 a framebuffer is used. If one wants to have bright colors without 432 framebuffer and can live without characters not belonging to his language, 433 it is still possible to use a language-specific 256-glyph font, as 434 illustrated below:</para> 435 436 <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF" 437 <literal># Begin /etc/sysconfig/console 438 439 UNICODE="1" 440 KEYMAP="bg_bds-utf8" 441 FONT="cyr-sun16" 442 443 # End /etc/sysconfig/console</literal> 444 EOF</userinput></screen> 445 </listitem> 446 447 <listitem> 448 <para>The following example illustrates keymap autoconversion from 449 ISO-8859-15 to UTF-8 and enabling dead keys in Unicode mode:</para> 450 451 <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF" 452 <literal># Begin /etc/sysconfig/console 453 454 UNICODE="1" 455 KEYMAP="de-latin1" 456 KEYMAP_CORRECTIONS="euro2" 457 LEGACY_CHARSET="iso-8859-15" 458 FONT="LatArCyrHeb-16 -m 8859-15" 459 460 # End /etc/sysconfig/console</literal> 461 EOF</userinput></screen> 462 </listitem> 463 464 <listitem> 465 <para>Some keymaps have dead keys (i.e., keys that don't produce a 466 character by themselves, but put an accent on the character produced 467 by the next key) or define composition rules (such as: <quote>press 468 Ctrl+. A E to get Æ</quote> in the default keymap). 469 Linux-&linux-version; interprets dead keys and composition rules in the 470 keymap correctly only when the source characters to be composed together 471 are not multibyte. This deficiency doesn't affect keymaps for European 472 languages, because there accents are added to unaccented ASCII 473 characters, or two ASCII characters are composed together. However, in 474 UTF-8 mode it is a problem, e.g., for the Greek language, where one 475 sometimes needs to put an accent on the letter <quote>alpha</quote>. 476 The solution is either to avoid the use of UTF-8, or to install the 477 X window system that doesn't have this limitation in its input 478 handling.</para> 479 </listitem> 480 481 <listitem> 482 <para>For Chinese, Japanese, Korean and some other languages, the Linux 483 console cannot be configured to display the needed characters. Users 484 who need such languages should install the X Window System, fonts that 485 cover the necessary character ranges, and the proper input method (e.g., 486 SCIM, it supports a wide variety of languages).</para> 487 </listitem> 488 489 </itemizedlist> 490 491 <!-- Added because folks keep posting their console file with X questions 492 to blfs-support list --> 493 <note> 494 <para>The <filename>/etc/sysconfig/console</filename> file only controls 495 the Linux text console localization. It has nothing to do with setting 496 the proper keyboard layout and terminal fonts in the X Window System, with 497 ssh sessions or with a serial console. In such situations, limitations 498 mentioned in the last two list items above do not apply.</para> 499 </note> 500 501 </sect2> 502 503 <sect2 id="ch-scripts-createfiles"> 504 <title>Creating Files at Boot</title> 505 506 <indexterm zone="ch-scripts-createfiles"> 507 <primary sortas="d-createfiles">File creation at boot</primary> 508 <secondary>configuring</secondary> 509 </indexterm> 510 511 <para>At times, it is desired to create files at boot time. For instance, 512 the <filename class="directory">/tmp/.ICE-unix</filename> directory 513 may be desired. This can be done by creating an entry in the 514 <filename>/etc/sysconfig/createfiles</filename> configuration script. 515 The format of this file is embedded in the comments of the default 516 configuration file.</para> 517 </sect2> 518 519 <sect2 id="ch-scripts-sysklogd"> 520 <title>Configuring the sysklogd Script</title> 521 522 <indexterm zone="ch-scripts-sysklogd"> 523 <primary sortas="d-sysklogd">sysklogd</primary> 524 <secondary>configuring</secondary> 525 </indexterm> 526 527 <para>The <filename>sysklogd</filename> script invokes the 528 <command>syslogd</command> program as a part of System V initialization. The 529 <parameter>-m 0</parameter> option turns off the periodic timestamp mark that 530 <command>syslogd</command> writes to the log files every 20 minutes by 531 default. If you want to turn on this periodic timestamp mark, edit 532 <filename>/etc/sysconfig/rc.site</filename> and define the variable 533 SYSKLOGD_PARMS to the desired value. For instance, to remove all parameters, 534 set the variable to a null value:</para> 535 536 <screen role="nodump">SYSKLOGD_PARMS=</screen> 537 538 <para>See <userinput>man syslogd</userinput> for more options.</para> 539 540 </sect2> 541 542 <sect2 id="ch-scripts-site"> 543 <title>The rc.site File</title> 544 545 <indexterm zone="ch-scripts-site"> 546 <primary sortas="a-rc.site">rc.site</primary> 547 </indexterm> 548 549 <para>The optional <filename>/etc/sysconfig/rc.site</filename> file contains 550 settings that are automatically set for each SystemV boot script. It can 551 alternatively set the values specified in the <filename>hostname</filename>, 552 <filename>console</filename>, and <filename>clock</filename> files in the 553 <filename class='directory'>/etc/sysconfig/</filename> directory. If the 554 associated variables are present in both these separate files and 555 <filename>rc.site</filename>, the values in the script specific files have 556 precedence. </para> 557 558 <para><filename>rc.site</filename> also contains parameters that can 559 customize other aspects of the boot process. Setting the IPROMPT variable 560 will enable selective running of bootscripts. Other options are described 561 in the file comments. The default version of the file is as follows:</para> 562 563 <!-- Use role to fix a pdf generation problem --> 564 <screen role="auto">&site;</screen> 565 566 <sect3> 567 <title>Customizing the Boot and Shutdown Scripts</title> 568 569 <para>The LFS boot scripts boot and shut down a system in a fairly 570 efficient manner, but there are a few tweaks that you can make in the 571 rc.site file to improve speed even more and to adjust messages according 572 to your preferences. To do this, adjust the settings in 573 the <filename>/etc/sysconfig/rc.site</filename> file above.</para> 574 575 <itemizedlist> 576 577 <listitem><para>During the boot script <filename>udev</filename>, there is 578 a call to <command>udev settle</command> that requires some time to 579 complete. This time may or may not be required depending on devices present 580 in the system. If you only have simple partitions and a single ethernet 581 card, the boot process will probably not need to wait for this command. To 582 skip it, set the variable OMIT_UDEV_SETTLE=y.</para></listitem> 583 584 <listitem><para>The boot script <filename>udev_retry</filename> also runs 585 <command>udev settle</command> by default. This command is only needed by 586 default if the <filename class='directory'>/var</filename> directory is 587 separately mounted. This is because the clock needs the file 588 <filename>/var/lib/hwclock/adjtime</filename>. Other customizations may 589 also need to wait for udev to complete, but in many installations it is not 590 needed. Skip the command by setting the variable OMIT_UDEV_RETRY_SETTLE=y. 591 </para></listitem> 592 593 <listitem><para>By default, the file system checks are silent. This can 594 appear to be a delay during the bootup process. To turn on the 595 <command>fsck</command> output, set the variable VERBOSE_FSCK=y. 596 </para></listitem> 597 598 <listitem><para>When rebooting, you may want to skip the filesystem check, 599 <command>fsck</command>, completely. To do this, either create the file 600 <filename>/fastboot</filename> or reboot the system with the command 601 <command>/sbin/shutdown -f -r now</command>. On the other hand, you can 602 force all file systems to be checked by creating 603 <filename>/forcefsck</filename> or running <command>shutdown</command> with 604 the <parameter>-F</parameter> parameter instead of <parameter>-f</parameter>. 605 </para> 606 607 <para>Setting the variable FASTBOOT=y will disable <command>fsck</command> 608 during the boot process until it is removed. This is not recommended 609 on a permanent basis.</para></listitem> 610 611 <listitem><para>Normally, all files in the <filename 612 class='directory'>/tmp</filename> directory are deleted at boot time. 613 Depending on the number of files or directories present, this can cause a 614 noticeable delay in the boot process. To skip removing these files set the 615 variable SKIPTMPCLEAN=y.</para></listitem> 616 617 <listitem><para>During shutdown, the <command>init</command> program sends 618 a TERM signal to each program it has started (e.g. agetty), waits for a set 619 time (default 3 seconds), and sends each process a KILL signal and waits 620 again. This process is repeated in the <command>sendsignals</command> 621 script for any processes that are not shut down by their own scripts. The 622 delay for <command>init</command> can be set by passing a parameter. For 623 example to remove the delay in <command>init</command>, pass the -t0 624 parameter when shutting down or rebooting (e.g. <command>/sbin/shutdown 625 -t0 -r now</command>). The delay for the <command>sendsignals</command> 626 script can be skipped by setting the parameter 627 KILLDELAY=0.</para></listitem> 628 629 </itemizedlist> 630 631 </sect3> 632 </sect2> 205 633 </sect1>
Note:
See TracChangeset
for help on using the changeset viewer.