| 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
 | 
|---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
 | 
|---|
| 3 |   "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
 | 
|---|
| 4 |   <!ENTITY % general-entities SYSTEM "../../general.ent">
 | 
|---|
| 5 |   %general-entities;
 | 
|---|
| 6 | ]>
 | 
|---|
| 7 | <sect1 id="ch-system-sysvinit" role="wrap">
 | 
|---|
| 8 |   <?dbhtml filename="sysvinit.html"?>
 | 
|---|
| 9 | 
 | 
|---|
| 10 |   <title>Sysvinit-&sysvinit-version;</title>
 | 
|---|
| 11 | 
 | 
|---|
| 12 |   <indexterm zone="ch-system-sysvinit">
 | 
|---|
| 13 |     <primary sortas="a-Sysvinit">Sysvinit</primary>
 | 
|---|
| 14 |   </indexterm>
 | 
|---|
| 15 | 
 | 
|---|
| 16 |   <sect2 role="package">
 | 
|---|
| 17 |     <title/>
 | 
|---|
| 18 | 
 | 
|---|
| 19 |     <para>The Sysvinit package contains programs for controlling the startup,
 | 
|---|
| 20 |     running, and shutdown of the system.</para>
 | 
|---|
| 21 | 
 | 
|---|
| 22 |     <segmentedlist>
 | 
|---|
| 23 |       <segtitle>&dependencies;</segtitle>
 | 
|---|
| 24 | 
 | 
|---|
| 25 |       <seglistitem>
 | 
|---|
| 26 |         <seg>Binutils, Coreutils, GCC, Glibc, and Make</seg>
 | 
|---|
| 27 |       </seglistitem>
 | 
|---|
| 28 |     </segmentedlist>
 | 
|---|
| 29 | 
 | 
|---|
| 30 |   </sect2>
 | 
|---|
| 31 | 
 | 
|---|
| 32 |   <sect2 role="installation">
 | 
|---|
| 33 |     <title>Installation of Sysvinit</title>
 | 
|---|
| 34 | 
 | 
|---|
| 35 |     <para os="a">When run-levels are changed (for example, when halting the
 | 
|---|
| 36 |     system), <command>init</command> sends termination signals to those
 | 
|---|
| 37 |     processes that <command>init</command> itself started and that should
 | 
|---|
| 38 |     not be running in the new run-level.  While doing this,
 | 
|---|
| 39 |     <command>init</command> outputs messages like <quote>Sending processes
 | 
|---|
| 40 |     the TERM signal</quote> which seem to imply that it is sending these
 | 
|---|
| 41 |     signals to all currently running processes. To avoid this
 | 
|---|
| 42 |     misinterpretation, modify the source so that these messages read like
 | 
|---|
| 43 |     <quote>Sending processes started by init the TERM signal</quote>
 | 
|---|
| 44 |     instead:</para>
 | 
|---|
| 45 | 
 | 
|---|
| 46 | <screen os="b"><userinput>sed -i 's@Sending processes@& started by init@g' \
 | 
|---|
| 47 |     src/init.c</userinput></screen>
 | 
|---|
| 48 | 
 | 
|---|
| 49 |     <para os="c">Compile the package:</para>
 | 
|---|
| 50 | 
 | 
|---|
| 51 | <screen os="d"><userinput>make -C src clobber
 | 
|---|
| 52 | make -C src</userinput></screen>
 | 
|---|
| 53 | 
 | 
|---|
| 54 |     <para os="e">Install the package:</para>
 | 
|---|
| 55 | 
 | 
|---|
| 56 | <screen os="f"><userinput>make -C src install</userinput></screen>
 | 
|---|
| 57 | 
 | 
|---|
| 58 |   </sect2>
 | 
|---|
| 59 | 
 | 
|---|
| 60 |   <sect2 id="conf-sysvinit" role="configuration">
 | 
|---|
| 61 |     <title>Configuring Sysvinit</title>
 | 
|---|
| 62 | 
 | 
|---|
| 63 |     <indexterm zone="conf-sysvinit">
 | 
|---|
| 64 |       <primary sortas="a-Sysvinit">Sysvinit</primary>
 | 
