Vous êtes sur la page 1sur 5

Redhat - Booting

CHAPTER 8
Booting process
During the system start up there are 6 major states are there in Linux.
1. BIOS
2. MBR
3. GRUB
4. KERNEL
5. INIT
6. RUN LEVEL

BIOS
 BIOS is basic Input and Output system
 Performs the basic hardware that is required for system booting
 Searches, loads and executes the boot loader
 Once bootloader is loaded the BIOS gives control to the bootloader.
 In short BIOS locates and loades the bootloader MBR bootloader

MBR
 MBR stands for Master Boot Record
 It is located in the 1st sector of the boot disk or root disk (/dev/had, /dev/sda)
 MBR is less than 512 bytes in size. This has 3 components 1. Primary boot
loader (1 – 446 bytes) 2. Partition table information (Next 64 bytes) 3. MBR
validation check (in last 2 bytes).
 MBR contains information about GRuB (LILO in older versions)
 In short MBR loads GRuB

GRUB
 GRUB stands for GRand Unified Bootloader.
 You can choose kernel image to be executed if you have multiple images
 GRUB displays the flash screen, waits for few seconds
 Chooses the default kernel if alternate kernel image is not chosen
 GRUB have the knowledge of the filesystem.
 GRUB configuration files are /etc/grub.conf /boot/grub/grub.conf (link)

KERNEL
 Mounts the root file system as specified in “root= in grub.conf
 Kernel executes /sbin/init program
 Initrd stand for initial RAM Disk
 Initrd is used by kernel as temporary file system until kernel is booted and
the real root file system is mounted.
 Initrd contains necessary drivers which helps to access the hard drive
partitions and other hardware.

Init

Chapter 8 Page 1
Redhat - Booting

 Initd reads /etc/inittab file and starts run level


 Init identifies the default run level from /etc/inittab starts run level
 Executes ‘grep initdefault in /etc/inittab on system to identify default run
level
 Typically the default run level is 5

Run Levels
0 – halt
1-single user mode
2- Multiuser mode
3 – Full multiuser mode
4- Unused
5- Multiuser mode with desktop
6- Reboot

Run level Programs


When the Linux system is booting up, you might see various services getting started.
It might be starting crond [OK]. Those are the programs starting at specific run
level.
1. Run level 0 /etc/rc.d/rc0.d/
2. Run level 1 /etc/rc.d/rc1.d/
3. Run level 2 /etc/rc.d/rc2.d/
4. Run level 3 /etc/rc.d/rc3.d/
5. Run level 4 /etc/rc.d/rc4.d/
6. Run level 5 /etc/rc.d/rc5.d/
7. Run level 6 /etc/rc.d/rc6.d/

# who –r to see the current run level


# /boot/grub/grub.conf boot information file
# cat /etc/redhat-release to check OS release version
# arch to check architecture

Shutdown command
root@server910:/etc/init.d : shutdown --help
shutdown: invalid option -- '-'
Usage: shutdown [-akrhHPfnc] [-t secs] time [warning message]
-a: use /etc/shutdown.allow
-k: don't really shutdown, only warn.
-r: reboot after shutdown.
-h: halt after shutdown.
-P: halt action is to turn off power.
-H: halt action is to just halt.

Chapter 8 Page 2
Redhat - Booting

-f: do a 'fast' reboot (skip fsck).


-F: Force fsck on reboot.
-n: do not go through "init" but go down real fast.
-c: cancel a running shutdown.
-t secs: delay between warning and kill signal.
** the "time" argument is mandatory! (try "now") **
root@server910:/etc/init.d :

Recovering lost password in RHEL 6


1. ESC the normal boot device by moving the up and down arrow
2. Select the kernel /vmlinuz-2.6 option
3. Enter ‘e’ to enter the edit mode
4. Choose ‘1’ to go to maintenance mode
5. # getenforce to go the enforce mode
6. # setenforce 0 --- SELinux mode is changed to permissive mode.
7. Change the root password

Recovering the corrupted boot loader


GRuB might have corruted and may be need to recover.
Repairing GRuB is to reinstalling it.

Steps:
1. Insert the CD ROM
2. Boot the system with option Rescue installed system Mode
3. Choose English option menu
4. Choose ‘US’
5. Local CD/DVD
6. Start network NO
7. Choose option CONTINUE
8. Chroot /mnt/sys image
9. OK
10. Shell Start shell
11. Chroot /mnt/sysimage
12. Check the partition on which /boot is using
13. Grub-install /dev/sda2
14. Reboot

Chapter 8 Page 3
Redhat - Booting

Listing modules
 The drives in Linux is known as ‘Modules or Kernel Modules’
 Modules are assigned by kernel basing on HW
 HW can only be communicated and can work efficiently when proper module
is loaded.
 All kernel modules will be in /etc/lib/modules directory

# ls –l /etc/lib/module
# find /etc –name “*.ko”
# lsmod

# lsmod |grep –i modulename to grep a desired module


# lsmod |grep –i cdrom to grep modules of cdrom
# modeprobe –r cdrom to remove the module
# modprobe cdrom to install the module
# modinfo cdrom to see the module info

Chapter 8 Page 4
Redhat - Booting

To blacklist a module
# /etc/modprobe.d/blacklist.conf

Chapter 8 Page 5

Vous aimerez peut-être aussi