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