Reprinted from: http://blog.csdn.net/scut1135/article/details/6930948
You have formatted the grub boot file. Grub is broken.
Ubuntu cannot be started due to a confusing operation. Grub displays error: file not found, and then stops the grub rescue prompt.
Solution:
1. http://wenku.baidu.com/view/d797d43183c4bb4cf7ecd13e.html
Use Ubuntu to install CD, that is, to start live CD from the optical drive. Open a terminal window and enter the following command in it:
Sudo-I (obtain super user permissions)
Mount/dev/sda7/mnt, /mnt is a directory you have created for mounting)
If you separately divide the boot partition of ubuntu, you also need to do the following:
Mount/dev/sda6/mnt/boot (assume that your boot partition is in sda6)
Mount your other partitions, if any
Rebuilding the MBR from grub to SDA
Grub-install -- root-directory =/mnt/dev/SDA (note that there is a space behind/mnt)
Then, restart the instance.
2.Processing of grub rescue mode
After adjusting the partition in Linux, grub rescue> appears. This indicates that the configuration file of grub2 is broken. grub2 cannot be started properly due to partition adjustment or partition UUID change, so as to enter the repair mode (grub rescue), also known as the rescue mode. In rescue mode, only a few commands can be used: Set, ls, insmod, root, prefix (1) set to view environment variables. Here you can view the startup path and partition. (2) ls viewing device (3) insmod loading module (4) Root specifying the partition used to start the system, and setting the grub startup partition in rescue mode (5) prefix: grub startup Path 1. partitions are messy. I don't know where the boot directory is located. ls # Check the device status. Grub rescue> ls (hd0, msdos3) error: Bad filename. tip: the file name is incorrect. I found it must be followed by a/GRUB rescue> ls (hd0, msdos3 )/. /.. /lost + found/check that there is a boot directory under (hd0, msdos1)/. 2. Set the boot partition and path set root = (hd0, msdos1) of grub) # Set GRUB boot partition set prefix = (hd0, msdos1)/boot/GRUB/# Set the grub boot path to view the settings: grub rescue> setprefix = (hd0, MSD Os1)/boot/grubroot = hd0, msdos1 3. Load the Basic module insmod/boot/GRUB/normal. moD # loading Basic module 4. Entering normal mode normal # entering normal mode, a menu appears, if grub is loaded. CFG (incorrect) may be faulty. You can press shift to display the menu, and press C to enter the console to enter the normal mode. Then grub> will appear, many Commands are supported here. V. boot system set root = (hd0, msdos1) # Set the normal boot partition Linux/boot/vmlinuz .... RO text root =/dev/sda1 # load the kernel and enter the Console mode initrd/boot/initrd .... # Load initrd. imgboot # boot 6. Update grub installation: grub-install/dev/SDA update: Update-grub