|---|
| 65 |     <secondary>configuring</secondary></indexterm>
 | 
|---|
| 66 | 
 | 
|---|
| 67 |     <indexterm zone="conf-sysvinit">
 | 
|---|
| 68 |       <primary sortas="e-/etc/inittab">/etc/inittab</primary>
 | 
|---|
| 69 |     </indexterm>
 | 
|---|
| 70 | 
 | 
|---|
| 71 |     <para>Create a new file <filename>/etc/inittab</filename> by running the
 | 
|---|
| 72 |     following:</para>
 | 
|---|
| 73 | 
 | 
|---|
| 74 | <screen><userinput>cat > /etc/inittab << "EOF"
 | 
|---|
| 75 | <literal># Begin /etc/inittab
 | 
|---|
| 76 | 
 | 
|---|
| 77 | id:3:initdefault:
 | 
|---|
| 78 | 
 | 
|---|
| 79 | si::sysinit:/etc/rc.d/init.d/rc sysinit
 | 
|---|
| 80 | 
 | 
|---|
| 81 | l0:0:wait:/etc/rc.d/init.d/rc 0
 | 
|---|
| 82 | l1:S1:wait:/etc/rc.d/init.d/rc 1
 | 
|---|
| 83 | l2:2:wait:/etc/rc.d/init.d/rc 2
 | 
|---|
| 84 | l3:3:wait:/etc/rc.d/init.d/rc 3
 | 
|---|
| 85 | l4:4:wait:/etc/rc.d/init.d/rc 4
 | 
|---|
| 86 | l5:5:wait:/etc/rc.d/init.d/rc 5
 | 
|---|
| 87 | l6:6:wait:/etc/rc.d/init.d/rc 6
 | 
|---|
| 88 | 
 | 
|---|
| 89 | ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
 | 
|---|
| 90 | 
 | 
|---|
| 91 | su:S016:once:/sbin/sulogin
 | 
|---|
| 92 | 
 | 
|---|
| 93 | 1:2345:respawn:/sbin/agetty -I '\033(K' tty1 9600
 | 
|---|
| 94 | 2:2345:respawn:/sbin/agetty -I '\033(K' tty2 9600
 | 
|---|
| 95 | 3:2345:respawn:/sbin/agetty -I '\033(K' tty3 9600
 | 
|---|
| 96 | 4:2345:respawn:/sbin/agetty -I '\033(K' tty4 9600
 | 
|---|
| 97 | 5:2345:respawn:/sbin/agetty -I '\033(K' tty5 9600
 | 
|---|
| 98 | 6:2345:respawn:/sbin/agetty -I '\033(K' tty6 9600
 | 
|---|
| 99 | 
 | 
|---|
| 100 | # End /etc/inittab</literal>
 | 
|---|
| 101 | EOF</userinput></screen>
 | 
|---|
| 102 | 
 | 
|---|
| 103 |     <para>The <parameter>-I '\033(K'</parameter> option tells
 | 
|---|
| 104 |     <command>agetty</command> to send this escape sequence to the terminal
 | 
|---|
| 105 |     before doing anything else. This escape sequence switches the console
 | 
|---|
| 106 |     character set to a user-defined one, which can be modified by running
 | 
|---|
| 107 |     the <command>setfont</command> program. The <command>console</command>
 | 
|---|
| 108 |     initscript from the LFS-Bootscripts package calls the
 | 
|---|
| 109 |     <command>setfont</command> program during system startup. Sending this
 | 
|---|
| 110 |     escape sequence is necessary for people who use non-ISO 8859-1 screen
 | 
|---|
| 111 |     fonts, but it does not affect native English speakers.</para>
 | 
|---|
| 112 | 
 | 
|---|
| 113 |   </sect2>
 | 
|---|
| 114 | 
 | 
|---|
| 115 |   <sect2 id="contents-sysvinit" role="content">
 | 
|---|
| 116 |     <title>Contents of Sysvinit</title>
 | 
|---|
| 117 | 
 | 
|---|
| 118 |     <segmentedlist>
 | 
|---|
| 119 |       <segtitle>Installed programs</segtitle>
 | 
|---|
| 120 | 
 | 
