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