[673b0d8] | 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 | ]>
|
---|
[a001133] | 6 | <sect1 id="ch-system-sysvinit" xreflabel="Sysvinit" role="wrap">
|
---|
[673b0d8] | 7 | <title>Sysvinit-&sysvinit-version;</title>
|
---|
| 8 | <?dbhtml filename="sysvinit.html"?>
|
---|
| 9 |
|
---|
| 10 | <indexterm zone="ch-system-sysvinit"><primary sortas="a-Sysvinit">Sysvinit</primary></indexterm>
|
---|
[6370fa6] | 11 |
|
---|
[a001133] | 12 | <sect2 role="package"><title/>
|
---|
[5888299] | 13 | <para>The Sysvinit package contains programs for controlling the startup,
|
---|
| 14 | running, and shutdown of your system.</para>
|
---|
| 15 |
|
---|
[a001133] | 16 | <segmentedlist>
|
---|
| 17 | <segtitle>&buildtime;</segtitle>
|
---|
| 18 | <segtitle>&diskspace;</segtitle>
|
---|
| 19 | <seglistitem><seg>0.1 SBU</seg><seg> 0.9 MB</seg></seglistitem>
|
---|
| 20 | </segmentedlist>
|
---|
[673b0d8] | 21 |
|
---|
[a001133] | 22 | <segmentedlist>
|
---|
| 23 | <segtitle>Sysvinit installation depends on</segtitle>
|
---|
| 24 | <seglistitem><seg>Binutils, Coreutils, GCC, Glibc, Make</seg></seglistitem>
|
---|
| 25 | </segmentedlist>
|
---|
| 26 | </sect2>
|
---|
[3554fa3a] | 27 |
|
---|
[a001133] | 28 | <sect2 role="installation">
|
---|
[73aedd1d] | 29 | <title>Installation of Sysvinit</title>
|
---|
| 30 |
|
---|
[673b0d8] | 31 | <para>When run-levels are changed (for example, when halting the system),
|
---|
| 32 | <command>init</command> sends termination signals to those processes that
|
---|
| 33 | <command>init</command> itself started and that shouldn't be running in the new
|
---|
| 34 | run-level. While doing this, <command>init</command> outputs messages like
|
---|
| 35 | <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
|
---|
| 36 | misinterpretation, you can modify the source so that these messages read like
|
---|
| 37 | <quote>Sending processes started by init the TERM signal</quote> instead:</para>
|
---|
[73aedd1d] | 38 |
|
---|
| 39 | <screen><userinput>cp src/init.c{,.backup}
|
---|
[311e8a5] | 40 | sed 's/Sending processes/& started by init/g' \
|
---|
[673b0d8] | 41 | src/init.c.backup > src/init.c</userinput></screen>
|
---|
[73aedd1d] | 42 |
|
---|
| 43 | <para>Compile Sysvinit:</para>
|
---|
| 44 |
|
---|
| 45 | <screen><userinput>make -C src</userinput></screen>
|
---|
| 46 |
|
---|
[673b0d8] | 47 | <para>Then install it:</para>
|
---|
[73aedd1d] | 48 |
|
---|
| 49 | <screen><userinput>make -C src install</userinput></screen>
|
---|
| 50 |
|
---|
| 51 | </sect2>
|
---|
[5888299] | 52 |
|
---|
[342b176] | 53 |
|
---|
[df8334f] | 54 | <sect2 id="conf-sysvinit" role="configuration"><title>Configuring Sysvinit</title>
|
---|
[673b0d8] | 55 | <indexterm zone="conf-sysvinit">
|
---|
| 56 | <primary sortas="a-Sysvinit">Sysvinit</primary>
|
---|
| 57 | <secondary>configuring</secondary></indexterm>
|
---|
| 58 |
|
---|
| 59 | <indexterm zone="conf-sysvinit"><primary sortas="e-/etc/inittab">/etc/inittab</primary></indexterm>
|
---|
[342b176] | 60 |
|
---|
| 61 | <para>Create a new <filename>/etc/inittab</filename> file by running the
|
---|
| 62 | following:</para>
|
---|
| 63 |
|
---|
| 64 | <screen><userinput>cat > /etc/inittab << "EOF"</userinput>
|
---|
| 65 | # Begin /etc/inittab
|
---|
| 66 |
|
---|
| 67 | id:3:initdefault:
|
---|
| 68 |
|
---|
| 69 | si::sysinit:/etc/rc.d/init.d/rc sysinit
|
---|
| 70 |
|
---|
| 71 | l0:0:wait:/etc/rc.d/init.d/rc 0
|
---|
| 72 | l1:S1:wait:/etc/rc.d/init.d/rc 1
|
---|
| 73 | l2:2:wait:/etc/rc.d/init.d/rc 2
|
---|
| 74 | l3:3:wait:/etc/rc.d/init.d/rc 3
|
---|
| 75 | l4:4:wait:/etc/rc.d/init.d/rc 4
|
---|
| 76 | l5:5:wait:/etc/rc.d/init.d/rc 5
|
---|
| 77 | l6:6:wait:/etc/rc.d/init.d/rc 6
|
---|
| 78 |
|
---|
| 79 | ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
|
---|
| 80 |
|
---|
| 81 | su:S016:once:/sbin/sulogin
|
---|
| 82 |
|
---|
[b32e803] | 83 | 1:2345:respawn:/sbin/agetty -I '\033(K' tty1 9600
|
---|
| 84 | 2:2345:respawn:/sbin/agetty -I '\033(K' tty2 9600
|
---|
| 85 | 3:2345:respawn:/sbin/agetty -I '\033(K' tty3 9600
|
---|
| 86 | 4:2345:respawn:/sbin/agetty -I '\033(K' tty4 9600
|
---|
| 87 | 5:2345:respawn:/sbin/agetty -I '\033(K' tty5 9600
|
---|
| 88 | 6:2345:respawn:/sbin/agetty -I '\033(K' tty6 9600
|
---|
[342b176] | 89 |
|
---|
| 90 | # End /etc/inittab
|
---|
| 91 | <userinput>EOF</userinput></screen>
|
---|
| 92 |
|
---|
[b32e803] | 93 | <para> The -I '\033(K' switch tells agetty to send this escape sequence to
|
---|
| 94 | the terminal before doing anything else. This escape sequence switches the
|
---|
| 95 | console character set to a user-defined one, which can be modified by
|
---|
| 96 | running the <command>setfont</command> program.
|
---|
| 97 | Actually, the <command>console</command> initscript from the LFS-Bootscripts
|
---|
| 98 | package calls the <command>setfont</command> program during system
|
---|
| 99 | startup. Sending this escape sequence is necessary for
|
---|
| 100 | people who use non-ISO-8859-1 screen font, but does not hurt native English
|
---|
| 101 | speakers.</para>
|
---|
| 102 |
|
---|
[342b176] | 103 | </sect2>
|
---|
[5888299] | 104 |
|
---|
| 105 |
|
---|
[c6cb3aa] | 106 | <sect2 id="contents-sysvinit" role="content"><title>Contents of Sysvinit</title>
|
---|
[673b0d8] | 107 |
|
---|
[c6cb3aa] | 108 | <segmentedlist>
|
---|
| 109 | <segtitle>Installed programs</segtitle>
|
---|
| 110 | <seglistitem><seg>halt, init, killall5, last, lastb (link to last), mesg, pidof (link to
|
---|
| 111 | killall5), poweroff (link to halt), reboot (link to halt), runlevel, shutdown, sulogin, telinit
|
---|
| 112 | (link to init), utmpdump and wall</seg></seglistitem>
|
---|
| 113 | </segmentedlist>
|
---|
[673b0d8] | 114 |
|
---|
[c6cb3aa] | 115 | <variablelist><title>Short descriptions</title>
|
---|
[673b0d8] | 116 |
|
---|
[c6cb3aa] | 117 | <varlistentry>
|
---|
| 118 | <term id="halt"><command>halt</command></term>
|
---|
| 119 | <listitem>
|
---|
[673b0d8] | 120 | <indexterm zone="ch-system-sysvinit halt"><primary sortas="b-halt">halt</primary></indexterm>
|
---|
[c6cb3aa] | 121 | <para>normally invokes shutdown with the -h flag,
|
---|
[673b0d8] | 122 | except when already in run-level 0, then it tells the kernel to halt the system.
|
---|
| 123 | But first it notes in the file <filename>/var/log/wtmp</filename> that the
|
---|
| 124 | system is being brought down.</para>
|
---|
[c6cb3aa] | 125 | </listitem>
|
---|
| 126 | </varlistentry>
|
---|
[673b0d8] | 127 |
|
---|
[c6cb3aa] | 128 | <varlistentry>
|
---|
| 129 | <term id="init"><command>init</command></term>
|
---|
| 130 | <listitem>
|
---|
[673b0d8] | 131 | <indexterm zone="ch-system-sysvinit init"><primary sortas="b-init">init</primary></indexterm>
|
---|
[c6cb3aa] | 132 | <para>is the mother of all processes. It reads its
|
---|
[673b0d8] | 133 | commands from <filename>/etc/inittab</filename>, which normally tell it which
|
---|
| 134 | scripts to run for which run-level, and how many gettys to spawn.</para>
|
---|
[c6cb3aa] | 135 | </listitem>
|
---|
| 136 | </varlistentry>
|
---|
[673b0d8] | 137 |
|
---|
[c6cb3aa] | 138 | <varlistentry>
|
---|
| 139 | <term id="killall5"><command>killall5</command></term>
|
---|
| 140 | <listitem>
|
---|
[673b0d8] | 141 | <indexterm zone="ch-system-sysvinit killall5"><primary sortas="b-killall5">killall5</primary></indexterm>
|
---|
[c6cb3aa] | 142 | <para>sends a signal to all processes, except the processes in its own session --
|
---|
| 143 | so it won't kill the shell running the script that called it.</para>
|
---|
| 144 | </listitem>
|
---|
| 145 | </varlistentry>
|
---|
| 146 |
|
---|
| 147 | <varlistentry>
|
---|
| 148 | <term id="last"><command>last</command></term>
|
---|
| 149 | <listitem>
|
---|
[673b0d8] | 150 | <indexterm zone="ch-system-sysvinit last"><primary sortas="b-last">last</primary></indexterm>
|
---|
[c6cb3aa] | 151 | <para>shows which users last logged in (and out),
|
---|
[673b0d8] | 152 | searching back through the file <filename>/var/log/wtmp</filename>. It can
|
---|
| 153 | also show system boots and shutdowns, and run-level changes.</para>
|
---|
[c6cb3aa] | 154 | </listitem>
|
---|
| 155 | </varlistentry>
|
---|
[673b0d8] | 156 |
|
---|
[c6cb3aa] | 157 | <varlistentry>
|
---|
| 158 | <term id="lastb"><command>lastb</command></term>
|
---|
| 159 | <listitem>
|
---|
[673b0d8] | 160 | <indexterm zone="ch-system-sysvinit lastb"><primary sortas="b-lastb">lastb</primary></indexterm>
|
---|
[c6cb3aa] | 161 | <para>shows the failed login attempts, as logged in
|
---|
| 162 | <filename>/var/log/btmp</filename>.</para>
|
---|
| 163 | </listitem>
|
---|
| 164 | </varlistentry>
|
---|
| 165 |
|
---|
| 166 | <varlistentry>
|
---|
| 167 | <term id="mesg"><command>mesg</command></term>
|
---|
| 168 | <listitem>
|
---|
[673b0d8] | 169 | <indexterm zone="ch-system-sysvinit mesg"><primary sortas="b-mesg">mesg</primary></indexterm>
|
---|
[c6cb3aa] | 170 | <para>controls whether other users can send
|
---|
[673b0d8] | 171 | messages to the current user's terminal.</para>
|
---|
[c6cb3aa] | 172 | </listitem>
|
---|
| 173 | </varlistentry>
|
---|
[73aedd1d] | 174 |
|
---|
[c6cb3aa] | 175 | <varlistentry>
|
---|
| 176 | <term id="pidof"><command>pidof</command></term>
|
---|
| 177 | <listitem>
|
---|
[673b0d8] | 178 | <indexterm zone="ch-system-sysvinit pidof"><primary sortas="b-pidof">pidof</primary></indexterm>
|
---|
[c6cb3aa] | 179 | <para>reports the PIDs of the given programs.</para>
|
---|
| 180 | </listitem>
|
---|
| 181 | </varlistentry>
|
---|
[673b0d8] | 182 |
|
---|
[c6cb3aa] | 183 | <varlistentry>
|
---|
| 184 | <term id="poweroff"><command>poweroff</command></term>
|
---|
| 185 | <listitem>
|
---|
[673b0d8] | 186 | <indexterm zone="ch-system-sysvinit poweroff"><primary sortas="b-poweroff">poweroff</primary></indexterm>
|
---|
[c6cb3aa] | 187 | <para>tells the kernel to halt the system and
|
---|
[673b0d8] | 188 | switch off the computer. But see halt.</para>
|
---|
[c6cb3aa] | 189 | </listitem>
|
---|
| 190 | </varlistentry>
|
---|
[673b0d8] | 191 |
|
---|
[c6cb3aa] | 192 | <varlistentry>
|
---|
| 193 | <term id="reboot"><command>reboot</command></term>
|
---|
| 194 | <listitem>
|
---|
[673b0d8] | 195 | <indexterm zone="ch-system-sysvinit reboot"><primary sortas="b-reboot">reboot</primary></indexterm>
|
---|
[c6cb3aa] | 196 | <para>tells the kernel to reboot the system. But see halt.</para>
|
---|
| 197 | </listitem>
|
---|
| 198 | </varlistentry>
|
---|
[673b0d8] | 199 |
|
---|
[c6cb3aa] | 200 | <varlistentry>
|
---|
| 201 | <term id="runlevel"><command>runlevel</command></term>
|
---|
| 202 | <listitem>
|
---|
[673b0d8] | 203 | <indexterm zone="ch-system-sysvinit runlevel"><primary sortas="b-runlevel">runlevel</primary></indexterm>
|
---|
[c6cb3aa] | 204 | <para>reports the previous and the current run-level, as noted in the last run-level
|
---|
| 205 | record in <filename>/var/run/utmp</filename>.</para>
|
---|
| 206 | </listitem>
|
---|
| 207 | </varlistentry>
|
---|
| 208 |
|
---|
| 209 | <varlistentry>
|
---|
| 210 | <term id="shutdown"><command>shutdown</command></term>
|
---|
| 211 | <listitem>
|
---|
[673b0d8] | 212 | <indexterm zone="ch-system-sysvinit shutdown"><primary sortas="b-shutdown">shutdown</primary></indexterm>
|
---|
[c6cb3aa] | 213 | <para>brings the system down in a secure way,
|
---|
[673b0d8] | 214 | signaling all processes and notifying all logged-in users.</para>
|
---|
[c6cb3aa] | 215 | </listitem>
|
---|
| 216 | </varlistentry>
|
---|
[673b0d8] | 217 |
|
---|
[c6cb3aa] | 218 | <varlistentry>
|
---|
| 219 | <term id="sulogin"><command>sulogin</command></term>
|
---|
| 220 | <listitem>
|
---|
[673b0d8] | 221 | <indexterm zone="ch-system-sysvinit sulogin"><primary sortas="b-sulogin">sulogin</primary></indexterm>
|
---|
[c6cb3aa] | 222 | <para>allows the superuser to log in. It is
|
---|
[673b0d8] | 223 | normally invoked by init when the system goes into single user mode.</para>
|
---|
[c6cb3aa] | 224 | </listitem>
|
---|
| 225 | </varlistentry>
|
---|
[673b0d8] | 226 |
|
---|
[c6cb3aa] | 227 | <varlistentry>
|
---|
| 228 | <term id="telinit"><command>telinit</command></term>
|
---|
| 229 | <listitem>
|
---|
[673b0d8] | 230 | <indexterm zone="ch-system-sysvinit telinit"><primary sortas="b-telinit">telinit</primary></indexterm>
|
---|
[c6cb3aa] | 231 | <para>tells init which run-level to enter.</para>
|
---|
| 232 | </listitem>
|
---|
| 233 | </varlistentry>
|
---|
[673b0d8] | 234 |
|
---|
[c6cb3aa] | 235 | <varlistentry>
|
---|
| 236 | <term id="utmpdump"><command>utmpdump</command></term>
|
---|
| 237 | <listitem>
|
---|
[673b0d8] | 238 | <indexterm zone="ch-system-sysvinit utmpdump"><primary sortas="b-utmpdump">utmpdump</primary></indexterm>
|
---|
[c6cb3aa] | 239 | <para>displays the content of the given login file in a friendlier format.</para>
|
---|
| 240 | </listitem>
|
---|
| 241 | </varlistentry>
|
---|
[673b0d8] | 242 |
|
---|
[c6cb3aa] | 243 | <varlistentry>
|
---|
| 244 | <term id="wall"><command>wall</command></term>
|
---|
| 245 | <listitem>
|
---|
[673b0d8] | 246 | <indexterm zone="ch-system-sysvinit wall"><primary sortas="b-wall">wall</primary></indexterm>
|
---|
[c6cb3aa] | 247 | <para>writes a message to all logged-in users.</para>
|
---|
| 248 | </listitem>
|
---|
| 249 | </varlistentry>
|
---|
| 250 | </variablelist>
|
---|
[673b0d8] | 251 |
|
---|
| 252 | </sect2>
|
---|
| 253 |
|
---|
| 254 | </sect1>
|
---|