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