sysvinit.xml 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
  3. <!ENTITY % general-entities SYSTEM "../general.ent">
  4. %general-entities;
  5. ]>
  6. <sect1 id="ch-system-sysvinit" xreflabel="Sysvinit" role="wrap">
  7. <title>Sysvinit-&sysvinit-version;</title>
  8. <?dbhtml filename="sysvinit.html"?>
  9. <indexterm zone="ch-system-sysvinit"><primary sortas="a-Sysvinit">Sysvinit</primary></indexterm>
  10. <sect2 role="package"><title/>
  11. <para>The Sysvinit package contains programs for controlling the startup,
  12. running, and shutdown of your system.</para>
  13. <segmentedlist>
  14. <segtitle>&buildtime;</segtitle>
  15. <segtitle>&diskspace;</segtitle>
  16. <seglistitem><seg>0.1 SBU</seg><seg> 0.9 MB</seg></seglistitem>
  17. </segmentedlist>
  18. <segmentedlist>
  19. <segtitle>Sysvinit installation depends on</segtitle>
  20. <seglistitem><seg>Binutils, Coreutils, GCC, Glibc, Make</seg></seglistitem>
  21. </segmentedlist>
  22. </sect2>
  23. <sect2 role="installation">
  24. <title>Installation of Sysvinit</title>
  25. <para>Sysvinit &sysvinit-version; contains a <quote>buffer overflow</quote> bug.
  26. Under some conditions, it clobbers the
  27. values of environment variables. Fix that:</para>
  28. <screen><userinput>patch -Np1 -i ../sysvinit-&sysvinit-version;-proclen-1.patch</userinput></screen>
  29. <para>When run-levels are changed (for example, when halting the system),
  30. <command>init</command> sends termination signals to those processes that
  31. <command>init</command> itself started and that shouldn't be running in the new
  32. run-level. While doing this, <command>init</command> outputs messages like
  33. <quote>Sending processes the TERM signal</quote> which seem to imply that it is sending these signals to all currently running processes. To avoid this
  34. misinterpretation, you can modify the source so that these messages read like
  35. <quote>Sending processes started by init the TERM signal</quote> instead:</para>
  36. <screen><userinput>sed -i 's@Sending processes@&amp; started by init@g' \
  37. src/init.c</userinput></screen>
  38. <para>Compile Sysvinit:</para>
  39. <screen><userinput>make -C src</userinput></screen>
  40. <para>Then install it:</para>
  41. <screen><userinput>make -C src install</userinput></screen>
  42. </sect2>
  43. <sect2 id="conf-sysvinit" role="configuration"><title>Configuring Sysvinit</title>
  44. <indexterm zone="conf-sysvinit">
  45. <primary sortas="a-Sysvinit">Sysvinit</primary>
  46. <secondary>configuring</secondary></indexterm>
  47. <indexterm zone="conf-sysvinit"><primary sortas="e-/etc/inittab">/etc/inittab</primary></indexterm>
  48. <para>Create a new <filename>/etc/inittab</filename> file by running the
  49. following:</para>
  50. <screen><userinput>cat &gt; /etc/inittab &lt;&lt; "EOF"
  51. # Begin /etc/inittab
  52. id:3:initdefault:
  53. si::sysinit:/etc/rc.d/init.d/rc sysinit
  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 -I '\033(K' tty1 9600
  64. 2:2345:respawn:/sbin/agetty -I '\033(K' tty2 9600
  65. 3:2345:respawn:/sbin/agetty -I '\033(K' tty3 9600
  66. 4:2345:respawn:/sbin/agetty -I '\033(K' tty4 9600
  67. 5:2345:respawn:/sbin/agetty -I '\033(K' tty5 9600
  68. 6:2345:respawn:/sbin/agetty -I '\033(K' tty6 9600
  69. # End /etc/inittab
  70. EOF</userinput></screen>
  71. <para> The <parameter>-I '\033(K'</parameter> switch tells <command>agetty</command> to send this escape sequence to
  72. the terminal before doing anything else. This escape sequence switches the
  73. console character set to a user-defined one, which can be modified by
  74. running the <command>setfont</command> program.
  75. Actually, the <command>console</command> initscript from the LFS-Bootscripts
  76. package calls the <command>setfont</command> program during system
  77. startup. Sending this escape sequence is necessary for
  78. people who use non-ISO-8859-1 screen font, but does not hurt native English
  79. speakers.</para>
  80. </sect2>
  81. <sect2 id="contents-sysvinit" role="content"><title>Contents of Sysvinit</title>
  82. <segmentedlist>
  83. <segtitle>Installed programs</segtitle>
  84. <seglistitem><seg>halt, init, killall5, last, lastb (link to last), mesg, pidof (link to
  85. killall5), poweroff (link to halt), reboot (link to halt), runlevel, shutdown, sulogin, telinit
  86. (link to init), utmpdump and wall</seg></seglistitem>
  87. </segmentedlist>
  88. <variablelist><title>Short descriptions</title>
  89. <varlistentry id="halt">
  90. <term><command>halt</command></term>
  91. <listitem>
  92. <indexterm zone="ch-system-sysvinit halt"><primary sortas="b-halt">halt</primary></indexterm>
  93. <para>normally invokes <command>shutdown</command> with the <parameter>-h</parameter> flag,
  94. except when already in run-level 0, then it tells the kernel to halt the system.
  95. But first it notes in the file <filename>/var/log/wtmp</filename> that the
  96. system is being brought down.</para>
  97. </listitem>
  98. </varlistentry>
  99. <varlistentry id="init">
  100. <term><command>init</command></term>
  101. <listitem>
  102. <indexterm zone="ch-system-sysvinit init"><primary sortas="b-init">init</primary></indexterm>
  103. <para>is the mother of all processes. It reads its
  104. commands from <filename>/etc/inittab</filename>, which normally tell it which
  105. scripts to run for which run-level, and how many gettys to spawn.</para>
  106. </listitem>
  107. </varlistentry>
  108. <varlistentry id="killall5">
  109. <term><command>killall5</command></term>
  110. <listitem>
  111. <indexterm zone="ch-system-sysvinit killall5"><primary sortas="b-killall5">killall5</primary></indexterm>
  112. <para>sends a signal to all processes, except the processes in its own session --
  113. so it won't kill the shell running the script that called it.</para>
  114. </listitem>
  115. </varlistentry>
  116. <varlistentry id="last">
  117. <term><command>last</command></term>
  118. <listitem>
  119. <indexterm zone="ch-system-sysvinit last"><primary sortas="b-last">last</primary></indexterm>
  120. <para>shows which users last logged in (and out),
  121. searching back through the file <filename>/var/log/wtmp</filename>. It can
  122. also show system boots and shutdowns, and run-level changes.</para>
  123. </listitem>
  124. </varlistentry>
  125. <varlistentry id="lastb">
  126. <term><command>lastb</command></term>
  127. <listitem>
  128. <indexterm zone="ch-system-sysvinit lastb"><primary sortas="b-lastb">lastb</primary></indexterm>
  129. <para>shows the failed login attempts, as logged in
  130. <filename>/var/log/btmp</filename>.</para>
  131. </listitem>
  132. </varlistentry>
  133. <varlistentry id="mesg">
  134. <term><command>mesg</command></term>
  135. <listitem>
  136. <indexterm zone="ch-system-sysvinit mesg"><primary sortas="b-mesg">mesg</primary></indexterm>
  137. <para>controls whether other users can send
  138. messages to the current user's terminal.</para>
  139. </listitem>
  140. </varlistentry>
  141. <varlistentry id="pidof">
  142. <term><command>pidof</command></term>
  143. <listitem>
  144. <indexterm zone="ch-system-sysvinit pidof"><primary sortas="b-pidof">pidof</primary></indexterm>
  145. <para>reports the PIDs of the given programs.</para>
  146. </listitem>
  147. </varlistentry>
  148. <varlistentry id="poweroff">
  149. <term><command>poweroff</command></term>
  150. <listitem>
  151. <indexterm zone="ch-system-sysvinit poweroff"><primary sortas="b-poweroff">poweroff</primary></indexterm>
  152. <para>tells the kernel to halt the system and
  153. switch off the computer. But see <command>halt</command>.</para>
  154. </listitem>
  155. </varlistentry>
  156. <varlistentry id="reboot">
  157. <term><command>reboot</command></term>
  158. <listitem>
  159. <indexterm zone="ch-system-sysvinit reboot"><primary sortas="b-reboot">reboot</primary></indexterm>
  160. <para>tells the kernel to reboot the system. But see <command>halt</command>.</para>
  161. </listitem>
  162. </varlistentry>
  163. <varlistentry id="runlevel">
  164. <term><command>runlevel</command></term>
  165. <listitem>
  166. <indexterm zone="ch-system-sysvinit runlevel"><primary sortas="b-runlevel">runlevel</primary></indexterm>
  167. <para>reports the previous and the current run-level, as noted in the last run-level
  168. record in <filename>/var/run/utmp</filename>.</para>
  169. </listitem>
  170. </varlistentry>
  171. <varlistentry id="shutdown">
  172. <term><command>shutdown</command></term>
  173. <listitem>
  174. <indexterm zone="ch-system-sysvinit shutdown"><primary sortas="b-shutdown">shutdown</primary></indexterm>
  175. <para>brings the system down in a secure way,
  176. signaling all processes and notifying all logged-in users.</para>
  177. </listitem>
  178. </varlistentry>
  179. <varlistentry id="sulogin">
  180. <term><command>sulogin</command></term>
  181. <listitem>
  182. <indexterm zone="ch-system-sysvinit sulogin"><primary sortas="b-sulogin">sulogin</primary></indexterm>
  183. <para>allows the superuser to log in. It is
  184. normally invoked by <command>init</command> when the system goes into single user mode.</para>
  185. </listitem>
  186. </varlistentry>
  187. <varlistentry id="telinit">
  188. <term><command>telinit</command></term>
  189. <listitem>
  190. <indexterm zone="ch-system-sysvinit telinit"><primary sortas="b-telinit">telinit</primary></indexterm>
  191. <para>tells <command>init</command> which run-level to enter.</para>
  192. </listitem>
  193. </varlistentry>
  194. <varlistentry id="utmpdump">
  195. <term><command>utmpdump</command></term>
  196. <listitem>
  197. <indexterm zone="ch-system-sysvinit utmpdump"><primary sortas="b-utmpdump">utmpdump</primary></indexterm>
  198. <para>displays the content of the given login file in a friendlier format.</para>
  199. </listitem>
  200. </varlistentry>
  201. <varlistentry id="wall">
  202. <term><command>wall</command></term>
  203. <listitem>
  204. <indexterm zone="ch-system-sysvinit wall"><primary sortas="b-wall">wall</primary></indexterm>
  205. <para>writes a message to all logged-in users.</para>
  206. </listitem>
  207. </varlistentry>
  208. </variablelist>
  209. </sect2>
  210. </sect1>