| 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 |   %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 |   </sect2>
 | 
|---|
| 23 | 
 | 
|---|
| 24 |   <sect2 role="installation">
 | 
|---|
| 25 |     <title>Installation of Sysvinit</title>
 | 
|---|
| 26 | 
 | 
|---|
| 27 |     <para os ="a">Apply a <command>sed</command> to disable several programs
 | 
|---|
| 28 |     from being built and installed as better versions are provided by
 | 
|---|
| 29 |     other packages:</para>
 | 
|---|
| 30 | 
 | 
|---|
| 31 | <screen os="b"><userinput>sed -i -e 's/\ sulogin[^ ]*//' -e 's/pidof\.8//' -e '/ln .*pidof/d' \
 | 
|---|
| 32 |     -e '/utmpdump/d' -e '/mountpoint/d' -e '/mesg/d' src/Makefile</userinput></screen>
 | 
|---|
| 33 | 
 | 
|---|
| 34 |     <para os ="c">Compile the package:</para>
 | 
|---|
| 35 | 
 | 
|---|
| 36 | <screen os="d"><userinput>make -C src clobber
 | 
|---|
| 37 | make -C src</userinput></screen>
 | 
|---|
| 38 | 
 | 
|---|
| 39 |     <para os="e">Install the package:</para>
 | 
|---|
| 40 | 
 | 
|---|
| 41 | <screen os="f"><userinput>make -C src install</userinput></screen>
 | 
|---|
| 42 | 
 | 
|---|
| 43 |   </sect2>
 | 
|---|
| 44 | 
 | 
|---|
| 45 |   <sect2 id="conf-sysvinit" role="configuration">
 | 
|---|
| 46 |     <title>Configuring Sysvinit</title>
 | 
|---|
| 47 | 
 | 
|---|
| 48 |     <indexterm zone="conf-sysvinit">
 | 
|---|
| 49 |       <primary sortas="a-Sysvinit">Sysvinit</primary>
 | 
|---|
| 50 |     <secondary>configuring</secondary></indexterm>
 | 
|---|
| 51 | 
 | 
|---|
| 52 |     <indexterm zone="conf-sysvinit">
 | 
|---|
| 53 |       <primary sortas="e-/etc/inittab">/etc/inittab</primary>
 | 
|---|
| 54 |     </indexterm>
 | 
|---|
| 55 | 
 | 
|---|
| 56 |     <para>Create a new file <filename>/etc/inittab</filename> by running the
 | 
|---|
| 57 |     following:</para>
 | 
|---|
| 58 | 
 | 
|---|
| 59 | <screen><userinput>cat > /etc/inittab << "EOF"
 | 
|---|
| 60 | <literal># Begin /etc/inittab
 | 
|---|
| 61 | 
 | 
|---|
| 62 | id:3:initdefault:
 | 
|---|
| 63 | 
 | 
|---|
| 64 | si::sysinit:/etc/rc.d/init.d/rc sysinit
 | 
|---|
| 65 | 
 | 
|---|
| 66 | l0:0:wait:/etc/rc.d/init.d/rc 0
 | 
|---|
| 67 | l1:S1:wait:/etc/rc.d/init.d/rc 1
 | 
|---|
| 68 | l2:2:wait:/etc/rc.d/init.d/rc 2
 | 
|---|
| 69 | l3:3:wait:/etc/rc.d/init.d/rc 3
 | 
|---|
| 70 | l4:4:wait:/etc/rc.d/init.d/rc 4
 | 
|---|
| 71 | l5:5:wait:/etc/rc.d/init.d/rc 5
 | 
|---|
| 72 | l6:6:wait:/etc/rc.d/init.d/rc 6
 | 
|---|
| 73 | 
 | 
|---|
| 74 | ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
 | 
|---|
| 75 | 
 | 
|---|
| 76 | su:S016:once:/sbin/sulogin
 | 
|---|
| 77 | </literal>
 | 
|---|
| 78 | EOF</userinput></screen>
 | 
|---|
| 79 | 
 | 
|---|
| 80 |     <para>The following command adds the standard virtual terminals to
 | 
