Ubuntu -- grubrescue Master Boot fix

Source: Internet
Author: User

Ubuntu -- grubrescue Master Boot fix

If you have been using windows and ubuntu for a long time, you may have to reinstall a system or add another partition, resulting in system restart:

GRUB loadingerror:unknow filesystemgrub rescue>

Reprinted please indicate the source: http://blog.csdn.net/jscese/article/details/36865449

1. Concepts

BIOS: "Basic Input Output System". The Chinese name is "Basic Input Output System ". In fact, it is a set of programs solidified on a ROM chip on the motherboard in the computer, it stores the most important basic computer input and output programs, system settings, post-boot self-check programs, and system self-start programs. Its main function is to provide computers with the most underlying and direct hardware settings and control.

MBR: The physical sector of the "Master Boot Record" hard disk, also known as the Master Boot Record! Because the BIOS is very small and cannot carry the Startup Program, after the bios detects a hard disk, it simply determines the content of the hard disk's 0 cylinder, 0 head, and 1 sector, go to the specified location in the memory and jump to this location to start running from this location. The size is 512 bytes, which mainly stores the boot program and the partition table of the hard disk.

GRUB: "GRand uniied Bootloade" Multi-operating system startup manager. After running this GRUB, you can use it to guide the system to other systems, including Windows and linux

The above three concepts should be able to understand their processes literally:

The PC first starts the BIOS, then detects the hard disk MBR, and loads the content of the MBR sector (that is, the GRUB written on it) into the memory for running, run GRUB to get a new jump!

Ii. Ubuntu grub2 repair

When the PC is installed with windows first and then installed with ubuntu or only one ubuntu system, the grub2 boot program that comes with the ubuntu system is written on the MBR, then the boot Main Boot Program is grub2! (Grub2 used in ubuntu since 9.10)

Grub2 is divided into two parts, one of which is written into MBR, and the other part is stored in the/boot/grub directory of ubuntu.

Grub rescue> indicates that grub programs cannot run normally in MBR, And the grub rescue mode is started because the/boot/grub part cannot be found.

Available commands under grub rescue:

Set, ls, insmod, root, prefix (set the startup path)

First passLsView all partitions, which are listed as follows:

(Hd0), (hd0, msdos8), (hd0, msdos7), (hd0, msdos6), (hd0, msdos5), (hd0, msdos3), (hd0, msdos1)

You need to find the ubuntu installation partition through ls (hd0, msdos *)/boot until the following error occurs: error: unknown filesystem.

If you know which partition to install ubuntu, for example, sda7, msdos7 is used. If you add a partition before the hard disk space of ubuntu, move the ubuntu Partition Number back! To msdos8

Set the one-time startup parameters using the following command:

grub rescue>setroot=(hd0,msdos8)grub rescue>set prefix=(hd0,msdos8)/grubgrub rescue>insmod /grub/normal.mod
Grub rescue> normal will show the boot interface in boot/grub!

If the/boot/grub file is not damaged, you can access the ubuntu system. If some of the ubuntu files started by grub are damaged, you need to manually boot it:

Go to the grub command line:

Grub> root (hd0, 8) # specify partitiongrub> kernel/boot/vmlinuz-2.6.18-274.7.1.el5 ro root =/dev/sda8 # root = specifies partition that contains/sbin/init, that is, Mount/partition (from a Linux perspective) grub> initrd/boot/initrd-2.6.18-274.7.1.el5.img # It is said that this can omit grub> boot

After entering ubuntu correctly, update the grub part of MBR to adapt to the new partition:

Terminal input:

sudo update-grub2sudo grub-install/dev/sda
Update to/boot/grub. cfg! Then install grub to the MBR of the master hard disk.

If the installation fails, record the method of reinstalling GRUB2 to mbr in the grub2 manual:

In this solution, the server Guard uses the chroot command to access the protocol of the trusted system. Once the chroot command is executed, LiveCD will use the/(root object) of the kernel system as its own. Running commands in the chroot environment affects the operating system of the local system, rather than the LiveCD. 1. Enter the LiveCD desktop (Ubuntu 9.10 or later ). Note that this LiveCD must be the same as the version of the current version of the system you want to repair-no matter whether it is 32-bit or 64-bit (otherwise, chroot will lose ). 2. Open your terminal-application program, and attach your application program to your terminal. 3. confirm your standard system partition-(Select the "L" of the small shard) sudo fdisk-l if you are not sure, find the correct disk capacity and the ext3 or ext4 format on the df-Th line. 4. When using your standard system to divide a region, use a correct partition to replace the following: sda1, sdb5, and so on. Sudo mount/dev/sdXX/mnt # example: sudo mount/dev/sda1/mnt5. if you have a separate/boot partition: sdYY is the location of the/boot partition (for example, sdb3) sudo mount/dev/sdYY/mnt/boot6. zookeeper important zookeeper protocol system: sudo mount -- bind/dev/mnt/devsudo mount -- bind/dev/pts/mnt/dev/ptssudo mount -- bind/proc/mnt/procsudo mount -- bind/sys/mnt/ sys7. Chroot to your standard system settings: sudo chroot/mnt8. if the system does not contain/boot/grub. cfg or its content is incorrect, use the following command to recreate the update-grub9. re-install GRUB 2: replace regular-s with correct values Da, sdb, etc. Do not specify partition partitions. Grub-install/dev/sdX10. verify the security settings (use the correct setting, such as sda. Do not specify the partition): sudo grub-install -- recheck/dev/sdX11. exit chroot: press the zookeeper CTRL-D12. the system of the "unmount hosts" operation is as follows: sudo umount/mnt/dev/ptssudo umount/mnt/devsudo umount/mnt/procsudo umount/mnt/sys: sudo umount/mnt/boot13. unmount the/usr mesh of LiveCD: sudo umount/mnt/usr14. unmount the last volume of sudo umount/mnt15. restart the machine. Sudo reboot

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.