|---|
| 121 |       <seglistitem>
 | 
|---|
| 122 |         <seg>halt, init, killall5, last, lastb (link to last), mesg, pidof
 | 
|---|
| 123 |         (link to killall5), poweroff (link to halt), reboot (link to halt),
 | 
|---|
| 124 |         runlevel, shutdown, sulogin, telinit (link to init), utmpdump,
 | 
|---|
| 125 |         and wall</seg>
 | 
|---|
| 126 |       </seglistitem>
 | 
|---|
| 127 |     </segmentedlist>
 | 
|---|
| 128 | 
 | 
|---|
| 129 |     <variablelist>
 | 
|---|
| 130 |       <bridgehead renderas="sect3">Short Descriptions</bridgehead>
 | 
|---|
| 131 |       <?dbfo list-presentation="list"?>
 | 
|---|
| 132 |       <?dbhtml list-presentation="table"?>
 | 
|---|
| 133 | 
 | 
|---|
| 134 |       <varlistentry id="halt">
 | 
|---|
| 135 |         <term><command>halt</command></term>
 | 
|---|
| 136 |         <listitem>
 | 
|---|
| 137 |           <para>Normally invokes <command>shutdown</command> with the
 | 
|---|
| 138 |           <parameter>-h</parameter> option, except when already in run-level 0,
 | 
|---|
| 139 |           then it tells the kernel to halt the system; it notes in the
 | 
|---|
| 140 |           file <filename>/var/log/wtmp</filename> that the system is being
 | 
|---|
| 141 |           brought down</para>
 | 
|---|
| 142 |           <indexterm zone="ch-system-sysvinit halt">
 | 
|---|
| 143 |             <primary sortas="b-halt">halt</primary>
 | 
|---|
| 144 |           </indexterm>
 | 
|---|
| 145 |         </listitem>
 | 
|---|
| 146 |       </varlistentry>
 | 
|---|
| 147 | 
 | 
|---|
| 148 |       <varlistentry id="init">
 | 
|---|
| 149 |         <term><command>init</command></term>
 | 
|---|
| 150 |         <listitem>
 | 
|---|
| 151 |           <para>The first process to be started when the kernel has initialized
 | 
|---|
| 152 |           the hardware which takes over the boot process and starts all the
 | 
|---|
| 153 |           proceses it is instructed to</para>
 | 
|---|
| 154 |           <indexterm zone="ch-system-sysvinit init">
 | 
|---|
| 155 |             <primary sortas="b-init">init</primary>
 | 
|---|
| 156 |           </indexterm>
 | 
|---|
| 157 |         </listitem>
 | 
|---|
| 158 |       </varlistentry>
 | 
|---|
| 159 | 
 | 
|---|
| 160 |       <varlistentry id="killall5">
 | 
|---|
| 161 |         <term><command>killall5</command></term>
 | 
|---|
| 162 |         <listitem>
 | 
|---|
| 163 |           <para>Sends a signal to all processes, except the processes in its own
 | 
|---|
| 164 |           session so it will not kill the shell running the script that called
 | 
|---|
| 165 |           it</para>
 | 
|---|
| 166 |           <indexterm zone="ch-system-sysvinit killall5">
 | 
|---|
| 167 |             <primary sortas="b-killall5">killall5</primary>
 | 
|---|
| 168 |           </indexterm>
 | 
|---|
| 169 |         </listitem>
 | 
|---|
| 170 |       </varlistentry>
 | 
|---|
| 171 | 
 | 
|---|
| 172 |       <varlistentry id="last">
 | 
|---|
| 173 |         <term><command>last</command></term>
 | 
|---|
| 174 |         <listitem>
 | 
|---|
| 175 |           <para>Shows which users last logged in (and out), searching back
 | 
|---|
| 176 |           through the <filename>/var/log/wtmp</filename> file; it also shows
 | 
|---|
| 177 |           system boots, shutdowns, and run-level changes</para>
 | 
|---|
| 178 |           <indexterm zone="ch-system-sysvinit last">
 | 
|---|
| 179 |             <primary sortas="b-last">last</primary>
 | 
|---|
| 180 |           </indexterm>
 | 
