May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Categories

May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Booting Process of Linux Redhat & Centos

You have to keep in mind when you installed Linux that the installation process prompted you for a list of partitions & the sizes of each in which your filesystems would be placed.

1. When apportioning disk space for the partitions, the first sector, or knowledge unit, for each partition is always reserved for programmable code used in booting. The first sector of the hard disk is reserved for the same purpose & is called the master boot record (MBR).

When booting from a hard disk, the PC process BIOS lots & executes the boot loader code in the MBR. The MBR then needs to know which partitions on the disk have boot loader code specific to their operating systems in their boot sectors & then attempts to boot of them.

2.

Fedora Linux is supplied with the GRUB boot loader which is sophisticated & therefore cannot entirely slot in the 512 bytes of the MBR. The GRUB MBR boot loader merely searches for a special boot partition & lots a second stage boot loader. This then reads the knowledge in the /boot/grub/grub.conf configuration file, which lists all the available operating systems & their booting parameters. When this is complete, the second stage boot loader then displays the familiar Fedora branded splash screen that lists all the configured operating process kernels for your choice.

Note: In some operating systems, such as Debian / Ubuntu, the /boot/grub/grub.conf file may even be referred to by the name /boot/grub/menu.lst.

Figure 7-1 shows a typical grub.conf file for a process that can boot both Fedora Linux & Windows 2000.

Note: In some operating systems, such as Debian / Ubuntu, the /boot/grub/grub.conf file may also be referred to by the name /boot/grub/menu.lst.

Figure 7-1 shows a typical grub.conf file for a system that can boot both Fedora Linux and Windows 2000.

Figure 7-1 Sample grub.conf file
default=0
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
title Fedora Core (2.6.8-1.521)
root (hd0,0)
kernel /vmlinuz-2.6.8-1.521 ro root=LABEL=/
initrd /initrd-2.6.8-1.521.img
title Windows 2000
rootnoverify (hd0,1)
chainloader +1

3.
Learning how Linux boots up is critical. When you have this knowledge you can use it to fine-tune the type of login screen you get as well as which programs start up. Read on for the details.

The Linux Boot Sequence

When Linux begins to boot with its kernel, it first runs the /sbin/init program, which does some process checks, such as verifying the integrity of the file systems, and starts vital programs needed for the operating process to function properly. It then inspects the /etc/inittab file to select Linux’s overall mode of operation or runlevel. A listing of valid runlevels can be seen in Table 7-1.

Table 7-1 Linux Runlevels
Mode Directory Run Level Description
0 /etc/rc.d/rc0.d Halt
1 /etc/rc.d/rc1.d Single-user mode
2 /etc/rc.d/rc2.d Not used (user-definable)
3 /etc/rc.d/rc3.d Full multi-user mode (no GUI interface)
4 /etc/rc.d/rc4.d Not used (user-definable)
5 /etc/rc.d/rc5.d Full multiuser mode (with GUI interface)
6 /etc/rc.d/rc6.d Reboot

4.

Based on the chosen runlevel, the init technique then executes startup scripts located in subdirectories of the /etc/rc.d listing. Scripts used for runlevels 0 to 6 can be present in subdirectories /etc/rc.d/rc0.d through /etc/rc.d/rc6.d, respectively.
Here is a directory listing of the scripts in the /etc/rc.d/rc3.d directory:

[root@bigboy tmp]# ls /etc/rc.d/rc3.d
… … K75netfs K96pcmcia … …
… … K86nfslock S05kudzu … …
… … K87portmap S09wlan … …
… … K91isdn S10network … …
… … K92iptables S12syslog … …
… … K95firstboot S17keytable … …
[

As you can see, each filename in these directories either starts with an “S” which signifies the script ought to be run at startup, or a K, which means the script ought to be run when the method is shutting down. If a script is not there, it won’t be run.

5.
Most Linux packages place their startup script in the /etc/init.d listing and place symbolic links (pointers) to this script in the appropriate subdirectory of /etc/rc.d. This makes file management a lot simpler. The deletion of a link doesn’t delete the file, which can then be used for another day.

The number that follows the K or S specifies the position in which the scripts ought to be run in ascending order. In our example, kudzu with a value 05 will be started before wlan with a value of 09. Fortunately you don’t must be a scripting/symbolic linking guru to make sure everything works right because Fedora comes with a nifty utility called chkconfig while Debian / Ubuntu makes use of the update-rc.d command to do it all for you. This is explained later.
Determining the Default Boot runlevel

# Default runlevel. The runlevels used by RHS are:
# 0 – halt (Do NOT set initdefault to this)
# 1 – Single user mode
# 2 – Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 – Full multiuser mode
# 4 – unused
# 5 – X11
# 6 – reboot (Do NOT set initdefault to this)
id:3:initdefault: # Console Text Mode
id:5:initdefault: # Console GUI Mode

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>