Linux.com

Home Linux Community Forums Software Installation Did you SCREW your Grub? Now stuck in Grub Rescue?

Did you SCREW your Grub? Now stuck in Grub Rescue?

Link to this post 21 Jan 10

I recently totally jacked up my boot loader while doing some formatting on some other drives. I don't know how, but it took me FOREVER to find a solution that worked.

If you are using Ubuntu 9.1 and or 9.04 and need to update or restore GRUB, follow these directions. It worked for me and everything is back to normal.

https://help.ubuntu.com/community/Grub2#Resolving%20an%20%22Unrecognized%20Device%20String%22%20%28Error%2011%29

You will want to use the LIVE CD portion of instructions. It is easy and it works.

BIG NOTE: The instructions have 2 variables listed; X and Y. The reference your hard drive such as sda1 or sdb1, etc.. X being a and Y being 1. They do not reference what you see in grub rescue. (hd0, hd0,1, etc...)

SIMPLEST - Copy GRUB 2 Files from the LiveCD

This is a quick and simple method of restoring a broken system's GRUB 2 files. The terminal is used for entering commands and the user must know the device name/partition of the installed system (sda1, sdb5, etc). The problem partition is located and mounted from the LiveCD. The files are then copied from the LiveCD libraries to the proper locations and MBR. It requires the least steps and fewer command line entries than the following methods.

1. Boot to the LiveCD Desktop (Ubuntu 9.10 or later).
2.

Open a terminal by selecting Applications, Accessories, Terminal from the menu bar.
3.

Determine the partition with the Ubuntu installation. The fdisk option "-l" is a lowercase "L".
1.

sudo fdisk -l

If the user isn't sure of the partition, look for one of the appropriate size or formatting.

Running sudo blkid may provide more information to help locate the proper partition, especially if the partitions are labeled. The device/drive is designated by sdX, with X being the device designation. sda is the first device, sdb is the second, etc. For most users the MBR will be installed to sda, the first drive on their system. The partition is designated by the Y. The first partition is 1, the second is 2. Note the devices and partitions are counted differently.
4. Mount the partition containing the Ubuntu installation.

sudo mount /dev/sdXY /mnt

Example: sudo mount /dev/sda1 Note: If the user has a separate /boot partition, this must be mounted to /mnt/boot
5.

Run the grub-install command as described below. This will reinstall the GRUB 2 files on the mounted partition to the proper location and to the MBR of the designated device.

sudo grub-install --root-directory=/mnt/ /dev/sdX

Example: sudo grub-install --root-directory=/mnt/ /dev/sda
6. Reboot
7.

Refresh the GRUB 2 menu with sudo update-grub

Link to this post 21 Jan 10

In my experiences the only one that worked every time for Grub2 was option 3, for chrooting into your existing system to re-post the grub2 image to your mbr.

As a note, the directions work for Grub2 was was included in ubuntu 9.10 and not previous releases, for previous releases that are using Grub, not grub2, refer to https://help.ubuntu.com/community/RecoveringUbuntuAfterInstallingWindows

Link to this post 21 Jan 10

I think my Grub was not Grub2. I did a upgrade from 9.04 to 9.1. Thanks for the follow up.

-Josh

Link to this post 21 Jan 10

Actually, the Live CD I used was 9.04.

Link to this post 21 Jan 10

What was driving me crazy about upgrading via the update manager from 9.04 to 9.10 was that it was trying to force grub2 to install, because I have so many systems on my dual boot I am using a custom grub conf from Slackware and I did not want Ubuntu to overwrite it with the auto-detected options.

Link to this post 21 Jan 10

One thing I am beginning to really start to notice is, Ubuntu kind of assumes you want things a certain way. As I get deeper into linux, I'm sure I will try some more advanced distros.

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board