|---|
| 81 |     <filename>/etc/inittab</filename>. If your system only has a serial
 | 
|---|
| 82 |     console skip the following command:</para>
 | 
|---|
| 83 | 
 | 
|---|
| 84 | <screen><userinput>cat >> /etc/inittab << "EOF"
 | 
|---|
| 85 | <literal>1:2345:respawn:/sbin/agetty --noclear -I '\033(K' tty1 9600
 | 
|---|
| 86 | 2:2345:respawn:/sbin/agetty --noclear -I '\033(K' tty2 9600
 | 
|---|
| 87 | 3:2345:respawn:/sbin/agetty --noclear -I '\033(K' tty3 9600
 | 
|---|
| 88 | 4:2345:respawn:/sbin/agetty --noclear -I '\033(K' tty4 9600
 | 
|---|
| 89 | 5:2345:respawn:/sbin/agetty --noclear -I '\033(K' tty5 9600
 | 
|---|
| 90 | 6:2345:respawn:/sbin/agetty --noclear -I '\033(K' tty6 9600
 | 
|---|
| 91 | </literal>
 | 
|---|
| 92 | EOF</userinput></screen>
 | 
|---|
| 93 | 
 | 
|---|
| 94 |     <para>If your system has a serial console run the following command to add
 | 
|---|
| 95 |     the entry to <filename>/etc/inittab</filename>:</para>
 | 
|---|
| 96 | 
 | 
|---|
| 97 | <screen><userinput>cat >> /etc/inittab << "EOF"
 | 
|---|
| 98 | <literal>c0:12345:respawn:/sbin/agetty --noclear 115200 ttyS0 vt100
 | 
|---|
| 99 | </literal>
 | 
|---|
| 100 | EOF</userinput></screen>
 | 
|---|
| 101 | 
 | 
|---|
| 102 |    <para>Finally, add the end line to <filename>/etc/inittab</filename>:</para>
 | 
|---|
| 103 | 
 | 
|---|
| 104 | <screen><userinput>cat >> /etc/inittab << "EOF"
 | 
|---|
| 105 | <literal># End /etc/inittab</literal>
 | 
|---|
| 106 | EOF</userinput></screen>
 | 
|---|
| 107 | 
 | 
|---|
| 108 |     <para>The <parameter>-I '\033(K'</parameter> option tells
 | 
|---|
| 109 |     <command>agetty</command> to send this escape sequence to the terminal
 | 
|---|
| 110 |     before doing anything else. This escape sequence switches the console
 | 
|---|
| 111 |     character set to a user-defined one, which can be modified by running
 | 
|---|
| 112 |     the <command>setfont</command> program. The <command>i18n</command>
 | 
|---|
| 113 |     initscript from the CLFS-Bootscripts package calls the
 | 
|---|
| 114 |     <command>setfont</command> program during system startup. Sending this
 | 
|---|
| 115 |     escape sequence is necessary for people who use non-ISO 8859-1 screen
 | 
|---|
| 116 |     fonts, but it does not affect native English speakers.</para>
 | 
|---|
| 117 | 
 | 
|---|
| 118 |   </sect2>
 | 
|---|
| 119 | 
 | 
|---|
| 120 |   <sect2 id="contents-sysvinit" role="content">
 | 
|---|
| 121 |     <title>Contents of Sysvinit</title>
 | 
|---|
| 122 | 
 | 
|---|
| 123 |     <segmentedlist>
 | 
|---|
| 124 |       <segtitle>Installed programs</segtitle>
 | 
|---|
| 125 | 
 | 
|---|
| 126 |       <seglistitem>
 | 
|---|
| 127 |         <seg>bootlogd, fstab-decode, halt, init, killall5, poweroff
 | 
|---|
| 128 |         (link to halt), reboot (link to halt), runlevel, shutdown, telinit
 | 
|---|
| 129 |         (link to init)</seg>
 | 
|---|
| 130 |       </seglistitem>
 | 
|---|
| 131 |     </segmentedlist>
 | 
|---|
| 132 | 
 | 
