Fix Linux boot in grub rescue

Source: Internet
Author: User

Some time ago, when the Partition Table of the mobile hard disk was fixed, the partition of the local disk was re-obtained, causing the grub of ubuntu to fail to find the LINUX partition (the LINUX partition cannot be started due to the uuid change of the root partition ), when switching to Linux, the system prompts "unknown filesystem" to enter grub rescue mode.

I searched on Google and finally solved the problem. The solution is as follows:

1. First use the set command to view the current configuration information;

2. Run the LS command to traverse all disks;

3. find the disk where the "/" partition of the Linux operating system is located. You can use "ls (hdx, x)/". hdx here represents your physical disk. If there is only one hard disk, then the value of X is 0, and the next X (which is msdosx, depending on the specific situation) represents the number of the "/" partition.

Run this command (note that the "/" after the LS command cannot be small, otherwise the "bad FILENAME" error will occur). If the result is "unknown filesystem ", it indicates that it is not a LINUX partition. If you continue searching, you will know that the partition with the "/Boot" directory is returned.

4. Find the partition where the "/" mount point is located, and you can modify the start partition:

Grub rescue> root = (hdx, msdosx)

Grub rescue> prefix = (hdx, msdosx)/boot/GRUB

Grub rescue> insmod normal

Grub rescue> normal

After the normal command is executed, if the normal module is loaded successfully, we can see the grub boot menu that has been violated for a long time. In this case, press "c" to switch to the grub command line mode and modify the GRUB menu:

Grub> root = (hdx, msdosx) // sets the system startup partition, which points to the partition where the kernel is located.

Grub> prefix = (hdx, msdosx)

Next, load the Linux. Mod module and write the new startup information to grub:

Grub> insmod (hdx, msdosx)/boot/gurb/Linux. Mod

Grub> for Linux/boot/vmlinuz-xxx root =/dev/sdax // you can press the tab key for XXXX in Linux/boot/vmlinuz-xxx root =/dev/sdax //

Grub> initrd/boot/initrd. IMG-xxx

5. Run the boot command to start the system. (If the system cannot be started, repeat steps 1-4 and try multiple times ):

Grub> boot

6. After the system is started normally, enter the "sudo Update-Grub" command in the terminal, generate the "Grub. ccfg" file, update grub information, and generating... "will appear on the screen ..." .

If the grub-PC package or grub-legacy is not installed, the command cannot be found. You only need to install the grub-PC package. (Note: during the installation process, you will be prompted to create a new grub to the first partition. Because my first partition is a Windows system, I select "no" here ", instead, set grub to the partition where the "/" mount point is located)

7. After the update is complete, restart and solve the problem. If the problem persists, repeat steps 1-6 and re-establish grub to the first hard disk MBR:

Sudo grub-install/dev/SDA

Reprinted from: http://blog.csdn.net/miromelo/article/details/6132702

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.