How to solve the corruption or loss of the grub.conf file on Linux system

  

In the Linux system, due to operational errors, the /boot/grub/grub.conf file may be damaged or lost. The grub prompt appears after booting. And Linux commands can't be used. What should I do if this happens? The following small series will introduce you to the solution to the corruption or loss of the Linux system grub.conf file.

Solution:

1, first, the disk into the drive system

2, reboot the computer

3, modify the BIOS boot sequence Change to boot from CD

4. After startup, the prompt interface appears, there are options at the bottom of the screen, here we directly input

# linux rescue Enter system rescue mode

5, #chroot /mnt/sysimage (/mnt/sysimage is the root directory of our machine) Mount the system image, so the command can be used

6, # vi /boot/grub/grub .conf We manually write a grub.conf file ourselves, but be careful to write the kernel and process when writing. After editing, save and exit, then, two exit exit the system, enter the restart

7, do it, the system can be started normally

In fact, this is quite simple, but sometimes This is still not possible, sometimes reinstalling the kernel kernel and booting grub. This is very troublesome. Therefore, in order to ensure the security of the system in the future, we still have to back up the grub file, and then directly copy the backup file to /boot/grub/.

The above is the Linux system grub.conf file is damaged or lost repair method introduced, of course, if you back up the grub.conf file first, then you do not have to worry about this situation.

Copyright © Windows knowledge All Rights Reserved