Solve the problem that the GRUB boot error cannot enter the system when CentOS is started.
A grub boot error suddenly occurs during startup, causing the system to fail to enter. The solution is to use the CentOS installation disc for GRUB boot and repair. The detailed demonstration steps are provided below.
When CentOS is turned on, a GRUB boot error suddenly occurs, causing the system to fail to enter. In this case, many people are helpless. In fact, it is not difficult to solve such problems, the following small series will introduce you to the solution to the GRUB boot error when CentOS is started. I hope it will help you.
Solution: Use the CentOS installation CD to boot GRUB boot for restoration.
Specific operations:
Use the CentOS system disk to boot the computer (the system disk must be the same as the original system version)
As shown in
Press F5 to enter the system repair mode. The following interface is displayed.
Input: linux rescue press ENTER
Default OK
Select Continue to display the following interface
Input: chroot/mnt/sysimage, press Enter # Switch the current directory to the root directory of the original system
Enter grub and press Enter. The following interface is displayed.
Input: root (hd0, 0) press Enter # Note that there must be spaces between root and (hd0, 0)
Continue input: Enter setup (hd0) and press Enter # Note that there must be spaces between root and (hd0 ).
Enter again: quit press Enter # exit grub Mode
Finally, enter reboot # restart the system.
Take out the CD and repair grub. You can access the system normally.
Note: If you still cannot access the system through the above operation
You can
Input: chroot/mnt/sysimage
Vi/boot/grub. conf # edit and add the following content (for example, CentOS 5.9)
# Grub. conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a/boot partition. This means that
# All kernel and initrd paths are relative to/boot/, eg.
# Root (hd0, 0)
# Kernel/vmlinuz-version ro root =/dev/sda3
# Initrd-version.img/initrd
# Boot =/dev/sda1
Default = 0
Timeout = 5
Splashimage = (hd0, 0)/grub/splash.xpm.gz
Hiddenmenu
Title CentOS (2.6.18-348. el5)
Root (hd0, 0)
Kernel/vmlinuz-2.6.18-348.el5 ro root = LABEL =/
Initrd/initrd-2.6.18-348.el5.img
: Wq! # Save and exit
Enter: quit press Enter # exit grub Mode
Input: reboot # restart the system
Generally, it can be repaired successfully and the system is normally accessed.
If the system is installed through a USB flash drive, the USB flash drive will not be able to enter the system, and the USB flash drive can be properly started.
You can fix the problem as follows:
Plug in the USB flash drive and enter the system normally.
Input: grub-install/dev/sda # install grub to sda
Vi/boot/grub/device. map # Edit
(Hd0)/dev/sda
It may have been:
(Hd1)/dev/sda
(Hd0)/dev/sdb
Vi/boot/grub. conf # edit and modify (hd1, 0) to (hd0, 0)
Title CentOS (2.6.18-348. el5)
Root (hd0, 0)
Kernel/vmlinuz-2.6.18-348.el5 ro root = LABEL =/
Initrd/initrd-2.6.18-348.el5.img
Delete all
After saving, restart and remove the USB flash drive. Then you can access the system normally.
The above describes how to solve the GRUB boot error in CentOS. To solve this problem, you need to use the CentOS CD for grub boot repair. Follow the steps in the article to solve the problem easily.