Table of contents
Guide fault analysis and processing
2. Repair grub2- mistakenly delete /boot/grub2/*
3. Fix grub2 - boot broken failure
4. Fix the fault that all files under /boot/ are deleted
Guide fault analysis and processing
1. Repair grub2 boot failure
Cause of failure: The grub.cfg file is missing
Two solutions, method one:
Symptoms:
Unable to boot normally, the following interface is displayed after booting:
Workaround: Bootstrap manually
Enter the following command in this interface
ls to check, it shows the system disk device set root= After setting the root disk selection, if you can type linux /vmlinuz to complete the tab, the selection is correct, if it is not complete, set root= again, and try linux /vmlinuxz-*.x86_64 again root=root partition path initrd /initramfs-*.x86_64.img boot After successfully grub2-install /dev/sda Reinstall grub2 on sda and re-cover the original boot grub2-mkconfig -o /boot/grub2/grub.cfg Let grub2 identify different systems by itself, then create a boot by itself according to the script, and update the file /boot/grub2/grub.cfg
Operating procedures:
After successfully booting, enter the system, open the terminal, and continue to execute:
After restarting again, it is normal.
Method 2:
Enter rescue mode: boot through the CD, enter rescue mode
The premise is that in the case of shutdown, choose to enter the firmware before booting
Arrow keys to select Boot
Find the cdrom, put the disc in the first place, press + up to move
Press the plus key (+) to move the disc to the topmost position.
press f10 to save
If there is no item, press tab under the default first one and add the command rescue at the end
After entering rescue mode, select 1
/mnt/sysimage is rescue mode, chroot the mount path of the hard disk file system /mnt/sysimage switches the root directory to the hard disk file system directory
Enter this interface again after waiting
Select Boot from this
Enter
After waiting, repeat the above steps again, enter again, you can
successfully entered the system
Reboot again to start normally. (After shutting down and restarting to enter the firmware, restore the CD to the default boot sequence, or put it in the default position, the third position)
2. Repair grub2- mistakenly delete /boot/grub2/*
Deleted by mistake: rm -rf /boot/grub2/ Solution : chroot /mnt/sysimage grub2-install /dev/sda grub2-mkconfig -o /boot/grub2/grub.cf in rescue mode
After restarting, it cannot restart normally
The following interface appears
enter rescue mode
The steps are the same as the above method 2, enter the firmware before booting, select Boot, put the CD in the first place, f10 save and exit
Enter the rescue interface:
Execute exit two more times.
Just wait, and the subsequent steps and operations are the same as method 2 of 1.
Enter the system, open the terminal, check the boot files under /boot/grub2, all new ones have been generated.
3. Fix grub2 - boot broken failure
Accidentally delete rm -rf /boot/grub2/ boot damage dd if=/dev/zero of=/dev/sda bs=1 count=446 The solution is chroot /mnt/sysimage grub2-install /dev/sda in rescue mode grub2-mkconfig -o /boot/grub2/grub.cfg
The operation process is the same as 2.
4. Fix the fault that all files under /boot/ are deleted
Accidental deletion: rm -rf /boot/* boot damage dd if=/dev/zero of=/dev/sda bs=1 count=446 The solution is chroot /mnt/sysimage mount /dev/sr0 /mnt in rescue mode grub2-install /dev/sda rpm -ivh /mnt/Packages/kernel-3.10.0-1127.el7.x86_64.rpm –force grub2-mkconfig -o /boot/grub2/grub.cfg
Operating procedures:
restart, unable to restart normally
Enter rescue mode (boot into the firmware and place the CD under Boot in the first boot item, the operation is the same as 2)
After mounting the disc, reinstall grub2, and tell grub2 to install the kernel and finally create a boot update file
just wait
After the installation is complete
Execute exit twice again and wait.
After waiting, repeat the above steps again to enter the system
Restart again to be normal.
Start again to enter the firmware, and restore the CD under Boot to the original order, under the hard disk. Save and exit
After waiting, enter again:
Press Enter to confirm and enter the system.