usage.xml 28 KB

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