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