usage.xml 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949
  1. <?xml version="1.0" encoding="UTF-8"?>
  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-scripts-usage" revision="sysv">
  9. <?dbhtml filename="usage.html"?>
  10. <title>System V 启动脚本使用与配置</title>
  11. <indexterm zone="ch-scripts-usage">
  12. <primary sortas="a-Bootscripts">Bootscripts</primary>
  13. <secondary>usage</secondary>
  14. </indexterm>
  15. <sect2>
  16. <title>System V 启动脚本如何工作?</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>Linux 使用一种称为 SysVinit 的特殊引导架构,它基于
  23. <emphasis>运行级别</emphasis> (run-level)的概念而构建。
  24. 不同系统的 SysVinit 可能会区别很大,
  25. 因此不能假设那些在某个 Linux 发行版上正常工作的方法也能在 LFS
  26. 正常工作。LFS 有自己的处事原则,但它也遵守被广泛接受的标准。
  27. </para>
  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-->
  35. <para>SysVinit(之后简称为 <quote>init</quote>)使用运行级别架构工作。
  36. 有七个(编号为 0 到 6)运行级别(实际上还有更多,
  37. 但它们用于一些特殊情况,一般并不使用。参阅
  38. <filename>init(8)</filename> 了解更多细节),
  39. 每个都对应于计算机在启动时应该进行的一组操作。
  40. 默认运行级别是 3,下面是不同运行级别的描述:</para>
  41. <literallayout>0: 停止系统运行
  42. 1: 单用户模式
  43. 2: 没有网络的多用户模式
  44. 3: 有网络的多用户模式
  45. 4: 保留用于自定义,如果没有自定义,和 3 相同
  46. 5: 和 4 相同,一般用于 GUI 登录 (如 X 的 <command>xdm</command> 或 KDE 的 <command>kdm</command>)
  47. 6: 重启计算机</literallayout>
  48. </sect2>
  49. <sect2 id="conf-sysvinit" role="configuration">
  50. <title>配置 Sysvinit</title>
  51. <indexterm zone="conf-sysvinit">
  52. <primary sortas="a-Sysvinit">Sysvinit</primary>
  53. <secondary>configuring</secondary>
  54. </indexterm>
  55. <indexterm zone="conf-sysvinit">
  56. <primary sortas="e-/etc/inittab">/etc/inittab</primary>
  57. </indexterm>
  58. <!--para>During the kernel initialization, the first program that is run
  59. is either specified on the command line or, by default
  60. <command>init</command>. This program reads the initialization file
  61. <filename>/etc/inittab</filename>. Create this file with:</para-->
  62. <para>在内核初始化过程中,第一个运行的程序要么是内核命令行中指定的程序,
  63. 要么默认为 <command>init</command>。该程序读取初始化文件
  64. <filename>/etc/inittab</filename>,执行以下命令创建该文件:</para>
  65. <screen><userinput>cat &gt; /etc/inittab &lt;&lt; "EOF"
  66. <literal># Begin /etc/inittab
  67. id:3:initdefault:
  68. si::sysinit:/etc/rc.d/init.d/rc S
  69. l0:0:wait:/etc/rc.d/init.d/rc 0
  70. l1:S1:wait:/etc/rc.d/init.d/rc 1
  71. l2:2:wait:/etc/rc.d/init.d/rc 2
  72. l3:3:wait:/etc/rc.d/init.d/rc 3
  73. l4:4:wait:/etc/rc.d/init.d/rc 4
  74. l5:5:wait:/etc/rc.d/init.d/rc 5
  75. l6:6:wait:/etc/rc.d/init.d/rc 6
  76. ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
  77. su:S016:once:/sbin/sulogin
  78. 1:2345:respawn:/sbin/agetty --noclear tty1 9600
  79. 2:2345:respawn:/sbin/agetty tty2 9600
  80. 3:2345:respawn:/sbin/agetty tty3 9600
  81. 4:2345:respawn:/sbin/agetty tty4 9600
  82. 5:2345:respawn:/sbin/agetty tty5 9600
  83. 6:2345:respawn:/sbin/agetty tty6 9600
  84. # End /etc/inittab</literal>
  85. EOF</userinput></screen>
  86. <!--para>An explanation of this initialization file is in the man page for
  87. <emphasis>inittab</emphasis>. For LFS, the key command that is run is
  88. <command>rc</command>. The initialization file above will instruct
  89. <command>rc</command> to run all the scripts starting with an S in the
  90. <filename class="directory">/etc/rc.d/rcS.d</filename> directory
  91. followed by all the scripts starting with an S in the <filename
  92. class="directory">/etc/rc.d/rc?.d</filename> directory where the question
  93. mark is specified by the initdefault value.</para-->
  94. <para>在 <emphasis>inittab</emphasis> 的 man
  95. 页面中可以找到对该初始化文件的解释。对于 LFS,被执行的关键命令是
  96. <command>rc</command>。上面的初始化文件会告诉 <command>rc</command>
  97. 先运行 <filename class="directory">/etc/rc.d/rcS.d</filename>
  98. 目录中所有名字以 S 开头的脚本,再运行
  99. <filename class="directory">/etc/rc.d/rc?.d</filename>
  100. 中所有名字以 S 开头的脚本,这里问号表示 initdefault 值指定的默认运行级别。
  101. </para>
  102. <!--para>As a convenience, the <command>rc</command> script reads a library of
  103. functions in <filename class="directory">/lib/lsb/init-functions</filename>.
  104. This library also reads an optional configuration file,
  105. <filename>/etc/sysconfig/rc.site</filename>. Any of the system
  106. configuration file parameters described in subsequent sections can be
  107. alternatively placed in this file allowing consolidation of all system
  108. parameters in this one file.</para-->
  109. <para>为了方便起见,<command>rc</command> 脚本从
  110. <filename class="directory">/lib/lsb/init-functions</filename>
  111. 中读取脚本函数库,这个库又会读取一个可选的配置文件
  112. <filename>/etc/sysconfig/rc.site</filename>。
  113. 如果您希望将所有系统参数集中到一个文件中,
  114. 可以将以下各节中描述的所有系统配置文件参数都写入这一个文件。</para>
  115. <!--para>As a debugging convenience, the functions script also logs all output
  116. to <filename>/run/var/bootlog</filename>. Since the <filename
  117. class="directory">/run</filename> directory is a tmpfs, this file is not
  118. persistent across boots, however it is appended to the more permanent file
  119. <filename>/var/log/boot.log</filename> at the end of the boot process.</para-->
  120. <para>为了方便调试,脚本函数库会将所有输出记录到
  121. <filename>/run/var/bootlog</filename>。由于
  122. <filename class="directory">/run</filename> 是 tmpfs,
  123. 这个文件在重新启动时不会被保留。然而,在引导过程结束时,
  124. 该文件的内容会被附加到更持久化的 <filename>/var/log/boot.log</filename>
  125. 文件末尾。</para>
  126. <sect3 id="init-levels" >
  127. <title>切换运行级别</title>
  128. <para>通过运行 <command>init
  129. <replaceable>&lt;runlevel&gt;</replaceable></command> 可以切换运行级别,
  130. 这里 <replaceable>&lt;runlevel&gt;</replaceable> 是要切换到的运行级别。
  131. 例如,如果要重新启动计算机,用户可以使用 <command>init 6</command> 命令,
  132. 它和 <command>reboot</command> 作用相同。同样,
  133. <command>init 0</command> 和 <command>halt</command> 作用相同。</para>
  134. <!--para>There are a number of directories under <filename
  135. class="directory">/etc/rc.d</filename> that look like <filename
  136. class="directory">rc?.d</filename> (where ? is the number of the run-level) and
  137. <filename class="directory">rcsysinit.d</filename>, all containing a number of
  138. symbolic links. Some begin with a <emphasis>K</emphasis>, the others begin with
  139. an <emphasis>S</emphasis>, and all of them have two numbers following the
  140. initial letter. The K means to stop (kill) a service and the S means to start a
  141. service. The numbers determine the order in which the scripts are run, from 00
  142. to 99&mdash;the lower the number the earlier it gets executed. When
  143. <command>init</command> switches to another run-level, the appropriate services
  144. are either started or stopped, depending on the runlevel chosen.</para-->
  145. <para>在 <filename class="directory">/etc/rc.d</filename>
  146. 中有一些名字类似 <filename class="directory">rc?.d</filename>
  147. 的目录(这里 ? 是运行级别编号),以及一个目录
  148. <filename class="directory">rcsysinit.d</filename>,
  149. 这些目录都包含一些符号链接。有的符号链接的名字以 <emphasis>K</emphasis>
  150. 开头,其他的则以 <emphasis>S</emphasis> 开头。它们的名字中,
  151. 第一个字符后都有两位数字。K 表示停止(杀死,kill)一个服务,
  152. 而 S 表示启动(start)一个服务。两位数字决定了运行这些脚本的顺序,
  153. 从 00 到 99 —— 数字较小的脚本更早执行。当 <command>init</command>
  154. 切换到另一个运行级别时,它会执行这些脚本,从而适当地启动或停止服务,
  155. 满足选择的运行级别要求。</para>
  156. <para>符号链接实际指向的脚本位于 <filename
  157. class="directory">/etc/rc.d/init.d</filename>,它们完成实际的工作。
  158. K 链接和 S 链接指向
  159. <filename class="directory">/etc/rc.d/init.d</filename>
  160. 中的相同脚本,这是因为脚本接受不同的参数,如
  161. <parameter>start</parameter>、<parameter>stop</parameter>、
  162. <parameter>restart</parameter>、<parameter>reload</parameter> 以及
  163. <parameter>status</parameter>。当发现 K 链接时,脚本被传递
  164. <parameter>stop</parameter> 参数。当发现 S 链接时,
  165. 对应的脚本被传递 <parameter>start</parameter> 参数。</para>
  166. <para>以上解释有一个例外情况,当 <filename
  167. class="directory">rc0.d</filename> 和 <filename
  168. class="directory">rc6.d</filename> 目录中出现以 <emphasis>S</emphasis>
  169. 开头的链接时,它们不会启动任何服务。相反,它们被以参数
  170. <parameter>stop</parameter> 调用,并停止服务。
  171. 这一行为背后的逻辑是,在重新启动系统或停止系统运行时,不需要启动任何服务,
  172. 只需要停止整个系统。</para>
  173. <para>下面是脚本接受的不同参数及其解释:</para>
  174. <variablelist>
  175. <varlistentry>
  176. <term><parameter>start</parameter></term>
  177. <listitem>
  178. <para>启动服务。</para>
  179. </listitem>
  180. </varlistentry>
  181. <varlistentry>
  182. <term><parameter>stop</parameter></term>
  183. <listitem>
  184. <para>停止服务。</para>
  185. </listitem>
  186. </varlistentry>
  187. <varlistentry>
  188. <term><parameter>restart</parameter></term>
  189. <listitem>
  190. <para>停止服务,再重新启动它。</para>
  191. </listitem>
  192. </varlistentry>
  193. <varlistentry>
  194. <term><parameter>reload</parameter></term>
  195. <listitem>
  196. <para>更新服务配置。
  197. 当服务的配置文件被修改后,如果不需要重新启动服务,
  198. 就使用该参数。</para>
  199. </listitem>
  200. </varlistentry>
  201. <varlistentry>
  202. <term><parameter>status</parameter></term>
  203. <listitem>
  204. <para>报告服务是否在运行中。如果正在运行,报告其 PID。</para>
  205. </listitem>
  206. </varlistentry>
  207. </variablelist>
  208. <para>您可以自由地修改引导过程的工作方式(毕竟这是您自己的 LFS 系统)。
  209. 我们给出的文件只是示例,用于展示它们可以完成的任务。</para>
  210. </sect3>
  211. </sect2>
  212. <sect2>
  213. <title>Udev 启动脚本</title>
  214. <para><filename>/etc/rc.d/init.d/udev</filename> 初始化脚本启动
  215. <command>udevd</command>,
  216. 触发内核已经创建的<quote>冷插拔</quote>设备,
  217. 等待其 udev 规则执行完毕。该脚本也会取消默认的 uevent 处理程序
  218. <filename>/sbin/hotplug</filename>,
  219. 因为现在内核不再需要调用外部二进制程序,相反,
  220. <command>udevd</command> 会监听一个 netlink 套接字,
  221. 以获取内核发出的 uevent 事件。</para>
  222. <!--para>The <command>/etc/rc.d/init.d/udev_retry</command> initscript takes
  223. care of re-triggering events for subsystems whose rules may rely on
  224. filesystems that are not mounted until the <command>mountfs</command>
  225. script is run (in particular, <filename class="directory">/usr</filename>
  226. and <filename class="directory">/var</filename> may cause this). This
  227. script runs after the <command>mountfs</command> script, so those rules
  228. (if re-triggered) should succeed the second time around. It is
  229. configured from the <filename>/etc/sysconfig/udev_retry</filename> file;
  230. any words in this file other than comments are considered subsystem names
  231. to trigger at retry time. To find the subsystem of a device, use
  232. <command>udevadm info - -attribute-walk &lt;device&gt;</command> where
  233. &lt;device&gt; is an absolute path in /dev or /sys such as /dev/sr0 or
  234. /sys/class/rtc.</para-->
  235. <para>某些子系统的 udev 规则依赖于一些直到 <command>mount_fs</command>
  236. 脚本被执行才会挂载的文件系统(如独立的
  237. <filename class="directory">/usr</filename> 和
  238. <filename class="directory">/var</filename> 文件系统就会导致这种现象)
  239. 初始化脚本 <command>/etc/rc.d/init.d/udev_retry</command>
  240. 负责重新触发这些子系统的事件。该脚本在 <command>mountfs</command>
  241. 后运行,因此这些规则(如果被重新触发)这一次应该能够成功执行。
  242. 配置文件 <filename>/etc/sysconfig/udev_retry</filename>
  243. 中包含的除注释外的所有单词都会被认为是一个需要触发的子系统。
  244. 为了找到某个设备的子系统,执行
  245. <command>udevadm info --attribute-walk &lt;device&gt;</command>,
  246. 这里 &lt;device&gt; 是一个 /dev 或 /sys 中的绝对路径,
  247. 例如 /dev/sr0 或 /sys/class/rtc。</para>
  248. <para>参阅 <xref linkend="module-loading"/>,
  249. 了解更多关于模块加载和 udev 的信息。</para>
  250. <!--
  251. <sect3>
  252. <title>Module Loading</title>
  253. <para>Device drivers compiled as modules may have aliases built into them.
  254. Aliases are visible in the output of the <command>modinfo</command>
  255. program and are usually related to the bus-specific identifiers of devices
  256. supported by a module. For example, the <emphasis>snd-fm801</emphasis>
  257. driver supports PCI devices with vendor ID 0x1319 and device ID 0x0801,
  258. and has an alias of <quote>pci:v00001319d00000801sv*sd*bc04sc01i*</quote>.
  259. For most devices, the bus driver exports the alias of the driver that
  260. would handle the device via <systemitem
  261. class="filesystem">sysfs</systemitem>. E.g., the
  262. <filename>/sys/bus/pci/devices/0000:00:0d.0/modalias</filename> file
  263. might contain the string
  264. <quote>pci:v00001319d00000801sv00001319sd00001319bc04sc01i00</quote>.
  265. The default rules provided with Udev will cause <command>udevd</command>
  266. to call out to <command>/sbin/modprobe</command> with the contents of the
  267. <envar>MODALIAS</envar> uevent environment variable (which should be the
  268. same as the contents of the <filename>modalias</filename> file in sysfs),
  269. thus loading all modules whose aliases match this string after wildcard
  270. expansion.</para>
  271. <para>In this example, this means that, in addition to
  272. <emphasis>snd-fm801</emphasis>, the obsolete (and unwanted)
  273. <emphasis>forte</emphasis> driver will be loaded if it is
  274. available. See below for ways in which the loading of unwanted drivers can
  275. be prevented.</para>
  276. <para>The kernel itself is also able to load modules for network
  277. protocols, filesystems and NLS support on demand.</para>
  278. </sect3>
  279. <sect3>
  280. <title>Handling Hotpluggable/Dynamic Devices</title>
  281. <para>When you plug in a device, such as a Universal Serial Bus (USB) MP3
  282. player, the kernel recognizes that the device is now connected and
  283. generates a uevent. This uevent is then handled by
  284. <command>udevd</command> as described above.</para>
  285. </sect3>
  286. -->
  287. </sect2>
  288. <sect2 id="ch-scripts-clock">
  289. <title>配置系统时钟</title>
  290. <indexterm zone="ch-scripts-clock">
  291. <primary sortas="d-scripts-setclock">setclock</primary>
  292. <secondary>configuring</secondary></indexterm>
  293. <!--para>The <command>setclock</command> script reads the time from the hardware
  294. clock, also known as the BIOS or the Complementary Metal Oxide Semiconductor
  295. (CMOS) clock. If the hardware clock is set to UTC, this script will convert the
  296. hardware clock's time to the local time using the
  297. <filename>/etc/localtime</filename> file (which tells the
  298. <command>hwclock</command> program which timezone the user is in). There is no
  299. way to detect whether or not the hardware clock is set to UTC, so this
  300. needs to be configured manually.</para-->
  301. <para><command>setclock</command> 脚本从硬件时钟读取时间,
  302. 硬件时钟又被称为 BIOS 时钟或互补金属氧化物半导体(CMOS)时钟。
  303. 如果硬件时钟被设为 UTC 时间,该脚本会根据
  304. <filename>/etc/localtime</filename> 文件(它告知
  305. <command>hwclock</command> 程序用户处于哪个时区),
  306. 将硬件时钟的时间转换成本地时间。不存在确定硬件时钟是否设为 UTC 的方法,
  307. 因此这必须手动设置。</para>
  308. <!--para>The <command>setclock</command> is run via
  309. <application>udev</application> when the kernel detects the hardware
  310. capability upon boot. It can also be run manually with the stop parameter to
  311. store the system time to the CMOS clock.</para-->
  312. <para>在引导后,内核检测硬件功能时,<command>setclock</command> 脚本被
  313. <application>udev</application> 执行。可以用 stop 参数手动调用它,
  314. 以将系统时间写入 CMOS 时钟。</para>
  315. <!--para>If you cannot remember whether or not the hardware clock is set to UTC,
  316. find out by running the <userinput>hwclock localtime show</userinput>
  317. command. This will display what the current time is according to the hardware
  318. clock. If this time matches whatever your watch says, then the hardware clock is
  319. set to local time. If the output from <command>hwclock</command> is not local
  320. time, chances are it is set to UTC time. Verify this by adding or subtracting
  321. the proper amount of hours for the timezone to the time shown by
  322. <command>hwclock</command>. For example, if you are currently in the MST
  323. timezone, which is also known as GMT -0700, add seven hours to the local
  324. time.</para-->
  325. <para>如果您不确定您的硬件时钟是否设置为 UTC ,运行
  326. <userinput>hwclock --localtime --show</userinput> 命令,
  327. 它会显示硬件时钟给出的当前时间。如果这个时间和您的手表显示的一致,
  328. 则说明硬件时钟被设定为本地时间。相反,如果 <command>hwclock</command>
  329. 输出的时间不是本地时间,则硬件时钟很可能被设定为 UTC 时间。
  330. 根据您的时区,在 <command>hwclock</command>
  331. 显示的时间上加减对应的小时数,进行进一步的验证。
  332. 例如,如果您现在处于莫斯科时区,即 GMT -0700 ,在本地时间上加
  333. 7 小时,再进行比较。</para>
  334. <!--para>Change the value of the <envar>UTC</envar> variable below
  335. to a value of <parameter>0</parameter> (zero) if the hardware clock
  336. is <emphasis>not</emphasis> set to UTC time.</para-->
  337. <para>如果硬件时钟<emphasis>没有</emphasis>设为 UTC 时间,
  338. 在下面的配置文件中,应该将 <envar>UTC</envar> 变量的值设为
  339. <parameter>0</parameter>。</para>
  340. <note><title>译注</title>
  341. <para>Windows 会将硬件时钟设定为本地时间,因此如果您要同时安装
  342. Windows 和 Linux,就要将 Linux (包括 LFS 和其他发行版)
  343. 配置为使用本地时间,除非能够忍受 Windows 和 Linux 显示的不同时间
  344. (必有一个是错误的)。
  345. </para></note>
  346. <!--para>Create a new file <filename>/etc/sysconfig/clock</filename> by running
  347. the following:</para-->
  348. <para>执行以下命令,创建一个新的
  349. <filename>/etc/sysconfig/clock</filename> 文件:</para>
  350. <screen><userinput>cat &gt; /etc/sysconfig/clock &lt;&lt; "EOF"
  351. <literal># Begin /etc/sysconfig/clock
  352. UTC=1
  353. # 将该变量设置为您希望传递给 hwclock 命令的选项,
  354. # 例如 Alpha 机器上的硬件时钟类型。
  355. CLOCKPARAMS=
  356. # End /etc/sysconfig/clock</literal>
  357. EOF</userinput></screen>
  358. <!--para>A good hint explaining how to deal with time on LFS is available
  359. at <ulink url="&hints-root;time.txt"/>. It explains issues such as
  360. time zones, UTC, and the <envar>TZ</envar> environment variable.</para-->
  361. <para>访问 <ulink url="&hints-root;time.txt"/> ,
  362. 可以找到一个关于如何在 LFS 系统中处理时间问题的好的提示。
  363. 它解释了时区、UTC 和 <envar>TZ</envar> 环境变量等问题。</para>
  364. <note><para>CLOCKPARAMS 和 UTC 参数也可在
  365. <filename>/etc/sysconfig/rc.site</filename> 文件中设定。</para></note>
  366. </sect2>
  367. <sect2 id="ch-scripts-console">
  368. <?dbhtml filename="console.html"?>
  369. <title>配置 Linux 控制台</title>
  370. <indexterm zone="ch-scripts-console">
  371. <primary sortas="d-console">console</primary>
  372. <secondary>configuring</secondary>
  373. </indexterm>
  374. <!--para>This section discusses how to configure the <command>console</command>
  375. bootscript that sets up the keyboard map, console font and console kernel log
  376. level. If non-ASCII characters (e.g., the copyright sign, the British pound
  377. sign and Euro symbol) will not be used and the keyboard is a U.S. one, much
  378. of this section can be skipped. Without the configuration file, (or
  379. equivalent settings in <filename>rc.site</filename>), the
  380. <command>console</command> bootscript will do nothing.</para-->
  381. <para>本节讨论如何配置 <command>console</command> 启动脚本,
  382. 使之正确设定键盘映射、控制台字体和控制台内核日志级别。
  383. 如果不使用非 ASCII 字符(如版权符号、英镑或欧元符号),
  384. 且键盘是美式的,则可以跳过本节。如果不创建本节的配置文件
  385. (且 <filename>rc.site</filename> 中也没有对应的设置),
  386. 则 <command>console</command> 脚本什么也不做。</para>
  387. <!--para>The <command>console</command> script reads the
  388. <filename>/etc/sysconfig/console</filename> file for configuration
  389. information. Decide which keymap and screen font will be used. Various
  390. language-specific HOWTOs can also help with this, see <ulink
  391. url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>. If still in
  392. doubt, look in the <filename class="directory">/usr/share/keymaps</filename>
  393. and <filename class="directory">/usr/share/consolefonts</filename> directories
  394. for valid keymaps and screen fonts. Read <filename>loadkeys(1)</filename> and
  395. <filename>setfont(8)</filename> manual pages to determine the correct
  396. arguments for these programs.</para-->
  397. <para><command>console</command> 脚本读取
  398. <filename>/etc/sysconfig/console</filename> 文件中的配置信息,
  399. 据此确定使用哪种键映射和控制台字体。一些与特定语言相关的
  400. HOWTO 文档可以帮助您进行配置,参阅
  401. <ulink url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>。
  402. 如果仍然存在疑问,在
  403. <filename class="directory">/usr/share/keymaps</filename> 和
  404. <filename class="directory">/usr/share/consolefonts</filename>
  405. 目录中寻找可用的键映射和屏幕字体,并阅读 <filename>loadkeys(1)</filename>
  406. 和 <filename>setfont(8)</filename> man 手册页面,
  407. 以确认应该传递给这两个程序的正确参数。</para>
  408. <!--para>The <filename>/etc/sysconfig/console</filename> file should contain lines
  409. of the form: VARIABLE="value". The following variables are recognized:</para-->
  410. <para><filename>/etc/sysconfig/console</filename>
  411. 文件应当包含若干行,它们的格式为:变量名="值"。下列变量名会被识别:</para>
  412. <variablelist>
  413. <varlistentry>
  414. <term>LOGLEVEL</term>
  415. <listitem>
  416. <!--para>This variable specifies the log level for kernel messages sent
  417. to the console as set by <command>dmesg</command>. Valid levels are
  418. from "1" (no messages) to "8". The default level is "7".</para-->
  419. <para>该变量指定被发送到终端的内核消息日志等级,
  420. 正如使用 <command>dmesg -n</command> 设置的那样。
  421. 有效的等级是 "1"(不输出消息) 到 "8" 之间的某个数,
  422. 默认值是 "7"。</para>
  423. </listitem>
  424. </varlistentry>
  425. <varlistentry>
  426. <term>KEYMAP</term>
  427. <listitem>
  428. <!--para>This variable specifies the arguments for the
  429. <command>loadkeys</command> program, typically, the name of keymap
  430. to load, e.g., <quote>it</quote>. If this variable is not set, the
  431. bootscript will not run the <command>loadkeys</command> program,
  432. and the default kernel keymap will be used. Note that a few keymaps
  433. have multiple versions with the same name (cz and its variants in
  434. qwerty/ and qwertz/, es in olpc/ and qwerty/, and trf in fgGIod/ and
  435. qwerty/). In these cases the parent directory should also be specified
  436. (e.g. qwerty/es) to ensure the proper keymap is loaded.
  437. </para-->
  438. <para>该变量指定传递给 <command>loadkeys</command> 程序的参数,
  439. 通常为希望加载的键映射表名,例如 <quote>it</quote>。
  440. 如果没有设置这个变量,启动脚本不会运行 <command>loadkeys</command>,
  441. 并使用默认键映射。注意某些键映射表有名字相同的不同版本
  442. (如 cz 及其变式在 qwerty/ 和 qwertz/ 中同时存在,
  443. es 在 olpc/ 和 qwerty/ 中同时存在,trf 在 fgGIod/ 和 qwerty/
  444. 中同时存在),此时就要把包含键映射表文件的目录名也写在该变量中
  445. (如 qwerty/es),才能保证加载正确的键映射。</para>
  446. </listitem>
  447. </varlistentry>
  448. <varlistentry>
  449. <term>KEYMAP_CORRECTIONS</term>
  450. <listitem>
  451. <!--para>This (rarely used) variable
  452. specifies the arguments for the second call to the
  453. <command>loadkeys</command> program. This is useful if the stock keymap
  454. is not completely satisfactory and a small adjustment has to be made. E.g.,
  455. to include the Euro sign into a keymap that normally doesn't have it,
  456. set this variable to <quote>euro2</quote>.</para-->
  457. <para>这个(很少使用的)变量指定第二次调用
  458. <command>loadkeys</command> 程序时的参数。
  459. 如果您希望对现成的,但不完全符合要求的键映射表进行微调,
  460. 这个变量很有用。例如,为了在不包含欧元符号的键映射中附加它,
  461. 可以设定该变量为 <quote>euro2</quote>。</para>
  462. </listitem>
  463. </varlistentry>
  464. <varlistentry>
  465. <term>FONT</term>
  466. <listitem>
  467. <!--para>This variable specifies the arguments for the
  468. <command>setfont</command> program. Typically, this includes the font
  469. name, <quote>-m</quote>, and the name of the application character
  470. map to load. E.g., in order to load the <quote>lat1-16</quote> font
  471. together with the <quote>8859-1</quote> application character map
  472. (as it is appropriate in the USA),-->
  473. <!-- because of the copyright sign -->
  474. <!-- set this variable to <quote>lat1-16 -m 8859-1</quote>.
  475. In UTF-8 mode, the kernel uses the application character map for
  476. conversion of composed 8-bit key codes in the keymap to UTF-8, and thus
  477. the argument of the "-m" parameter should be set to the encoding of the
  478. composed key codes in the keymap.</para-->
  479. <para>该变量指定传递给 <command>setfont</command> 程序的参数。
  480. 它一般包含字体名、<quote>-m</quote> 以及需要加载的应用字符映射名,
  481. 例如,如果要加载 <quote>lat1-16</quote> 字体,以及
  482. <quote>8859-1</quote> 应用字符映射(它适用于美国),
  483. 就将该变量设置为 <quote>lat1-16 -m 8859-1</quote>。
  484. 在 UTF-8 模式下,内核根据应用字符映射,将键映射中的
  485. 8 位键码组合转换成 UTF-8,因此 <quote>-m</quote>
  486. 参数的值应该被设为键映射中键码组合的编码。</para>
  487. </listitem>
  488. </varlistentry>
  489. <varlistentry>
  490. <term>UNICODE</term>
  491. <listitem>
  492. <!--para>Set this variable to <quote>1</quote>, <quote>yes</quote> or
  493. <quote>true</quote> in order to put the
  494. console into UTF-8 mode. This is useful in UTF-8 based locales and
  495. harmful otherwise.</para-->
  496. <para>将该变量设置为 <quote>1</quote>、<quote>yes</quote> 或
  497. <quote>true</quote>,可以将终端设置为 UTF-8 模式。
  498. 这对于基于 UTF-8 的 locale 来说很有用,但对于其他 locale 有害。
  499. </para>
  500. </listitem>
  501. </varlistentry>
  502. <varlistentry>
  503. <term>LEGACY_CHARSET</term>
  504. <listitem>
  505. <!--para>For many keyboard layouts, there is no stock Unicode keymap in
  506. the Kbd package. The <command>console</command> bootscript will
  507. convert an available keymap to UTF-8 on the fly if this variable is
  508. set to the encoding of the available non-UTF-8 keymap.</para-->
  509. <para>对于许多键盘布局,Kbd 软件包不包含现成的 Unicode 键映射。
  510. 如果将该变量设置为可用的非 UTF-8 键映射的编码,则
  511. <command>console</command>
  512. 启动脚本会将可用的键映射即时转换成 UTF-8。</para>
  513. </listitem>
  514. </varlistentry>
  515. </variablelist>
  516. <para>一些例子:</para>
  517. <itemizedlist>
  518. <listitem>
  519. <!--para>For a non-Unicode setup, only the KEYMAP and FONT variables are
  520. generally needed. E.g., for a Polish setup, one would use:</para-->
  521. <para>对于非 Unicode 设置,一般只需要 KEYMAP 和 FONT 变量。
  522. 例如,下面是一个波兰语设置:</para>
  523. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  524. <literal># Begin /etc/sysconfig/console
  525. KEYMAP="pl2"
  526. FONT="lat2a-16 -m 8859-2"
  527. # End /etc/sysconfig/console</literal>
  528. EOF</userinput></screen>
  529. </listitem>
  530. <listitem>
  531. <!--para>As mentioned above, it is sometimes necessary to adjust a
  532. stock keymap slightly. The following example adds the Euro symbol to the
  533. German keymap:</para-->
  534. <para>正如前文所述,有时需要微调一个现有的键映射,
  535. 下面的例子为德语键映射增加欧元符号:</para>
  536. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  537. <literal># Begin /etc/sysconfig/console
  538. KEYMAP="de-latin1"
  539. KEYMAP_CORRECTIONS="euro2"
  540. FONT="lat0-16 -m 8859-15"
  541. # End /etc/sysconfig/console</literal>
  542. EOF</userinput></screen>
  543. </listitem>
  544. <listitem>
  545. <!--para>The following is a Unicode-enabled example for Bulgarian, where a
  546. stock UTF-8 keymap exists:</para-->
  547. <para>下面是使用 Unicode 的白罗斯语配置,对于该语言,
  548. 可以使用已有的 UTF-8 键映射:</para>
  549. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  550. <literal># Begin /etc/sysconfig/console
  551. UNICODE="1"
  552. KEYMAP="bg_bds-utf8"
  553. FONT="LatArCyrHeb-16"
  554. # End /etc/sysconfig/console</literal>
  555. EOF</userinput></screen>
  556. </listitem>
  557. <listitem>
  558. <!--para>Due to the use of a 512-glyph LatArCyrHeb-16 font in the previous
  559. example, bright colors are no longer available on the Linux console unless
  560. a framebuffer is used. If one wants to have bright colors without
  561. framebuffer and can live without characters not belonging to his language,
  562. it is still possible to use a language-specific 256-glyph font, as
  563. illustrated below:</para-->
  564. <para>由于上面的例子使用了 512 个字形的 LatArCyrHeb-16 字体,
  565. 在 Linux 终端中不能继续使用明亮的颜色,除非使用了帧缓冲。
  566. 如果希望在没有帧缓冲的情况下使用明亮的颜色,
  567. 且不需要那些不属于自己母语的字符,可以使用特定语言的 256 字形字体,
  568. 配置文件如下:</para>
  569. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  570. <literal># Begin /etc/sysconfig/console
  571. UNICODE="1"
  572. KEYMAP="bg_bds-utf8"
  573. FONT="cyr-sun16"
  574. # End /etc/sysconfig/console</literal>
  575. EOF</userinput></screen>
  576. </listitem>
  577. <listitem>
  578. <!--para>The following example illustrates keymap autoconversion from
  579. ISO-8859-15 to UTF-8 and enabling dead keys in Unicode mode:</para-->
  580. <para>下面的例子展示了从 ISO-8859-15 到 UTF-8 的键映射自动转换,
  581. 同时在 Unicode 模式下启用了死键:</para>
  582. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  583. <literal># Begin /etc/sysconfig/console
  584. UNICODE="1"
  585. KEYMAP="de-latin1"
  586. KEYMAP_CORRECTIONS="euro2"
  587. LEGACY_CHARSET="iso-8859-15"
  588. FONT="LatArCyrHeb-16 -m 8859-15"
  589. # End /etc/sysconfig/console</literal>
  590. EOF</userinput></screen>
  591. </listitem>
  592. <listitem>
  593. <!--para>Some keymaps have dead keys (i.e., keys that don't produce a
  594. character by themselves, but put an accent on the character produced
  595. by the next key) or define composition rules (such as: <quote>press
  596. Ctrl+. A E to get &AElig;</quote> in the default keymap).
  597. Linux-&linux-version; interprets dead keys and composition rules in the
  598. keymap correctly only when the source characters to be composed together
  599. are not multibyte. This deficiency doesn't affect keymaps for European
  600. languages, because there accents are added to unaccented ASCII
  601. characters, or two ASCII characters are composed together. However, in
  602. UTF-8 mode it is a problem, e.g., for the Greek language, where one
  603. sometimes needs to put an accent on the letter <quote>alpha</quote>.
  604. The solution is either to avoid the use of UTF-8, or to install the
  605. X window system that doesn't have this limitation in its input
  606. handling.</para-->
  607. <para>某些键映射有死键(即,这些键本身不产生字符,
  608. 而是在下一次按键产生的字符上附加音调)或定义了组合规则
  609. (例如在默认键映射中,<quote>按下 Ctrl+. A E 得到 &AElig;</quote>)。
  610. Linux-&linux-version; 只有在被组合的不是多字节字符的情况下,
  611. 才能正常解析死键和组合规则。这个缺陷不影响欧洲语言的键映射,
  612. 因为在欧洲语言中要么是一个音调被附加到不带音调的 ASCII 字符上,
  613. 要么是两个 ASCII 字符被组合在一起。然而,在 UTF-8 模式中,
  614. 以希腊语为例,当某人要在 <quote>alpha</quote> 字符上附加一个音调时,
  615. 就会出现问题。解决方法是要么不使用 UTF-8,要么安装 X 窗口系统,
  616. 它处理输入时没有这个限制。</para>
  617. </listitem>
  618. <listitem>
  619. <!--para>For Chinese, Japanese, Korean and some other languages, the Linux
  620. console cannot be configured to display the needed characters. Users
  621. who need such languages should install the X Window System, fonts that
  622. cover the necessary character ranges, and the proper input method (e.g.,
  623. SCIM, it supports a wide variety of languages).</para-->
  624. <para>对于中文、日文、韩文以及其他一些语言文字,
  625. 不可能配置 Linux 终端,使其正常显示需要的字符。
  626. 这些语言的用户需要安装 X 窗口系统、能够覆盖需要的字符的字体,
  627. 以及合适的输入法(如 SCIM 支持许多语言的输入)。</para>
  628. </listitem>
  629. </itemizedlist>
  630. <!-- Added because folks keep posting their console file with X questions
  631. to blfs-support list -->
  632. <note>
  633. <!--para>The <filename>/etc/sysconfig/console</filename> file only controls
  634. the Linux text console localization. It has nothing to do with setting
  635. the proper keyboard layout and terminal fonts in the X Window System, with
  636. ssh sessions or with a serial console. In such situations, limitations
  637. mentioned in the last two list items above do not apply.</para-->
  638. <para><filename>/etc/sysconfig/console</filename> 文件只控制 Linux
  639. 字符终端的本地化,它和 X 窗口系统、ssh 连接、
  640. 串口等其他终端中的键盘布局设置和终端字体毫无关系。在这些情况下,
  641. 不存在上面描述的两项限制。</para>
  642. </note>
  643. </sect2>
  644. <sect2 id="ch-scripts-createfiles">
  645. <title>在引导时创建文件</title>
  646. <indexterm zone="ch-scripts-createfiles">
  647. <primary sortas="d-createfiles">File creation at boot</primary>
  648. <secondary>configuring</secondary>
  649. </indexterm>
  650. <!--para>At times, it is desired to create files at boot time. For instance,
  651. the <filename class="directory">/tmp/.ICE-unix</filename> directory
  652. may be desired. This can be done by creating an entry in the
  653. <filename>/etc/sysconfig/createfiles</filename> configuration script.
  654. The format of this file is embedded in the comments of the default
  655. configuration file.</para-->
  656. <para>有时,我们希望在引导时创建一些文件,例如
  657. <filename class="directory">/tmp/ICE-unix</filename> 目录。
  658. 为此,可以在 <filename>/etc/sysconfig/createfiles</filename>
  659. 配置脚本中创建一项,该文件的格式包含在默认配置文件的注释中。</para>
  660. </sect2>
  661. <sect2 id="ch-scripts-sysklogd">
  662. <title>配置 sysklogd 脚本</title>
  663. <indexterm zone="ch-scripts-sysklogd">
  664. <primary sortas="d-sysklogd">sysklogd</primary>
  665. <secondary>configuring</secondary>
  666. </indexterm>
  667. <!--para>The <filename>sysklogd</filename> script invokes the
  668. <command>syslogd</command> program as a part of System V initialization. The
  669. <parameter>-m 0</parameter> option turns off the periodic timestamp mark that
  670. <command>syslogd</command> writes to the log files every 20 minutes by
  671. default. If you want to turn on this periodic timestamp mark, edit
  672. <filename>/etc/sysconfig/rc.site</filename> and define the variable
  673. SYSKLOGD_PARMS to the desired value. For instance, to remove all parameters,
  674. set the variable to a null value:</para-->
  675. <para><filename>sysklogd</filename> 脚本启动
  676. <command>syslogd</command> 程序,它是 System V 初始化的一部分。
  677. <parameter>-m 0</parameter> 选项关闭 <command>sysklogd</command>
  678. 每 20 分钟写入日志文件的周期性时间戳,如果您希望启用该时间戳,
  679. 编辑 <filename>/etc/sysconfig/rc.site</filename>,
  680. 将 SYSKLOGD_PARMS 定义为您希望的值。例如,如果要删除所有参数,
  681. 将该变量设定为空:</para>
  682. <screen role="nodump">SYSKLOGD_PARMS=</screen>
  683. <para>参阅 <userinput>man syslogd</userinput> 了解更多可用选项。</para>
  684. </sect2>
  685. <sect2 id="ch-scripts-site">
  686. <title>rc.site 文件</title>
  687. <indexterm zone="ch-scripts-site">
  688. <primary sortas="a-rc.site">rc.site</primary>
  689. </indexterm>
  690. <!--para>The optional <filename>/etc/sysconfig/rc.site</filename> file contains
  691. settings that are automatically set for each SystemV boot script. It can
  692. alternatively set the values specified in the <filename>hostname</filename>,
  693. <filename>console</filename>, and <filename>clock</filename> files in the
  694. <filename class='directory'>/etc/sysconfig/</filename> directory. If the
  695. associated variables are present in both these separate files and
  696. <filename>rc.site</filename>, the values in the script specific files have
  697. precedence. </para-->
  698. <para>可选的 <filename>/etc/sysconfig/rc.site</filename>
  699. 文件包含为每个 System V 启动脚本自动设定的设置。
  700. <filename class="directory">/etc/sysconfig/</filename>
  701. 目录中 <filename>hostname</filename>、<filename>console</filename>
  702. 以及 <filename>clock</filename> 文件的变量值也可以在
  703. <filename>rc.site</filename> 中设置。
  704. 如果某个变量存在于这三个文件当中,它们会覆盖
  705. <filename>rc.site</filename> 中的设定。</para>
  706. <!--para><filename>rc.site</filename> also contains parameters that can
  707. customize other aspects of the boot process. Setting the IPROMPT variable
  708. will enable selective running of bootscripts. Other options are described
  709. in the file comments. The default version of the file is as follows:</para-->
  710. <para><filename>rc.site</filename>
  711. 还包含用于自定义引导过程其他属性的变量。
  712. 设定 IPROMPT 变量会启用引导脚本的选择性执行,
  713. 其他选项在文件注释中有描述。该文件的默认版本如下:</para>
  714. <!-- Use role to fix a pdf generation problem -->
  715. <screen role="auto">&site;</screen>
  716. <sect3>
  717. <title>自定义开关机脚本</title>
  718. <!--para>The LFS boot scripts boot and shut down a system in a fairly
  719. efficient manner, but there are a few tweaks that you can make in the
  720. rc.site file to improve speed even more and to adjust messages according
  721. to your preferences. To do this, adjust the settings in
  722. the <filename>/etc/sysconfig/rc.site</filename> file above.</para-->
  723. <para>LFS 启动脚本能够较为高效地引导和关闭系统,
  724. 但您仍然可以进行一些调整,进一步提高速度,
  725. 并根据您的喜好修改屏幕显示的消息。为此,需要修改上面给出的
  726. <filename>/etc/sysconfig/rc.site</filename> 文件。</para>
  727. <itemizedlist>
  728. <!--listitem><para>During the boot script <filename>udev</filename>, there is
  729. a call to <command>udev settle</command> that requires some time to
  730. complete. This time may or may not be required depending on devices present
  731. in the system. If you only have simple partitions and a single ethernet
  732. card, the boot process will probably not need to wait for this command. To
  733. skip it, set the variable OMIT_UDEV_SETTLE=y.</para></listitem-->
  734. <listitem><para>在启动脚本 <filename>udev</filename>
  735. 的运行过程中,它执行 <command>udev settle</command> 命令,
  736. 该命令需要较长时间才能完成。然而这个执行时间或许不是必要的,
  737. 如果您只有简单分区,且仅有一块网卡,
  738. 那么引导过程可能不需要等待该命令完成。设定变量
  739. OMIT_UDEV_SETTLE=y,可以跳过该命令。</para></listitem>
  740. <!--listitem><para>The boot script <filename>udev_retry</filename> also runs
  741. <command>udev settle</command> by default. This command is only needed by
  742. default if the <filename class='directory'>/var</filename> directory is
  743. separately mounted. This is because the clock needs the file
  744. <filename>/var/lib/hwclock/adjtime</filename>. Other customizations may
  745. also need to wait for udev to complete, but in many installations it is not
  746. needed. Skip the command by setting the variable OMIT_UDEV_RETRY_SETTLE=y.
  747. </para></listitem-->
  748. <listitem><para>启动脚本 <filename>udev_retry</filename>
  749. 默认情况下也会执行 <command>udev settle</command>。
  750. 一般来说,该命令只有 <filename class="directory">/var</filename>
  751. 目录是一个单独的挂载点时才必要,这是因为系统时钟需要文件
  752. <filename>/var/lib/hwclock/adjtime</filename>。
  753. 其他的定制也可能导致该脚本需要等待 udev 完成,
  754. 但在绝大多数 LFS 系统中没有这个必要。
  755. 设定变量 OMIT_UDEV_RETRY_SETTLE=y 跳过这一命令。</para></listitem>
  756. <!--listitem><para>By default, the file system checks are silent. This can
  757. appear to be a delay during the bootup process. To turn on the
  758. <command>fsck</command> output, set the variable VERBOSE_FSCK=y.
  759. </para></listitem-->
  760. <listitem><para>默认情况下,文件系统检查是安静(没有输出)的。
  761. 因此,在引导过程中,检查过程可能看上去是一个很长的时延。
  762. 设置变量 VERBOSE_FSCK=y 可以打开 <command>fsck</command> 的输出。
  763. </para></listitem>
  764. <!--listitem><para>When rebooting, you may want to skip the filesystem check,
  765. <command>fsck</command>, completely. To do this, either create the file
  766. <filename>/fastboot</filename> or reboot the system with the command
  767. <command>/sbin/shutdown -f -r now</command>. On the other hand, you can
  768. force all file systems to be checked by creating
  769. <filename>/forcefsck</filename> or running <command>shutdown</command> with
  770. the <parameter>-F</parameter> parameter instead of <parameter>-f</parameter>.
  771. </para-->
  772. <listitem><para>在重启系统时,您可能希望完全跳过文件系统检查命令
  773. <command>fsck</command>。为此,可以创建文件
  774. <filename>/fastboot</filename>,或使用命令
  775. <command>/sbin/shutdown -f -r now</command> 重启系统。
  776. 另一方面,您可以创建 <filename>/forcefsck</filename> 文件,
  777. 或使用 <parameter>-F</parameter> 参数(而不是
  778. <parameter>-f</parameter>)运行 <command>shutdown</command>,
  779. 在重启系统时强制检查所有文件系统。</para>
  780. <!--para>Setting the variable FASTBOOT=y will disable <command>fsck</command>
  781. during the boot process until it is removed. This is not recommended
  782. on a permanent basis.</para></listitem-->
  783. <para>设定变量 FASTBOOT=y 会完全禁止引导过程中 <command>fsck</command>
  784. 的执行,直到该变量被删除。不建议永久使用该变量。</para></listitem>
  785. <!--listitem><para>Normally, all files in the <filename
  786. class='directory'>/tmp</filename> directory are deleted at boot time.
  787. Depending on the number of files or directories present, this can cause a
  788. noticeable delay in the boot process. To skip removing these files set the
  789. variable SKIPTMPCLEAN=y.</para></listitem-->
  790. <listitem><para>正常情况下,
  791. <filename class="directory">/tmp</filename>
  792. 中的所有文件在引导时都被删除。如果其中的文件和目录较多,
  793. 可能在引导过程中造成可观的延迟。设定变量 SKIPTMPCLEAN=y
  794. 可以跳过删除这些文件的过程。</para></listitem>
  795. <!--listitem><para>During shutdown, the <command>init</command> program sends
  796. a TERM signal to each program it has started (e.g. agetty), waits for a set
  797. time (default 3 seconds), and sends each process a KILL signal and waits
  798. again. This process is repeated in the <command>sendsignals</command>
  799. script for any processes that are not shut down by their own scripts. The
  800. delay for <command>init</command> can be set by passing a parameter. For
  801. example to remove the delay in <command>init</command>, pass the -t0
  802. parameter when shutting down or rebooting (e.g. <command>/sbin/shutdown
  803. -t0 -r now</command>). The delay for the <command>sendsignals</command>
  804. script can be skipped by setting the parameter
  805. KILLDELAY=0.</para></listitem-->
  806. <listitem><para>在系统关闭的过程中,<command>init</command>
  807. 向它启动的所有程序(如 getty)发送一个 TERM 信号,等待一段时间
  808. (默认 3 秒),再向每个进程发送 KILL 信号,之后再次等待。
  809. 在 <command>sendsignals</command> 脚本中,
  810. 以上过程会对那些没有被自己的引导脚本关闭的进程再次执行。
  811. <command>init</command> 的时延可以通过传递参数设定,
  812. 为了完全取消时延,可以在关闭或重启系统时使用 -t0 参数
  813. (如 <command>shutdown -t0 -r now</command>)。
  814. <command>sendsignals</command> 脚本的时延可以通过设定参数
  815. KILLDELAY=0 跳过。</para></listitem>
  816. </itemizedlist>
  817. </sect3>
  818. </sect2>
  819. </sect1>