
60 Chapter 3. Boot Process, Init, and Shutdown
rhnsd. The last thing init does is run /etc/rc.d/rc.local to run any special scripts configured
for that host. At this point, the system is considered to be operating at runlevel 5.
After init has progressed through all of the runlevels, the /etc/inittab script forks a getty
process for each virtual console (login prompts) for each runlevel (runlevels 2 through 5 get all six;
runlevel 1, which is single user mode, only gets one console; runlevels 0 and 6 get no virtual consoles).
Basically, getty opens lines to tty devices
1
, sets their modes, prints the login prompt, gets the user’s
name, and then initiates a login process for that user. This allows users to authenticate themselves to
the system and begin to use it.
Also, /etc/inittab tells init how to handle a user hitting [Ctrl]-[Alt]-[Delete] at the console.
By default under Red Hat Linux, /etc/inittab instructs init to execute the command
/sbin/shutdown -t3 -r now, which cleanly shuts down the system and helps prevent disk
corruption.
In addition, /etc/inittab states what init should do in case of power failures, if your system has
a UPS unit attached to it.
In runlevel 5, /etc/inittab runs a script called /etc/X11/prefdm. The prefdm script runs the
preferred X display manager (gdm if you are running GNOME or kdm if you are running KDE based
on the contents of the /etc/sysconfig/desktop directory.
At this point, you should be looking at a login prompt. All that, and it only took a few seconds.
3.2.3. SysV Init
The SysV init is the standard init process used under Red Hat Linux to control the startup of software
at boot time, because it is easier to use and more powerful and flexible than the traditional BSD init.
SysV init also differs from BSD init in that the configuration files are in the /etc/rc.d/ directory
instead of residing directly in /etc/. In the /etc/rc.d/ directory, you will find rc, rc.local,
rc.sysinit, and the following directories:
init.d
rc0.d
rc1.d
rc2.d
rc3.d
rc4.d
rc5.d
rc6.d
SysV init represents each of the init runlevels with a separate directory, using init and symbolic links
in each of the directories to actually stop and start the services as the system moves from runlevel to
runlevel.
In summary, the chain of events for a SysV init boot is as follows:
1. The kernel looks in the /sbin/ directory for the init command.
2. init runs the /etc/rc.d/rc.sysinit script.
3. rc.sysinit handles most of the boot loader’s processes and then runs rc.serial (if it exists).
4. init runs all the scripts for the default runlevel.
5. init runs the /etc/rc.d/rc.local script.
The default runlevel is decided in /etc/inittab. You should have a line close to the top like:
1. See Section 2.3.10 for more information on tty devices.
Commenti su questo manuale