10.58. Sysvinit-2.88dsf

The Sysvinit package contains programs for controlling the startup, running, and shutdown of the system.

10.58.1. Installation of Sysvinit

Apply a sed which disables sulogin, mountpoint, wall, and utmpdump from being built and installed as they are provided by Util-linux:

sed -i -e 's/\ sulogin[^ ]*//' \
    -e '/utmpdump/d' -e '/mountpoint/d' src/Makefile

Compile the package:

make -C src clobber
make -C src

Install the package:

make -C src install

10.58.2. Configuring Sysvinit

Create a new file /etc/inittab by running the following:

cat > /etc/inittab << "EOF"
# Begin /etc/inittab

id:3:initdefault:

si::sysinit:/etc/rc.d/init.d/rc sysinit

l0:0:wait:/etc/rc.d/init.d/rc 0
l1:S1:wait:/etc/rc.d/init.d/rc 1
l2:2:wait:/etc/rc.d/init.d/rc 2
l3:3:wait:/etc/rc.d/init.d/rc 3
l4:4:wait:/etc/rc.d/init.d/rc 4
l5:5:wait:/etc/rc.d/init.d/rc 5
l6:6:wait:/etc/rc.d/init.d/rc 6

ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now

su:S016:once:/sbin/sulogin

EOF

The following command adds the standard virtual terminals to /etc/inittab. If your system only has a serial console skip the following command:

cat >> /etc/inittab << "EOF"
1:2345:respawn:/sbin/agetty --noclear -I '\033(K' tty1 9600
2:2345:respawn:/sbin/agetty --noclear -I '\033(K' tty2 9600
3:2345:respawn:/sbin/agetty --noclear -I '\033(K' tty3 9600
4:2345:respawn:/sbin/agetty --noclear -I '\033(K' tty4 9600
5:2345:respawn:/sbin/agetty --noclear -I '\033(K' tty5 9600
6:2345:respawn:/sbin/agetty --noclear -I '\033(K' tty6 9600

EOF

If your system has a serial console run the following command to add the entry to /etc/inittab:

cat >> /etc/inittab << "EOF"
c0:12345:respawn:/sbin/agetty --noclear 115200 ttyS0 vt100

EOF

Finally, add the end line to /etc/inittab:

cat >> /etc/inittab << "EOF"
# End /etc/inittab
EOF

The -I '\033(K' option tells agetty to send this escape sequence to the terminal before doing anything else. This escape sequence switches the console character set to a user-defined one, which can be modified by running the setfont program. The console initscript from the CLFS-Bootscripts package calls the setfont program during system startup. Sending this escape sequence is necessary for people who use non-ISO 8859-1 screen fonts, but it does not affect native English speakers.

10.58.3. Contents of Sysvinit

Installed programs: bootlogd, fstab-decode, halt, init, killall5, last, lastb (link to last), mesg, pidof (link to killall5), poweroff (link to halt), reboot (link to halt), runlevel, shutdown, and telinit (link to init)

Short Descriptions

bootlogd

Logs boot messages to a log file

fstab-decode

Runs a command with fstab-encoded arguments

halt

Normally invokes shutdown with the -h option, except when already in run-level 0, then it tells the kernel to halt the system; it notes in the file /var/log/wtmp that the system is being brought down

init

The first process to be started when the kernel has initialized the hardware which takes over the boot process and starts all the proceses it is instructed to

killall5

Sends a signal to all processes, except the processes in its own session so it will not kill the shell running the script that called it

last

Shows which users last logged in (and out), searching back through the /var/log/wtmp file; it also shows system boots, shutdowns, and run-level changes

lastb

Shows the failed login attempts, as logged in /var/log/btmp

mesg

Controls whether other users can send messages to the current user's terminal

pidof

Reports the PIDs of the given programs

poweroff

Tells the kernel to halt the system and switch off the computer (see halt)

reboot

Tells the kernel to reboot the system (see halt)

runlevel

Reports the previous and the current run-level, as noted in the last run-level record in /var/run/utmp

shutdown

Brings the system down in a secure way, signaling all processes and notifying all logged-in users

telinit

Tells init which run-level to change to