Ubuntu--grub Rescue Master Boot Repair

Source: Internet
Author: User

Long-term use of Windows and Ubuntu dual system, it is likely to encounter a heavy system, or other ways to join the partition, causing the system to restart:

GRUB Loadingerror:unknow Filesystemgrub rescue>


Reprint Please specify source: http://blog.csdn.net/jscese/article/details/36865449

I. Concept

BIOS: "Basic Input Output system", the Chinese name is the "base inputs and outputs". In fact, it is a set of programs that solidify onto a ROM chip on the motherboard of a computer. It holds the computer's most important basic input and output programs, System setup information, post-boot self-test programs and system self-start programs. Its main function is to provide the lowest, most direct hardware setup and control for the computer.


MBR: The physical sector of the "Master boot Record" drive, also called the Master boot record!

Since the BIOS is very small, it cannot host the startup execution program, so after the BIOS detects a hard drive. The contents of the hard disk's 0 cylinder, 0 head, and 1 sectors are simply inferred to the specified position in memory. Then jump to this position and start from this position, with a size of 512 byte. The main storage of the boot program and the disk partition table.


GRUB: "GRand Unified Bootloade" multiple operating system Boot manager. It is the execution of this grub that allows it to boot into other systems, including Windows and Linux


The above three concepts, literally, should be clear about their processes. It is generally:

The PC first starts to the BIOS, then detects the MBR of the hard disk, loads the contents of the MBR sector (that is, the grub written on it) into memory execution, and implements the new jump launcher by executing GRUB results!


Two. Ubuntu Grub2 Repair

When the PC is installed first Windows is installed after Ubuntu or just has an Ubuntu system. Is that the Ubuntu system comes with the GRUB2 boot program written on the MBR. Then boot the main boot program is GRUB2! (Ubuntu has been used for all grub2 since 9.10)

The GRUB2 is divided into two parts, one of which is written to the MBR. Part of the/boot/grub folder exists with Ubuntu.

The presence of grub rescue> is the inability to properly operate the GRUB program on behalf of the MBR section, starting Grub rescue mode, because the/boot/grub section cannot be found.

Commands available under Grub Rescue:

Set,ls,insmod. Root,prefix (set boot path)


First, all partitions are viewed through ls . Will list:

(hd0), (hd0. MSDOS8). (HD0,MSDOS7). (HD0,MSDOS6), (hd0. MSDOS5), (HD0,MSDOS3). (HD0,MSDOS1)


Need to find Ubuntu installation partition. Via LS (hd0,msdos*)/boot until not present: Error:unknown filesystem

Suppose you know which partition to install Ubuntu on, like Sda7 then this is MSDOS7. It is assumed that the partition was added before the Ubuntu hard disk space. Then move the Ubuntu partition number backwards!

Become Msdos8

Once found, set the one-time startup parameters by setting the following command as follows:

Grub Rescue>set root= (HD0,MSDOS8) Grub Rescue>set prefix= (HD0,MSDOS8)/boot/grubgrub Rescue>insmod/boot/grub /normal.mod

Grub Rescue>normal will appear in the Boot/grub Launcher interface!


Assuming that the/boot/grub is not damaged, it will be able to enter the Ubuntu system, assuming that grub starts the part of Ubuntu damaged. You need to manually boot:

Go to the GRUB command line:

grub> root (hd0,8) # # Specifies partitiongrub> kernel/boot including Vmlinuz-2.6.18-274.7.1.el5 and initrd-2.6.18-274.7.1.el5.img /vmlinuz-2.6.18-274.7.1.el5 ro root=/dev/sda8 # # root= is a partition that is specified to include/sbin/init, that is, mount/partition (in Linux perspective) grub> INITRD/BOOT/INITRD-2.6.18-274.7.1.EL5.IMG # # This is said to omit grub> boot

After the right entry to Ubuntu. The grub portion of the MBR needs to be updated to accommodate the new partitioning situation:

Terminal input:


sudo update-grub2sudo GRUB-INSTALL/DEV/SDA

Update to/BOOT/GRUB/GRUB.CFG! Then install grub to the MBR of the primary hard drive

Have encountered such installation is not successful, in the GRUB2 manual there is another way to reinstall GRUB2 to the MBR. Record it:


This scenario will use the chroot command to access the file of the damaged system.

Once the chroot instruction is executed, LiveCD will destroy the system's/(root record) as it is currently used. Commands that are executed in the CHROOT environment affect the system's file system, not the LiveCD.

1. Start the LiveCD Desktop (Ubuntu 9.10 or later). Note that this LiveCD must be the same as the version number of the system you are now trying to repair-whether 32-bit or 64-bit (or chroot will fail). 2. Open the terminal machine-application, the application, the terminal. 3. Confirm your standard system cut area-(option is "l") sudo fdisk-l If you are not sure. Perform df-th to find the correct disk capacity and ext3 or EXT4 format. 4. Load your standard-cut area with the correct cut area: sda1, SDB5, etc. sudo mount/dev/sdxx/mnt #範例: sudo mount/dev/sda1/mnt5. If you have a unique////Cut area: Sdyy is the location of the/boot cut (e.g. sdb3) sudo mount/dev/sdyy/mnt/boot6. Download the important virtual file system: sudo mount--bind/dev/mnt/devsudo mount--bind/dev/pts/mnt/dev/ptssudo Mount--bind/proc/mnt/procsudo mo Unt--bind/sys/mnt/sys7. Chroot to your standard system: sudo chroot/mnt8. If the system does not have/BOOT/GRUB/GRUB.CFG or its contents are not correct, use the following command to reconstruct the update-grub9. Install GRUB 2 again: Replace with the correct replacement-SDA, SDB, and so on. Do not specify a cut area code. grub-install/dev/sdx10. Verify the installation (using the correct device, such as SDA. Do not specify the cut area): sudo grub-install--recheck/dev/sdx11. Exit Chroot: Press the ctrl-d12 of the keyboard. To unload the virtual file system: sudo umount/mnt/dev/ptssudo umount/mnt/devsudo umount/mnt/procsudo Umount/mnt/sys If you have a unique/boot cut area: sudo umo Unt/mnt/boot13. Unload LiveCD/usr: sudo umount/mnt/usr14. Unloading the final device: sudo umount/mnt15. Once again, start the machine. sudo reboot



Another common use is the inability to boot to the grub interface. This time it will require additional guidance. A lot of the online approach is to use Ubuntu's installation CD, which is LiveCD,

I often use a USB flash drive, the old Peaches loaded into an Ubuntu ISO production of an Ubuntu bootable U disk. Then the BIOS selects the USB stick to boot.

Choose Try running Ubuntu with the Install option not selected

This executes the Ubuntu system we made on the USB stick. Can use this as a medium to change other system files on this machine, like the above mentioned above the mount on the first of those partitions:

sudo mount/dev/sdxx/mnt

You can first use the sudo fdisk-l command to view the partition, select the appropriate

Suppose you want to change the content using Chroot after switching ctrl+d exit


My side is 13.04, grub version number is:

[Email protected]:~$ grub-install-vgrub-install (GRUB) 2.00-13UBUNTU3

In this case, you can install the correct grub to the MBR using the following command, for example:

Grub-install--ROOT-DIRECTORY=/MNT/DEV/SDA

I have this SDA for the first hard drive







Copyright notice: This article blog original article. Blogs, without consent, may not be reproduced.

Ubuntu--grub Rescue Master Boot Repair

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.