|---|
| 133 |     <variablelist>
 | 
|---|
| 134 |       <bridgehead renderas="sect3">Short Descriptions</bridgehead>
 | 
|---|
| 135 |       <?dbfo list-presentation="list"?>
 | 
|---|
| 136 |       <?dbhtml list-presentation="table"?>
 | 
|---|
| 137 | 
 | 
|---|
| 138 |       <varlistentry id="bootlogd">
 | 
|---|
| 139 |         <term><command>bootlogd</command></term>
 | 
|---|
| 140 |         <listitem>
 | 
|---|
| 141 |           <para>Logs boot messages to a log file</para>
 | 
|---|
| 142 |           <indexterm zone="ch-system-sysvinit bootlogd">
 | 
|---|
| 143 |             <primary sortas="b-bootlogd">bootlogd</primary>
 | 
|---|
| 144 |           </indexterm>
 | 
|---|
| 145 |         </listitem>
 | 
|---|
| 146 |       </varlistentry>
 | 
|---|
| 147 | 
 | 
|---|
| 148 |       <varlistentry id="fstab-decode">
 | 
|---|
| 149 |         <term><command>fstab-decode</command></term>
 | 
|---|
| 150 |         <listitem>
 | 
|---|
| 151 |           <para>Runs a command with fstab-encoded arguments</para>
 | 
|---|
| 152 |           <indexterm zone="ch-system-sysvinit fstab-decode">
 | 
|---|
| 153 |             <primary sortas="b-fstab-decode">fstab-decode</primary>
 | 
|---|
| 154 |           </indexterm>
 | 
|---|
| 155 |         </listitem>
 | 
|---|
| 156 |       </varlistentry>
 | 
|---|
| 157 | 
 | 
|---|
| 158 |       <varlistentry id="halt">
 | 
|---|
| 159 |         <term><command>halt</command></term>
 | 
|---|
| 160 |         <listitem>
 | 
|---|
| 161 |           <para>Normally invokes <command>shutdown</command> with the
 | 
|---|
| 162 |           <parameter>-h</parameter> option, except when already in run-level 0,
 | 
|---|
| 163 |           then it tells the kernel to halt the system; it notes in the
 | 
|---|
| 164 |           file <filename>/var/log/wtmp</filename> that the system is being
 | 
|---|
| 165 |           brought down</para>
 | 
|---|
| 166 |           <indexterm zone="ch-system-sysvinit halt">
 | 
|---|
| 167 |             <primary sortas="b-halt">halt</primary>
 | 
|---|
| 168 |           </indexterm>
 | 
|---|
| 169 |         </listitem>
 | 
|---|
| 170 |       </varlistentry>
 | 
|---|
| 171 | 
 | 
|---|
| 172 |       <varlistentry id="init">
 | 
|---|
| 173 |         <term><command>init</command></term>
 | 
|---|
| 174 |         <listitem>
 | 
|---|
| 175 |           <para>The first process to be started when the kernel has initialized
 | 
|---|
| 176 |           the hardware which takes over the boot process and starts all the
 | 
|---|
| 177 |           proceses it is instructed to</para>
 | 
|---|
| 178 |           <indexterm zone="ch-system-sysvinit init">
 | 
|---|
| 179 |             <primary sortas="b-init">init</primary>
 | 
|---|
| 180 |           </indexterm>
 | 
|---|
| 181 |         </listitem>
 | 
|---|
| 182 |       </varlistentry>
 | 
|---|
| 183 | 
 | 
|---|
| 184 |       <varlistentry id="killall5">
 | 
|---|
| 185 |         <term><command>killall5</command></term>
 | 
|---|
| 186 |         <listitem>
 | 
|---|
| 187 |           <para>Sends a signal to all processes, except the processes in its own
 | 
|---|
| 188 |           session so it will not kill the shell running the script that called
 | 
|---|
| 189 |           it</para>
 | 
|---|
| 190 |           <indexterm zone="ch-system-sysvinit killall5">
 | 
|---|
| 191 |             <primary sortas="b-killall5">killall5</primary>
 | 
