This section contains information on what happens when a Red Hat Linux system is booted and shut down. Let's start with information on the files in /etc/sysconfig.
The following information outlines the various files in /etc/sysconfig, their function, and their contents.
The following files are normally found in /etc/sysconfig:
Let's take a look at each one.
Currently, the correct values are:
In addition, /dev/mouse is a symlink that points to the actual mouse device.
Please Note: For compatibility with older software that people might install (such as trn), the /etc/HOSTNAME file should contain the same value as here.
(The current Red Hat Linux installation sets this to ``no'' by default (for RFC compliance), but if FORWARD_IPV4 is not set at all, forwarding is enabled for compatibility with the configuration files used on Red Hat Linux versions 4.2 and earlier.)
The following files are normally found in /etc/sysconfig/network-scripts:
Let's take a look at each one.
These scripts take one argument normally: the name of the device (e.g. ``eth0''). They are called with a second argument of ``boot'' during the boot sequence so that devices that are not meant to be brought up on boot (ONBOOT=no, see below) can be ignored at that time.
The items that can be defined in an ifcfg file depend on the interface type.
The following values are common to all base files:
The following values are common to all PPP and SLIP files:
The following values are common to all PPP files:
(This represents a simplified interface; it doesn't let people specify which characters to escape. However, almost everyone can use an asyncmap of 00000000 anyway, and it's possible to set PPPOPTIONS to use an arbitrary asyncmap if so desired.)
note that the ``remotename'' option is always specified as the logical ppp device name, like ``ppp0'' (which might perhaps be the physical device ppp1 if some other ppp device was brought up earlier...), which makes it easy to manage pap/chap files -- name/password pairs are associated with the logical ppp device name so that they can be managed together.
In principal, there shouldn't anything that would keep the logical PPP device names from being ``worldnet'' or ``myISP'' instead of ``ppp0'' -- ``pppN''.
Could be extended to fix up nameservice configuration, call arbitrary scripts, etc, as needed.
This section is a brief description of the internals of the boot process. It basically covers in detail how the machine boots using SysV init, as well as the differences between the init used in older Linux releases, and SysV init.
Init is the program that gets run by the kernel at boot time. It is in charge of starting all the normal processes that need to run at boot time. These include the gettys that allow you to log in, NFS daemons, FTP daemons, and anything else you want to run when your machine boots.
SysV init is fast becoming the standard in the Linux world to control the startup of software at boot time. This is 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 config
files are in a subdirectory of /etc instead of residing
directly in /etc. This directory is called rc.d. In
there you will find rc.sysinit and the following
directories:
init.d contains a bunch of scripts. Basically, you need one
script for each service you may need to start at boot time or when entering
another runlevel. Services include things
like networking, nfs, sendmail, httpd, etc. Services do not
include things like setserial that must only be run once and
then exited. Things like that should go in rc.local or rc.serial.
If you want rc.local, it should be in /etc/rc.d. Most systems
include one even though it doesn't do much. You can also
include an rc.serial in /etc/rc.d if you need to do serial
port specific things at boot time.
The chain of events is as follows:
The default runlevel is decided in /etc/inittab. You should
have a line close to the top like:
From this, you'd look in the second column and see that the
default runlevel is 3, as should be the case for most systems.
If you want to change it, you can edit /etc/inittab by hand
and change the 3. Be very careful when you are messing with the
inittab. If you do mess up, you can fix it by
rebooting and doing:
This should allow you to boot into single user mode so you
can fix inittab.
Now, how does it run all the right scripts? If you enter
ls -l on rc3.d, you might see something like:
What you'll notice is that there are no real ``files'' in
the directory. Everything there is a link to one of the
scripts in the init.d directory. The links also have
an ``S'' and a number at the beginning. The ``S'' means to
start this particular script and a ``K'' would mean to
stop it. The number is there just for ordering
purposes. Init will start all the services based on
the order they appear. You can duplicate numbers, but
it will only confuse you somewhat. You just need to
use a two digit number only, along with an upper
case ``S'' or ``K'' to start or stop the services you need
to.
How does init start and stop services? Simple. Each of
the scripts is written to accept an argument which
can be ``start'' and ``stop''. You can execute those
scripts by hand in fact with a command like:
to stop the httpd server. Init just reads the name
and if it has a ``K'', it calls the script with the
``stop'' argument. If it has an ``S'' it calls the script
with a ``start'' argument. Why all these runlevels?
Some people want an easy way to set up machines to be
multi-purpose. I could have a ``server'' runlevel that
just runs httpd, sendmail, networking, etc. Then I
could have a ``user'' runlevel that runs xdm, networking,
etc.
Generally, Red Hat Linux runs in run level 3---full multiuser mode.
The following runlevels are used in Red Hat Linux:
If your machine gets into a state where it will not boot due to a
bad /etc/inittab, or will not let you log in because you have a
corrupted /etc/passwd or have simply forgotten your password, boot into
single user mode by typing linux 1 at the LILO boot prompt.
A very bare system will come up and you will be given a shell from which
you can fix things.
The chkconfig utility provides a simple command-line tool for
maintaining the /etc/rc.d directory hierarchy. It relieves system
administrators from having to directly manipulate the numerous symlinks in
/etc/rc.d.
In addition, there is the ntsysv utility, that provides a
screen-oriented interface, versus Please see the chkconfig and ntsysv man pages for more
information.
The file /etc/rc.d/rc.local is executed at boot time, after all
other initialization is complete, and whenever you change runlevels.
You can add additional initialization commands here. For instance, you
may want to start up additional daemons, or initialize a printer. In
addition, if you require serial port setup, you can edit
/etc/rc.d/rc.serial, and it will be executed automatically at boot
time.
The default /etc/rc.d/rc.local simply creates a nice
login banner with your kernel version and machine type.
To shut down Red Hat Linux, issue the shutdown command.
You can read the shutdown man page for complete details, but the
two most common usages are:
Each will cleanly shutdown the system. After shutting everything
down, the first will halt the machine, and the second will reboot.
Although the reboot and halt commands are now ``smart'' enough
to invoke shutdown if run while the system is in runlevels 1-5, it is
a bad habit to get into, as not all Linux-like operating systems have this
feature.
init.d
rc0.d
rc1.d
rc2.d
rc3.d
rc4.d
rc5.d
rc6.d
id:3:initdefault:
LILO boot: linux single
lrwxrwxrwx 1 root root 17 3:11 S10network -> ../init.d/network
lrwxrwxrwx 1 root root 16 3:11 S30syslog -> ../init.d/syslog
lrwxrwxrwx 1 root root 14 3:32 S40cron -> ../init.d/cron
lrwxrwxrwx 1 root root 14 3:11 S50inet -> ../init.d/inet
lrwxrwxrwx 1 root root 13 3:11 S60nfs -> ../init.d/nfs
lrwxrwxrwx 1 root root 15 3:11 S70nfsfs -> ../init.d/nfsfs
lrwxrwxrwx 1 root root 18 3:11 S90lpd -> ../init.d/lpd.init
lrwxrwxrwx 1 root root 11 3:11 S99local -> ../rc.local
/etc/rc.d/init.d/httpd.init stop
11.9.3 Init Runlevels
11.9.4 Initscript Utilities
chkconfig's command-line interface.
11.9.5 Running Programs at Boot Time
11.9.6 Shutting Down
shutdown -h now
shutdown -r now