6.51. Installing Sysvinit-2.83

Estimated build time:           1 minute
Estimated required disk space:  630 KB

6.51.1. Installation of Sysvinit

When run levels are changed (for example when going to shutdown the system) the init program is going to send the TERM and KILL signals to all the processes that init started. But init prints a message to the screen saying "sending all processes the TERM signal" and the same for the KILL signal. This implies that init sends this signal to all the currently running processes, which isn't the case. To avoid this confusion, you change the init.c file so that the sentence reads "sending all processes started by init the TERM signal" by running the following commands. If you don't want to change it, skip it.

cp src/init.c src/init.c.backup &&
sed 's/\(.*\)\(Sending processes\)\(.*\)/\1\2 started by init\3/' \
   src/init.c > tmp~ &&
mv tmp~ src/init.c

Install Sysvinit by running the following commands:

make -C src &&
make -C src install

6.51.2. Contents

The Sysvinit package contains the halt, init, killall5, last, lastb, mesg, pidof, poweroff, reboot, runlevel, shutdown, sulogin, telinit, utmpdump, wall,

6.51.3. Description

6.51.3.1. halt

Halt notes that the system is being brought down in the file /var/log/wtmp, and then either tells the kernel to halt, reboot or poweroff the system. If halt or reboot is called when the system is not in runlevel 0 or 6, shutdown will be invoked instead (with the flag -h or -r).

6.51.3.2. init

Init is the parent of all processes. Its primary role is to create processes from a script stored in the file /etc/inittab. This file usually has entries which cause init to spawn gettys on each line that users can log in. It also controls autonomous processes required by any particular system.

6.51.3.3. killall5

killall5 is the SystemV killall command. It sends a signal to all processes except the processes in its own session, so it won't kill the shell that is running the script it was called from.

6.51.3.4. last

last searches back through the file /var/log/wtmp (or the file designated by the -f flag) and displays a list of all users logged in (and out) since that file was created.

6.51.3.5. lastb

lastb is the same as last, except that by default it shows a log of the file /var/log/btmp, which contains all the bad login attempts.

6.51.3.6. mesg

Mesg controls the access to the users terminal by others. It's typically used to allow or disallow other users to write to his terminal.

6.51.3.7. pidof

Pidof finds the process id's (pids) of the named programs and prints those id's on standard output.

6.51.3.8. poweroff

poweroff is equivalent to shutdown -h -p now. It halts the computer and switches off the computer (when using an APM compliant BIOS and APM is enabled in the kernel).

6.51.3.9. reboot

reboot is equivalent to shutdown -r now. It reboots the computer.

6.51.3.10. runlevel

Runlevel reads the system utmp file (typically /var/run/utmp) to locate the runlevel record, and then prints the previous and current system runlevel on its standard output, separated by a single space.

6.51.3.11. shutdown

shutdown brings the system down in a secure way. All logged-in users are notified that the system is going down, and login is blocked.

6.51.3.12. sulogin

sulogin is invoked by init when the system goes into single user mode (this is done through an entry in /etc/inittab). Init also tries to execute sulogin when it is passed the -b flag from the boot loader (eg, LILO).

6.51.3.13. telinit

telinit sends appropriate signals to init, telling it which runlevel to change to.

6.51.3.14. utmpdump

utmpdumps prints the content of a file (usually /var/run/utmp) on standard output in a user friendly format.

6.51.3.15. wall

Wall sends a message to everybody logged in with their mesg permission set to yes.

6.51.4. Dependencies

Sysvinit-2.82 needs the following to be installed:


sh from the bash package

as from the binutils package
ld from the binutils package

chown from the fileutils package
install from the fileutils package
ln from the fileutils package
mknod from the fileutils package
rm from the fileutils package

cc from the gcc package

make from the make package

patch from the patch package