|---|
| 181 |         </listitem>
 | 
|---|
| 182 |       </varlistentry>
 | 
|---|
| 183 | 
 | 
|---|
| 184 |       <varlistentry id="lastb">
 | 
|---|
| 185 |         <term><command>lastb</command></term>
 | 
|---|
| 186 |         <listitem>
 | 
|---|
| 187 |           <para>Shows the failed login attempts, as logged in
 | 
|---|
| 188 |           <filename>/var/log/btmp</filename></para>
 | 
|---|
| 189 |           <indexterm zone="ch-system-sysvinit lastb">
 | 
|---|
| 190 |             <primary sortas="b-lastb">lastb</primary>
 | 
|---|
| 191 |           </indexterm>
 | 
|---|
| 192 |         </listitem>
 | 
|---|
| 193 |       </varlistentry>
 | 
|---|
| 194 | 
 | 
|---|
| 195 |       <varlistentry id="mesg">
 | 
|---|
| 196 |         <term><command>mesg</command></term>
 | 
|---|
| 197 |         <listitem>
 | 
|---|
| 198 |           <para>Controls whether other users can send messages to the current
 | 
|---|
| 199 |           user's terminal</para>
 | 
|---|
| 200 |           <indexterm zone="ch-system-sysvinit mesg">
 | 
|---|
| 201 |             <primary sortas="b-mesg">mesg</primary>
 | 
|---|
| 202 |           </indexterm>
 | 
|---|
| 203 |         </listitem>
 | 
|---|
| 204 |       </varlistentry>
 | 
|---|
| 205 | 
 | 
|---|
| 206 |       <varlistentry id="pidof">
 | 
|---|
| 207 |         <term><command>pidof</command></term>
 | 
|---|
| 208 |         <listitem>
 | 
|---|
| 209 |           <para>Reports the PIDs of the given programs</para>
 | 
|---|
| 210 |           <indexterm zone="ch-system-sysvinit pidof">
 | 
|---|
| 211 |             <primary sortas="b-pidof">pidof</primary>
 | 
|---|
| 212 |           </indexterm>
 | 
|---|
| 213 |         </listitem>
 | 
|---|
| 214 |       </varlistentry>
 | 
|---|
| 215 | 
 | 
|---|
| 216 |       <varlistentry id="poweroff">
 | 
|---|
| 217 |         <term><command>poweroff</command></term>
 | 
|---|
| 218 |         <listitem>
 | 
|---|
| 219 |           <para>Tells the kernel to halt the system and switch off the computer
 | 
|---|
| 220 |           (see <command>halt</command>)</para>
 | 
|---|
| 221 |           <indexterm zone="ch-system-sysvinit poweroff">
 | 
|---|
| 222 |             <primary sortas="b-poweroff">poweroff</primary>
 | 
|---|
| 223 |           </indexterm>
 | 
|---|
| 224 |         </listitem>
 | 
|---|
| 225 |       </varlistentry>
 | 
|---|
| 226 | 
 | 
|---|
| 227 |       <varlistentry id="reboot">
 | 
|---|
| 228 |         <term><command>reboot</command></term>
 | 
|---|
| 229 |         <listitem>
 | 
|---|
| 230 |           <para>Tells the kernel to reboot the system (see
 | 
|---|
| 231 |           <command>halt</command>)</para>
 | 
|---|
| 232 |           <indexterm zone="ch-system-sysvinit reboot">
 | 
|---|
| 233 |             <primary sortas="b-reboot">reboot</primary>
 | 
|---|
| 234 |           </indexterm>
 | 
|---|
| 235 |         </listitem>
 | 
|---|
| 236 |       </varlistentry>
 | 
|---|
| 237 | 
 | 
|---|
| 238 |       <varlistentry id="runlevel">
 | 
|---|
| 239 |         <term><command>runlevel</command></term>
 | 
|---|
| 240 |         <listitem>
 | 
|---|
| 241 |           <para>Reports the previous and the current run-level, as noted in
 | 
|---|
| 242 |           the last run-level record in <filename>/var/run/utmp</filename></para>
 | 
|---|
| 243 |           <indexterm zone="ch-system-sysvinit runlevel">
 | 
