all architectures. This chapter focuses on the x86 architecture.
When an x86 computer is booted, the processor looks at the end of system memory for the Basic Input/Output System or BIOS permanent memory and is always available for use.
Other platforms use different programs to perform low-level tasks roughly equivalent to those of the BIOS on an x86 system. For instance, Itanium-based computers use the Extensible Firmware Interface (EFI) Shell, while Alpha systems use the SRM console.
present for bootable media, then, failing that, looks to the system's hard drives. In most cases, the order of the drives searched while booting is controlled with a setting in BIOS, and it looks on the master IDE device on the primary IDE bus. The BIOS then loads into memory whatever program is residing in the first sector of this device, called the Master Boot Record or MBR. The MBR is only 512 bytes in size and contains machine code instructions for booting the machine, called a boot loader, along with the partition table. Once the BIOS finds and loads the boot loader program into memory, it yields control of the boot process to it.
This section looks at the boot loaders for the x86 platform. Depending on the system's architecture, the boot process may differ slightly. Please see Section 1.2.2.1 Boot Loaders for Other Architectures for a brief overview of non-x86 boot loaders.
Under Red Hat Linux two boot loaders are available: GRUB or LILO. GRUB is the default boot loader, but LILO is available for those who require or prefer it. For more information about configuring and using GRUB or LILO, see Chapter 2 Boot Loaders.
Both boot loaders for the x86 platform are broken into at least two stages. The first stage is a small machine code binary on the MBR. Its sole job is to locate the second stage boot loader and load the first part of it into memory.
GRUB is the newer boot loader and has the advantage of being able read ext2 and ext3 [1] partitions and load its configuration file — /boot/grub/grub.conf — at boot time. See Section 2.7 GRUB Menu Configuration File for information on how to edit this file.
manually upgraded, the /sbin/lilo -v -v command must be executed to write the appropriate information to the MBR. For details on doing this, see Section 2.8 LILO.
![]() | Tip |
|---|---|
If upgrading the kernel using the Red Hat Update Agent, the boot loader configuration file is updated automatically. More information on Red Hat Network can be found online at the following URL: https://rhn.redhat.com. |
Once the second stage boot loader is in memory, it presents the user
with the Red Hat Linux initial, graphical screen showing the different
operating systems or kernels it has been configured to boot. On this
screen a user can use the arrow keys to choose which operating system
or kernel they wish to boot and press
![]() | Note |
|---|---|
linux, which is the SMP kernel, and linux-up, which is for single processors. GRUB displays Red Hat Linux (<kernel-version>-smp), which is the SMP kernel, and Red Hat Linux (<kernel-version>), which is for single processors. If any problems occur using the SMP kernel, try selecting the a non-SMP kernel upon rebooting. |
Once the second stage boot loader has determined which kernel to boot, it locates the corresponding kernel binary in the /boot/ directory. The kernel binary is named using the following format — /boot/vmlinuz-<kernel-version> file (where <kernel-version> corresponds to the kernel version specified in the boot loader's settings).
For instructions on using the boot loader to supply command line arguments to the kernel, see Chapter 2 Boot Loaders. For information on changing the runlevel at the GRUB or LILO prompt, see Section 2.10 Changing Runlevels at Boot Time.
The boot loader then places the appropriate initial RAM disk image, called an initrd, into memory. The initrd[2].
![]() | Warning |
|---|---|
Do not remove the /initrd/ directory from the file system for any reason. Removing this directory will cause the system to fail with a kernel panic error message at boot time. |
Once the kernel and the initrd image are loaded into memory, the boot loader hands control of the boot process to the kernel.
For a more detailed overview of the GRUB and LILO boot loaders, see Chapter 2 Boot Loaders.
Once the Red Hat Linux kernel loads and hands off the boot process to the init
For example, the Alpha architecture uses the aboot boot loader, while the Itanium architecture uses the ELILO boot loader.
Consult the Red Hat Linux Installation Guide specific to these platforms for information on configuring their boot loaders.
and storage devices. It then looks for the compressed initrd RAID before unmounting the initrd disk image and freeing up all the memory the disk image once occupied.
The kernel then creates a root device, mounts the root partition read-only, and frees any unused memory.
In order to set up the user environment, the kernel executes the /sbin/init program.
The /sbin/init program (also called init) coordinates the rest of the boot process and configures the environment for the user.
When the init command starts, it becomes the parent or grandparent of all of the processes that start up automatically on a Red Hat Linux system. First, it runs the /etc/rc.d/rc.sysinit script, which sets the environment path, starts swap, checks the file systems, and takes care of everything the system needs to have done at system initialization. For example, most systems use a clock, so on them rc.sysinit reads the /etc/sysconfig/clock configuration file to initialize the hardware clock. Another example is if there are special serial port processes which must be initialized, rc.sysinit will execute the /etc/rc.serial file.
The init command then runs the /etc/inittab script, which describes how the system should be set up in each SysV init runlevel [3]. Among other things, the /etc/inittab sets the default runlevel and dictates that /sbin/update should be run whenever it starts a given runlevel [4].
Next, the init command sets the source function library, /etc/rc.d/init.d/functions, for the system. This spells out how to start or kill a program and how to determine the PID of a program.
The init program starts all of the background processes by looking in the appropriate rc directory for the runlevel specified as default in /etc/inittab. The rc directories are numbered to corresponds to the runlevel they represent. For instance, /etc/rc.d/rc5.d/ is the directory for runlevel 5.
When booting to runlevel 5, the init program looks in the /etc/rc.d/rc5.d/ directory to determine which processes to start and stop.
Below is an example listing of the /etc/rc.d/rc5.d/ directory:
> ../init.d/innd K05saslauthd -> ../init.d/saslauthd K10psacct -> ../init.d/psacct K12cWnn -> ../init.d/cWnn K12FreeWnn -> ../init.d/FreeWnn K12kWnn -> ../init.d/kWnn K12mysqld -> ../init.d/mysqld K12tWnn -> ../init.d/tWnn K15httpd -> ../init.d/httpd K15postgresql -> ../init.d/postgresql K16rarpd -> ../init.d/rarpd K20bootparamd -> ../init.d/bootparamd K20iscsi -> ../init.d/iscsi K20netdump-server -> ../init.d/netdump-server K20nfs -> ../init.d/nfs K20rstatd -> ../init.d/rstatd K20rusersd -> ../init.d/rusersd K20rwalld -> ../init.d/rwalld K20rwhod -> ../init.d/rwhod K24irda -> ../init.d/irda K25squid -> ../init.d/squid K28amd -> ../init.d/amd K34dhcrelay -> ../init.d/dhcrelay K34yppasswdd -> ../init.d/yppasswdd K35atalk -> ../init.d/atalk K35dhcpd -> ../init.d/dhcpd K35smb -> ../init.d/smb K35vncserver -> ../init.d/vncserver K35winbind -> ../init.d/winbind K40mars-nwe -> ../init.d/mars-nwe K45arpwatch -> ../init.d/arpwatch K45named -> ../init.d/named K45smartd -> ../init.d/smartd K46radvd -> ../init.d/radvd K50netdump -> ../init.d/netdump K50snmpd -> ../init.d/snmpd K50snmptrapd -> ../init.d/snmptrapd K50tux -> ../init.d/tux K54pxe -> ../init.d/pxe K55routed -> ../init.d/routed K61ldap -> ../init.d/ldap K65identd -> ../init.d/identd K65kadmin -> ../init.d/kadmin K65kprop -> ../init.d/kprop K65krb524 -> ../init.d/krb524 K65krb5kdc -> ../init.d/krb5kdc K70aep1000 -> ../init.d/aep1000 K70bcm5820 -> ../init.d/bcm5820 K74ntpd -> ../init.d/ntpd K74ups -> ../init.d/ups K74ypserv -> ../init.d/ypserv K74ypxfrd -> ../init.d/ypxfrd K84bgpd -> ../init.d/bgpd K84ospf6d -> ../init.d/ospf6d K84ospfd -> ../init.d/ospfd K84ripd -> ../init.d/ripd K84ripngd -> ../init.d/ripngd K85zebra -> ../init.d/zebra K90isicom -> ../init.d/isicom K92ipvsadm -> ../init.d/ipvsadm K95firstboot -> ../init.d/firstboot S00microcode_ctl -> ../init.d/microcode_ctl S05kudzu -> ../init.d/kudzu S08ip6tables -> ../init.d/ip6tables S08ipchains -> ../init.d/ipchains S08iptables -> ../init.d/iptables S09isdn -> ../init.d/isdn S10network -> ../init.d/network S12syslog -> ../init.d/syslog S13portmap -> ../init.d/portmap S14nfslock -> ../init.d/nfslock S17keytable -> ../init.d/keytable S20random -> ../init.d/random S24pcmcia -> ../init.d/pcmcia S25netfs -> ../init.d/netfs S26apmd -> ../init.d/apmd S28autofs -> ../init.d/autofs S44acpid -> ../init.d/acpid S55sshd -> ../init.d/sshd S56rawdevices -> ../init.d/rawdevices S56xinetd -> ../init.d/xinetd S80sendmail -> ../init.d/sendmail S80spamassassin -> ../init.d/spamassassin S84privoxy -> ../init.d/privoxy S85gpm -> ../init.d/gpm S90canna -> ../init.d/canna S90crond -> ../init.d/crond S90cups -> ../init.d/cups S90xfs -> ../init.d/xfs S95anacron -> ../init.d/anacron S95atd -> ../init.d/atd S97rhnsd -> ../init.d/rhnsd S99local -> ../rc.local S99mdmonitor -> ../init.d/mdmonitor |
As illustrated in this listing, none of the scripts that actually start and stop the services are located in the /etc/rc.d/rc5.d/ directory. Rather, all of the files in /etc/rc.d/rc5.d/ are symbolic links pointing to scripts located in the /etc/rc.d/init.d/ directory. Symbolic links are used in each of the rc directories so that the runlevels can be reconfigured by creating, modifying, and deleting the symbolic links without affecting the actual scripts they reference.
The name of each symbolic link begin with either a K or an S. The K links are processes that are killed on that runlevel, while those beginning with an S are started.
The init command first stops all of the K symbolic links in the directory by issuing the /etc/rc.d/init.d/<command> stop command, where <command> is the process to be killed. It then starts all of the S symbolic links by issuing /etc/rc.d/init.d/<command> start.
![]() | Tip |
|---|---|
After the system is finished booting, it is possible to log in as root and execute these same scripts to start and stop services. For instance, the command /etc/rc.d/init.d/httpd stop will stop the Apache Web server. |
it is started. Those symbolic links with the same number are started alphabetically.
![]() | Note |
|---|---|
One of the last things the init program executes is the /etc/rc.d/rc.local file. This file is useful for system customization. See Section 1.3 Running Additional Programs at Boot Time for more on using the rc.local file. |
After the init command has progressed through the appropriate rc directory for the runlevel, the /etc/inittab script forks a /sbin/mingetty 0 and 6 get none. The /sbin/mingetty process opens communication pathways to tty devices [5], sets their modes, prints the login prompt, gets the user name, and initiates the login process for the user.
In runlevel 5, the /etc/inittab runs a script called /etc/X11/prefdm. The prefdm script executes the preferred X display manager — gdm, kdm, or xdm, depending on the contents of the /etc/sysconfig/desktop file.
At this point, the system is operating on runlevel 5 and displaying a login screen.
| [1] | GRUB reads ext3 file systems as ext2, disregarding the journal file. See the chapter titled The ext3 File System in the Red Hat Linux Customization Guide for more information on the ext3 file system. |
| [2] | For details on making an initrd, see the chapter titled The ext3 File System in the Red Hat Linux Customization Guide. |
| [3] | For more information on SysV init runlevels, see Section 1.4 SysV Init Runlevels. |
| [4] | The update command is used to flush dirty buffers back to disk. |
| [5] | See Section 5.3.11 /proc/tty/ for more information on tty devices. |
| Главная |