From 0cda8984a835f37a573c0e2eb31676ff52773d16 Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Tue, 2 Aug 2011 02:15:42 +0000 Subject: Rewrite bootscripts and Chaper 7 git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@9574 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- chapter07/usage.xml | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 2 deletions(-) (limited to 'chapter07/usage.xml') diff --git a/chapter07/usage.xml b/chapter07/usage.xml index 334c471b7..a679381c5 100644 --- a/chapter07/usage.xml +++ b/chapter07/usage.xml @@ -37,7 +37,80 @@ 5: same as 4, it is usually used for GUI login (like X's xdm or KDE's kdm) 6: reboot the computer - The command used to change run-levels is init + + Configuring Sysvinit + + + Sysvinit + configuring + + + + /etc/inittab + + + During the kernel initialization, the first program that is run + is either specified on the command line or, by default + init. This program reads the initialization file + /etc/inittab. Create this file with: + +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 + +1:2345:respawn:/sbin/agetty tty1 9600 +2:2345:respawn:/sbin/agetty tty2 9600 +3:2345:respawn:/sbin/agetty tty3 9600 +4:2345:respawn:/sbin/agetty tty4 9600 +5:2345:respawn:/sbin/agetty tty5 9600 +6:2345:respawn:/sbin/agetty tty6 9600 + +# End /etc/inittab +EOF + + An explanation of this initialization file is in the man page for + inittab. For LFS, the key command that is run is + rc. The intialization file above will instruct + rc to run all the scripts starting with an S in the + /etc/rc.d/rcsysinit.d directory + followed by all the scripts starting with an S in the /etc/rc.d/rc?.d directory where the question + mark is specified by the initdefault value. + + As a convenience, the rc script reads a library of + functions in /lib/boot/functions. + This library also reads an optional configuration file, + /etc/sysconfig/init_params. Any of the system + configuration file parameters described in subsequent sections can be + alternatively placed in this file allowing consolidation of all system + parameters in thsi one file. + + As a debugging convenience, the functions script also logs all output + to /run/var/bootlog. Since the /run directory is a tmpfs, this file is not + persistent across boots. + + + + + Changing Run Levels + + Changing run-levels is done with init <runlevel>, where <runlevel> is the target run-level. For example, to reboot the computer, a user could issue the init 6 command, @@ -59,7 +132,7 @@ The real scripts are in /etc/rc.d/init.d. They do the actual work, and - the symlinks all point to them. Killing links and starting links point to + the symlinks all point to them. K links and S links point to the same script in /etc/rc.d/init.d. This is because the scripts can be called with different parameters like start, stop, @@ -126,4 +199,6 @@ it is your own LFS system). The files given here are an example of how it can be done. + + -- cgit v1.2.3-54-g00ecf