|---|
| 244 |             <primary sortas="b-runlevel">runlevel</primary>
 | 
|---|
| 245 |           </indexterm>
 | 
|---|
| 246 |         </listitem>
 | 
|---|
| 247 |       </varlistentry>
 | 
|---|
| 248 | 
 | 
|---|
| 249 |       <varlistentry id="shutdown">
 | 
|---|
| 250 |         <term><command>shutdown</command></term>
 | 
|---|
| 251 |         <listitem>
 | 
|---|
| 252 |           <para>Brings the system down in a secure way, signaling all processes
 | 
|---|
| 253 |           and notifying all logged-in users</para>
 | 
|---|
| 254 |           <indexterm zone="ch-system-sysvinit shutdown">
 | 
|---|
| 255 |             <primary sortas="b-shutdown">shutdown</primary>
 | 
|---|
| 256 |           </indexterm>
 | 
|---|
| 257 |         </listitem>
 | 
|---|
| 258 |       </varlistentry>
 | 
|---|
| 259 | 
 | 
|---|
| 260 |       <varlistentry id="sulogin">
 | 
|---|
| 261 |         <term><command>sulogin</command></term>
 | 
|---|
| 262 |         <listitem>
 | 
|---|
| 263 |           <para>Allows <emphasis>root</emphasis> to log in; it is normally
 | 
|---|
| 264 |           invoked by <command>init</command> when the system goes into single
 | 
|---|
| 265 |           user mode</para>
 | 
|---|
| 266 |           <indexterm zone="ch-system-sysvinit sulogin">
 | 
|---|
| 267 |             <primary sortas="b-sulogin">sulogin</primary>
 | 
|---|
| 268 |           </indexterm>
 | 
|---|
| 269 |         </listitem>
 | 
|---|
| 270 |       </varlistentry>
 | 
|---|
| 271 | 
 | 
|---|
| 272 |       <varlistentry id="telinit">
 | 
|---|
| 273 |         <term><command>telinit</command></term>
 | 
|---|
| 274 |         <listitem>
 | 
|---|
| 275 |           <para>Tells <command>init</command> which run-level to change to</para>
 | 
|---|
| 276 |           <indexterm zone="ch-system-sysvinit telinit">
 | 
|---|
| 277 |             <primary sortas="b-telinit">telinit</primary>
 | 
|---|
| 278 |           </indexterm>
 | 
|---|
| 279 |         </listitem>
 | 
|---|
| 280 |       </varlistentry>
 | 
|---|
| 281 | 
 | 
|---|
| 282 |       <varlistentry id="utmpdump">
 | 
|---|
| 283 |         <term><command>utmpdump</command></term>
 | 
|---|
| 284 |         <listitem>
 | 
|---|
| 285 |           <para>Displays the content of the given login file in a more
 | 
|---|
| 286 |           user-friendly format</para>
 | 
|---|
| 287 |           <indexterm zone="ch-system-sysvinit utmpdump">
 | 
|---|
| 288 |             <primary sortas="b-utmpdump">utmpdump</primary>
 | 
|---|
| 289 |           </indexterm>
 | 
|---|
| 290 |         </listitem>
 | 
|---|
| 291 |       </varlistentry>
 | 
|---|
| 292 | 
 | 
|---|
| 293 |       <varlistentry id="wall">
 | 
|---|
| 294 |         <term><command>wall</command></term>
 | 
|---|
| 295 |         <listitem>
 | 
|---|
| 296 |           <para>Writes a message to all logged-in users</para>
 | 
|---|
| 297 |           <indexterm zone="ch-system-sysvinit wall">
 | 
|---|
| 298 |             <primary sortas="b-wall">wall</primary>
 | 
|---|
| 299 |           </indexterm>
 | 
|---|
| 300 |         </listitem>
 | 
|---|
| 301 |       </varlistentry>
 | 
|---|
| 302 | 
 | 
|---|
| 303 |     </variablelist>
 | 
|---|
| 304 | 
 | 
|---|
| 305 |   </sect2>
 | 
|---|
| 306 | 
 | 
|---|
| 307 | </sect1>
 | 
|---|