The Boot Process
GRUB
GRUB has become the default boot loader for Red Hat & Debian as well. GRUB can be used to boot into different operating systems (usually called a multiboot system), for system recovery, and to boot the kernel using special parameters. When GRUB loads you are given a list of kernels from which you can choose to boot from. There is also a list of commands which you can select from.
e -> edit the commands before booting
a -> modify the kernel arguments before booting
c -> grub command line
Although working with GRUB can save you time to diagnose system boot issues make sure that you record all changes to /boot/grub/grub.conf otherwise your changes will be lost on next boot. On Red Hat the /etc/grub.conf is actually a link to /boot/grub/grub.conf so all changes will be made to the same file.
The Kernel
After GRUB has loaded the kernel takes over and begins to initialize and configure the computer's hardware. depending on how your GRUB configuration file is setup you may or may not see anything during this process. The "quiet" parameter in GRUB hides this process from the user (usually a gaphic of some sort is shown in its place). All the information gathered during this processes is logged to /var/log/dmesg. You can also use the dmesg tool to query information about bootup messages. Once the systems drivers are in place the kernel will execute the /sbin/init program.
The init Program
The init program is the first process that is created by the kernel. It is responsible for the rest of the boot process and setting up the environment for the user. First it will call /etc/rd.d/rc.sysinit which is responsible for a number of tasks including setting the system clock, networking, user environment, and others. After is it finished, the init command then runs the /etc/inittab script. This script defines how all services should be handle in each runlevel as well as which run level to boot the system into. In Red Hat and CentOs the default runlevel is 5 while Debian is 2. The last thing you will see is the screen to login, which will either be a virtual terminal (if no X window is configured) or a GUI login.
Runlevels
The runlevel system helps organize services which create a standard for controlling system services. There are six runlevels which can be found in /etc/inittab.
0 - Halt
1 - Singe-user mode
2 - Multi-user with partial services
3 - Full multi-user with networking (text mode)
4 - Not used
5 - Full multi-user graphical mode (provides a GUI desktop login)
6 - Reboot
Located in the /etc/rc.d/ directory there are different directories containing which services should be started or stoped at each runlevel. There are three utilities that are provided to manage services during system boot. The first is the chkconfig command.
chkconfig --list [service-name]
If you specify no service it will list all services and their status at each run level. You can narrow this down and look at a particular service by specifing the service name. You will see that each service is either "on" or "off" at each runlevel respresenting a started or not started state. This utility can also be used to enable or disable services at each runlevel.
chkconfig --level
The second utility is ntsysv. Instead of modifying each indivual service at the command line you can use this command to modify multiple services at multiple runlevels at once.
ntsysv [--level ]
For example if I wanted to modify all services at runlevels 3 & 4 I would type:
ntsysv --level 34
This utility produces a list of all services which can be checked or unchecked to either start or stop that at the runlevels that you specified. That last utility that you can use is system-config-services. This utility is a GUI program that can't be launch from a system that without a GUI. Similar to ntsysv it provides a listing of services which can be easily modified to each runlevel. You should now be pretty comfortable with the boot process and have an idea of how you can go about troubleshooting should your system not boot correctly.
No comments:
Post a Comment