|---|
| 192 |           </indexterm>
 | 
|---|
| 193 |         </listitem>
 | 
|---|
| 194 |       </varlistentry>
 | 
|---|
| 195 | 
 | 
|---|
| 196 |       <varlistentry id="poweroff">
 | 
|---|
| 197 |         <term><command>poweroff</command></term>
 | 
|---|
| 198 |         <listitem>
 | 
|---|
| 199 |           <para>Tells the kernel to halt the system and switch off the computer
 | 
|---|
| 200 |           (see <command>halt</command>)</para>
 | 
|---|
| 201 |           <indexterm zone="ch-system-sysvinit poweroff">
 | 
|---|
| 202 |             <primary sortas="b-poweroff">poweroff</primary>
 | 
|---|
| 203 |           </indexterm>
 | 
|---|
| 204 |         </listitem>
 | 
|---|
| 205 |       </varlistentry>
 | 
|---|
| 206 | 
 | 
|---|
| 207 |       <varlistentry id="reboot">
 | 
|---|
| 208 |         <term><command>reboot</command></term>
 | 
|---|
| 209 |         <listitem>
 | 
|---|
| 210 |           <para>Tells the kernel to reboot the system (see
 | 
|---|
| 211 |           <command>halt</command>)</para>
 | 
|---|
| 212 |           <indexterm zone="ch-system-sysvinit reboot">
 | 
|---|
| 213 |             <primary sortas="b-reboot">reboot</primary>
 | 
|---|
| 214 |           </indexterm>
 | 
|---|
| 215 |         </listitem>
 | 
|---|
| 216 |       </varlistentry>
 | 
|---|
| 217 | 
 | 
|---|
| 218 |       <varlistentry id="runlevel">
 | 
|---|
| 219 |         <term><command>runlevel</command></term>
 | 
|---|
| 220 |         <listitem>
 | 
|---|
| 221 |           <para>Reports the previous and the current run-level, as noted in
 | 
|---|
| 222 |           the last run-level record in <filename>/run/utmp</filename></para>
 | 
|---|
| 223 |           <indexterm zone="ch-system-sysvinit runlevel">
 | 
|---|
| 224 |             <primary sortas="b-runlevel">runlevel</primary>
 | 
|---|
| 225 |           </indexterm>
 | 
|---|
| 226 |         </listitem>
 | 
|---|
| 227 |       </varlistentry>
 | 
|---|
| 228 | 
 | 
|---|
| 229 |       <varlistentry id="shutdown">
 | 
|---|
| 230 |         <term><command>shutdown</command></term>
 | 
|---|
| 231 |         <listitem>
 | 
|---|
| 232 |           <para>Brings the system down in a secure way, signaling all processes
 | 
|---|
| 233 |           and notifying all logged-in users</para>
 | 
|---|
| 234 |           <indexterm zone="ch-system-sysvinit shutdown">
 | 
|---|
| 235 |             <primary sortas="b-shutdown">shutdown</primary>
 | 
|---|
| 236 |           </indexterm>
 | 
|---|
| 237 |         </listitem>
 | 
|---|
| 238 |       </varlistentry>
 | 
|---|
| 239 | 
 | 
|---|
| 240 |       <varlistentry id="telinit">
 | 
|---|
| 241 |         <term><command>telinit</command></term>
 | 
|---|
| 242 |         <listitem>
 | 
|---|
| 243 |           <para>Tells <command>init</command> which run-level to change to</para>
 | 
|---|
| 244 |           <indexterm zone="ch-system-sysvinit telinit">
 | 
|---|
| 245 |             <primary sortas="b-telinit">telinit</primary>
 | 
|---|
| 246 |           </indexterm>
 | 
|---|
| 247 |         </listitem>
 | 
|---|
| 248 |       </varlistentry>
 | 
|---|
| 249 | 
 | 
|---|
| 250 |     </variablelist>
 | 
|---|
| 251 | 
 | 
|---|
| 252 |   </sect2>
 | 
|---|
| 253 | 
 | 
|---|
| 254 | </sect1>
 | 
|---|