Linux startup and troubleshooting
System startup process:
System initialization:
the POST -> BootSequence (the BIOS) -> Bootloader (the MBR) -> Kernel (the ramdisk) -> the rootfs (Read Only) -> init (systemd)
type init process:
the Upstart: init, the CentOS 6
configuration file:
/ etc / inittab, /etc/init/*.conf
systemd: systemd, the CentOS. 7
configuration file: / usr / lib / systemd / System
/ etc / systemd / System
---------- ---------------------
1, the power of POST, loading the BIOS hardware information, acquiring the first boot device
2, the first boot device is read the MBR boot loader (grub) boot information
3, load the core information of the core operating system, the core began to unzip and try to drive all the hardware devices
4, the core of the init program, and to get the default operating information
5, init program execution /etc/rc.d/rc.sysinit file
6 to start the core plug-in module
7, init each batch files (scripts) executed running
8, init executed /etc/rc.d/rc.local
9, execution / bin / login program, wait for a while to log
10, after logging began to shell the control panel
------ -------------------------
Experiment 1: destroy the machine grub stage1, and repair
① the / dev / sda byte hard disk 446 is cleared before
②reboot, troubleshooting, repair into rescue mode,
reboot the system ⽆ law gets into the normal original system, press the F2 key, gets into the BIOS settings for the First Time boot device CD-ROOM device boot
CD boot sector screen with a selection that is the third rescue mode ⾏, enter OK
Cut root, you can install grub repair
Experiment two: After deleting files vmlinuz and initramfs start ⽆ law, and repair
① delete two files
②reboot, enter rescue mode repair
method
mkdir / mnt / cdrom
Mount / dev / SR0 / mnt / cdrom
chroot / mnt / sysimage # switch /
mkinitrd / the Boot / initramfs-uname -r
.imguname -r
cp / mnt / cdrom / the isolinux / vmlinuz / the Boot / vmlinuz-uname -r
Sync # disk write
method two
mkdir / mnt / CDROM
Mount / dev / SR0 / mnt / CDROM
RPM -ivh /mnt/cdrom/Packages/kernel-2.6.32-696.e16.x86_64.rpm --root = / mnt / sysimage / --force
Experiment three: grub.conf delete files, start repair
-F /boot/grub/grub.conf;reboot ①rm
② gets into grub community ⾯, and specify kernel parameters and virtual disk image files
After ③boot start, re-create the grub.conf file
vim /boot/grub/grub.conf
④reboot; test whether the normal start
Experiment 4: destroy the grub stage2; deleted / etc / fstab and / boot of Contents of all files and repair
① delete all files in fstab and / boot
② reboot into rescue mode, the test to see mount / dev / sda2 is the root directory
③vi / mnt / roofs / etc / fstab; create fstab file
④exit; reboot;
⑤ create folders and mount; unzip
⑥ cut root and install gurb; self configuration file grub.conf
⑦ disable selinux, you can restart the test