System boot process

System boot process
common startup error troubleshooting
rescue mode

Power key to turn -> BIOS POST determining the boot device, loading loader- Boot> MBR 512
|
446 64 2
Boot Loader partition table magic delimiter
|
stage1-> stage1.5-> stage2 stage1.5 is guided, It is a real boot program that loads the grub configuration file

bootloader grub boot loader main function is to identify the operating system and file format and load the kernel driver.
stage1 main program (boot program pointer is installed in the mbr), the bootloader performed
stage1.5 file system, and the bridge is stage1 stage2 the
stage2 stage1.5 is guided, is true bootstrap, i.e., loading the grub profile grub.conf

the /etc/grub.conf /boot/grub/gub.conf CAT
default = 0 // default boot the system, the first title number is 0 is the second title number. 1
timeout countdown time =. 5 //
splashimage = (hd0, 0) /grub/splash.xpm.gz // countdown is background image hd0,0 hd0 is the first hard drive first partition 0 hd0,0 first hard disk first partition
hiddenmenu // hide the menu
title Red Hat Enterprise Linux (2.6.32-431.el6.x86_64) // name system
root (hd0,0) // hd0,0 boot partition root of the first hard disk first partition
kernel /vmlinuz-2.6.32 -431.el6.x86_64 ro root = UUID = 64ee0f70-4051-41f4- ab46-aa17fd8969fe nomodeset rd_NO_LUKS KEYBOARDTYPE = pc KEYTABLE = us rd_NO_MD crashkernel = auto LANG = zh_CN.UTF-8 rd_NO_LVM rd_NO_DM rhgb quiet // the specified location of the kernel and a parameter passed to the kernel, the first / is the boot partition, not the root, is the boot partition files under / boot, behind the uuid is the real root
initrd /initramfs-2.6.32-431.el6.x86_64.img / / providing a virtual file system
|
kernel starts the first process the init
|
the init configuration file
/ etc / inittab
/etc/init/rcS.conf - /etc/rc.d/rc.sysinit system initialization file
/etc/init/rc.conf script corresponding to the level of service (/etc/rc.d script location /init.d)
/etc/rc.d/rc5.d
K S boot boot does not start
|
the last one before entering the rc.local script execution system
|
the Login
|
load graphics resources
|
the Login
|
load environment variables

The first stage: bios
case: a boot device order error
Solution: enter the bios adjustment

The second stage: GRUB
bootloader corrupted mbr of how to do?

Case:

df -h

Filesystem Size Used Avail Use% Mounted on
/dev/sda2 18G 5.3G 12G 33% /
tmpfs 931M 228K 931M 1% /dev/shm
/dev/sda1 194M 34M 150M 19% /boot
/dev/sr0 3.6G 3.6G 0 100% /mnt/redhat6u5

dd if=/dev/zero of=/dev/sda bs=1 count=400

reboot

Solution: Use the CD into rescue mode
option to skip load the network, select the shell
bash-4.1 # grub
grub> root (hd0, 0) // specify the boot partition
grub> setup (hd0) // main program to install grub mbr
grub> quit
bash-4.1 # poweroff

mbr damaged how to do? 512
system mounted on / dev / sda sda destruction of mbr
Partitioning / dev / sdb1 mount / quota
backup mbr

dd if=/dev/sda of=/quota/mbr.txt bs=1 count=512

damage

dd if=/dev/zero of=/dev/sda bs=1 count=512

reboot

Solution: Use the CD into rescue mode
option to skip load the network, select the shell
bash-4.1 # cd / mnt / sysimage
bash-4.1 # mkdir AA
bash-4.1 # Mount / dev / sdb1 AA
bash-4.1 # cd AA
bash-4.1 LS #
mbr.txt
the bash-4.1 # of mbr.txt dd = IF = / dev / SDA. 1 COUNT = 512 BS =
the bash-4.1 # reboot

grub.conf file is corrupted how to do?
Case:

df -h

Filesystem Size Used Avail Use% Mounted on
/dev/sda2 18G 5.3G 12G 33% /
tmpfs 931M 228K 931M 1% /dev/shm
/dev/sda1 194M 34M 150M 19% /boot
/dev/sr0 3.6G 3.6G 0 100% /mnt/redhat6u5

cp /etc/grub.conf /tmp

rm -rf /boot/grub/grub.conf

reboot

Solution:
GRUB> the root (hd0, 0) hd0, 0 = / dev / sda1
GRUB> Kernel /vmlinuz-2.6.32-431.el6.x86_64 the root RO = / dev / sda2
GRUB> the initrd /initramfs-2.6.32 -431.el6.x86_64.img
GRUB> the Boot

Experiments done to restore grub.conf file
cp /tmp/grub.conf / boot / grub

Crack the code:
Countdown 5 ... -> press the up and down arrow keys (to enter the grub) -> a-> Space 1-> to enter privileged mode -> Change Password or remove the password passwd vim / etc / passwd root password representatives

To encrypt grub:
make the encryption password
grub-md5-crypt

vim /etc/grub.conf
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
password --md5 dsadsfkjsadfksdkjfk //给grub加密
title Red Hat Enterprise Linux (2.6.32-431.el6.x86_64)
password --md5 dsadsfkjsadfksdkjfk //给OS加密
root (hd0,0)
kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=UUID=64ee0f70-4051-41f4-ab46-aa17fd8969fe nomodeset rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=auto LANG=zh_CN.UTF-8 rd_NO_LVM rd_NO_DM rhgb quiet
initrd /initramfs-2.6.32-431.el6.x86_64.img

ipv4, ipv6
network interface
configuration file card
route
write route entry

Guess you like

Origin blog.csdn.net/weixin_45177186/article/details/91415196