Win7 +v Ubuntu 16.04 Grub Rescue Mode Repair Grub

Source: Internet
Author: User

A few days ago to tidy up the partition of the computer, merge and delete some partitions, the result is that grub was destroyed, Ubuntu can not go in, after the launch directly into the rescure mode. Then the next toss, finally repaired, and now summed up.

First talk about my system environment, I am Win7 + ubuntu 16.04 dual system, first installed Win7, after installing Ubuntu. Using the way Windows Boots Ubuntu, the tool used is "EASYBCD 2.3 people version". Ubuntu partition, "/boot" is a separate partition。 Detailed partitioning is as follows: "/boot" partition, "/" Partition, "Swap swap space".

   It is also necessary to note that when I install Ubuntu, "boot device Installation" selects the partition where "/boot" is located.

The following formally begins the detailed explanation of the workaround:

When entering Ubuntu, the screen is as follows:


First, using the LS command to find the Ubuntu partition, the result of executing the LS command is as follows:
Shell Code
    1. Ls


You will see the partition on your hard disk, for example (HD0,MSDOS1), (HD0,MSDOS2), and so on, where 0 of hd0 represents the 1th hard drive (the hard disk number starts at 0), and 1 in MSDOS1 represents the 1th partition.

Then call the following command in turn until you find the partition where Ubuntu is located, the command is as follows: LS (hdx,msdosy)
where x represents the hard disk number and Y represents the partition number.
Take my machine as an example and look at each partition in turn:
Shell Code
    1. LS (HD0,MSDOS1)
    2. LS (HD0,MSDOS2)
    3. LS (HD0,MSDOS3)
    4. #......
The results of the implementation are as follows:






After execution, Discovery (HD0,MSDOS5) and (HD0,MSDOS6) are the Ubuntu partition. Then execute the following command to determine the partition where grub is located:
Shell Code
    1. LS (hd0,msdos5)/grub
    2. LS (HD0,MSDOS6)/grub
    3. # if "/boot" does not have a separate partition, execute the following command (to be verified):
    4. LS (hd0,msdos5)/boot/grub
    5. LS (HD0,MSDOS6)/boot/grub


After execution, found (HD0,MSDOS5), there are grub.cfg files. Description (HD0,MSDOS5) is the boot partition we are looking for.

After that, execute the following command, repair the grub boot, and enter the GRUB2 boot screen:
Shell Code
    1. Set root= (HD0,MSDOS5)
    2. Set prefix= (HD0,MSDOS5)/grub
    3. Insmod Normal
    4. Normal
    5. # if "/boot" does not have a separate partition, execute the following command (to be verified):
    6. Set root= (HD0,MSDOS5)
    7. Set prefix= (HD0,MSDOS5)/boot/grub
    8. Insmod Normal
    9. Normal


After executing the above command, you can see the Ubuntu grub2 boot screen, you can enter the normal Ubuntu.


But you will find that if you restart the computer, the problem remains. That's because we haven't implemented the GRUB Update command yet.

Re-execute the above command to enter Ubuntu. Then update grub at the terminal by executing the following command:
Shell Code
    1. sudo update-grub2
    2. sudo grub-install/dev/sda
   Note:/DEV/SDA back Don'tAdd a partition number, such as Sda1,sda2.
The results of the implementation are as follows:




At this point, grub is finally repaired. However, if you restart the computer at this point, you will find that the boot has become Ubuntu boot Windows. And before the fix was Windows boot Ubuntu.

To solve this problem, I used the method of first entering Win7, and then using "EASYBCD" to repair the MBR to solve this problem.

The way to do this is simple: Start EasyBCD, select "BCD Deployment" on the left, and then select "Install Windows vista+ in MBR bootloader" on the right, which is the default first item, and finally click the "Write MBR" button.

In this case, the grub repair is done directly, and Ubuntu can be booted with Windows.

References:
http://blog.csdn.net/liangxanhai/article/details/7654478
http://my.oschina.net/junn/blog/135450

Win7 +v Ubuntu 16.04 Grub Rescue Mode Repair Grub

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.