Troubleshooting Red Hat Linux   «Prev  Next»

Lesson 4System boot scripts
ObjectiveList Linux system boot scripts and their functions.

System boot scripts

The entire Linux boot process is governed by a series of scripts in the
/etc/rc.d/
directory, outlined in the following list:
  1. /etc/rc.d/rc.sysinit
    

    The main system initialization script. This brings your machine up to an initial usable level; it is extremely unlikely that you will need to interact with this script directly.
  2. /etc/rc.d/rc.local
    

    The system-local initialization script. This script performs a few system-local tasks; again, you will probably not need to interact with this script.
  3. /etc/rc.d/init.d/*
    

    Within the /etc/rc.d/init.d/* directory are a series of service-specific initialization scripts. For example,
    /etc/rc.d/init.d/sendmail
    
    controls the sendmail process.
  4. /etc/rc.d/rc?.d/*
    

    Run-level symbolic links that automatically call service-specific initialization scripts during boot and shutdown according to the system run level.
What is the purpose of the rc.sysinit
Note: A service's runlevel can be configured by using the Runlevel Editor accessed via the Control Panel.


System boot

During the system's first stage of booting, you will see messages from the /etc/rc.d/rc.sysinit script. Most errors from this stage are kernel errors, which will be logged to /var/log/dmesg. Some messages may, however, be logged to /var/log/messages. If you encounter kernel errors, they are probably due to a hardware problem. Note: Consult the hardware's documentation or the Linux HOWTOs for specific hardware troubleshooting guidelines. It may be necessary for you to build a customized kernel to get your hardware to work properly.

System V init scripts

The system then runs scripts in the /etc/rc.d/init.d directory. This directory, which is kept in a System V[1] init structure, holds all the commands necessary to control boot processes and subsystems. As the system starts these scripts, you'll see either OK or FAIL, indicating whether the service started successfully or not. If there is an error, you should find some explanation in the system log file /var/log/messages.
If, after boot, you need to control a process or subsystem that started at boot time, use these scripts. For example, suppose you configured your Red Hat Linux system to start the Apache Web server, httpd, at boot. If you need to control this process in some way, you should use the System V init scripts. You can perform a standard set of actions with the commands listed below:
  1. status
    Display whether the service is running.
  2. startStart the service.
  3. stopStop the service.
  4. restartStop the service, if it is running, and then restart it.
  5. reloadMake the service reload its configuration; this may involve restarting.
For example, to restart httpd after a configuration change, issue the command:
/etc/rc.d/init.d/httpd restart

To completely stop httpd, you should use
/etc/rc.d/init.d/httpd stop

Finally, after the system scripts in /etc/rc.d/init.d run, the /etc/rc.d/rc.local is run.
The next lesson describes common user login problems and their solutions.

System Boot Problems - Quiz

Before moving on to the next lesson, click the Quiz link below to check your understanding of boot problems.
System Boot Problems - Quiz

[1]System V: System V is an early version of UNIX that defined many characteristics of modern UNIX implementations.