Welcome to the Linux Foundation Forum!

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

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 an "Unrecognized Device String" (Error 11)

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).


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


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


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


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


Refresh the GRUB 2 menu with sudo update-grub


  • mfillpot
    mfillpot Posts: 2,180
    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
  • jayvo86
    jayvo86 Posts: 12
    I think my Grub was not Grub2. I did a upgrade from 9.04 to 9.1. Thanks for the follow up.

  • jayvo86
    jayvo86 Posts: 12
    Actually, the Live CD I used was 9.04.
  • mfillpot
    mfillpot Posts: 2,180
    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.
  • jayvo86
    jayvo86 Posts: 12
    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.
  • mfillpot
    mfillpot Posts: 2,180
    I really like that you have said that because it is showing that you are learning to look deeper into the system and ask how things work.

    I have been using Slackware since 2002 because of the lack of assumptions, there are too many distros that I am seeing that are making the assumptions which are adding too many additional points of potential failure and complexity. I give these distros credit for their goals and accomplishments, but I hope that they quickly learn their lessons before they compromise the integrity of their systems and loose the functionality that Linux based distros have always had.

    As for the current state of Ubuntu, I think they rushed too much in trying to incorporate new features like adding pulse audio, removing hal and updating their package manager without fully testing them which is why in my opinion ubuntu 9.10 is the only bad release of ubuntu.
  • Kode
    Kode Posts: 1
    Actually you can do something much more simple especially recommended for users who have dual-booted their PCs and use their windows(or other OS) much more than they use their Linux or other Linux distribution. While i was trying with the live CD all these instructions on fixing Grub, which took me nearly hours until i reach this helpful page and after desperately managed to fix it,(i am no computer expert, i just love open-source software like Linux) i thought a much more simpler solution... Why i just can install the Linux OS from the live CD and then log on my windows :) AND IT WORKED!

    But Read this, it is very important!
    -If you do this u will no longer be able to use your Linux OS.
    -You have to have installed your Operating Systems on different partitions of your hard drive.
    -After I did it all the files i had on the Linux OS where gone, so i deleted the whole partition.(One good solution of not losing your important files is to backup them in a USB while u are installing your Linux OS again.(Don't worry, usually when you log with your live CD you will be able to see,use and backup all the files you want from your hard drive)

    This solution takes approximately 10 minutes and it is so easy that even someone who hasn't even heard of Linux can do it :)
    You don't have to use a live CD! I didn't have a CD to use so a used a program named Unetbootin which writes ISO files on USBs! (So I wrote my Linux Distribution ISO file on my USB )

    Fixing Grub included finding a way to fix it took me nearly 14 hours and it requires basic programming skills! But this solution takes 10 minutes and can be done even from a 5 year old kid...You choose which is best for you :D
    (But still thanks to the creator of this post, really inspired me of thinking this solution :)
  • This is exactly my problem. I did an unattended install using WUBI on a modern machine that has two drives, one Vista, and one Win7. There was room on the Win7 drive to shorten the partition and create an empty new partition using standard Microsoft Console Tools. I created a new NTSC partition for Ubuntu desktop and launched the installer.
    It was late, and I went to bed, and the installer did its thing. In the morning Ubuntu ran perfectly!

    Then a pop up appeared advising of over 200 updates. I clicked, and off it went. It stopped for input once, on the grub screen. The window had three partitions listed. The pop up text had three paragraphs appeared to say in the first paragraph to "select all of them" and in the last paragraph not to. I went with the first paragraph and clicked them all. Now Ubuntu does not work. Nothing does. In the middle of my computer's start sequence, while "Verifying DMI Pool data" an error pops up " Error: No such device.." followed by some hex code. On the next line is the grub rescue> prompt. But it does not recognize any command I give it, even the ones from various grub 2 docs.

    I was delighted to see how easy the install went, but sad to see how easy it broke. Most of the instructions for making this better involve burning an ISO image of a Live CD and accessing that portion of the bootloader. But this machine has no optical drives. I do have a Terabyte USB drive, but none of the instructions cover that.

    So I feel that victory was in my grasp, and after i did an upgrade, it went south. Any way to unravel that upgrade? If this were Windows, I could just go to a restore point. But of course, I can't even boot the machine now.

  • Update--
    Based on one of the other comments in this thread (Kode followed by Google), I looked at WUBI again, and the Wikipedia articles say it is pretty heavily integrated with Windows, and my not have used my new partition at all, but rather written the install to a file within Windows 7. I told the WUBI installer to put it there, but I did not verify it. If I read correctly, this may make it impossible to remove the Ubuntu with either a LiveCD or with Unetbootin. And of course, my machine won't start.

    Help? :(
  • Yet Another Update

    1) The DMI sequence stops at ACPI controller. Some literature (Tom's hardware ACPI section) suggests that certain boot loaders overwrite a part of the MBR that is really critical to getting the machine running. May have to look at using a superboot disk to get the machine running so I can undo what the Grub update did.

    2) The Grub Rescue prompt does in fact respond to valid commands. I will head back in with a list of commands on the chance that there is a fix. Any advice?
  • mfillpot
    mfillpot Posts: 2,180
    If you are getting the grub prompt on startup that means that the wubi installation was not processed, it instead attempted a physical installation to the partition you created. I don't know what an NTSC partition is, so instead I will assume that you meant that you setup an NTFS partition that it then installed ubuntu into. If in fact it attempted to install ubuntu in an ntfs partition then that could be your problem since the bootloader is made to read unix type filesystems to get the configuration file.

    To correct your problems you can use the windows recovery tool from boot to get into the recovery terminal and run fixmbr which will reinstall the windows bootloader, once in windows you can attempt a wubi installation inside your primary hard drive. If that is successful then ubuntu will use the windows bootloader to choose the operating system and grub will be chainloaded from within the filesystem file.
  • Marco Braida answers a lot of questions on this matter at launchpad.net. --Question 120822. He seems to suggest the issue is related to Wubi, and urges installing on an actual partition. I am not sure where the problem lays, but somewhere in the combination of easy-to-use tools, I ran into some big trouble. If I was a Windows user "giving Linux a go", this would have been a poor beginning. :unsure:

    Thanks to all who helped.
    PS: NTSC is a television broadcast standard. I spent many years as a broadcast engineer. NTFS is a file system, and that is what I meant to have typed. And the Wubi install was pointed into a partition I created using the Windows Disk Manager MFC in empty space on the drive.

    This is an excellent summary. I ran into just this issue, and on researching it here and elsewhere I found the things you say about Wubi to be the case. The Wubi install is very easy. It is silent. For the most part everything autocompletes. But yes, it, or something it contributes to, can cause a problem with booting the computer, in my case, after Ubuntu offered auto updates. This was un-recoverable, so I eventually just did an install from the iso image, as you suggest above, and told it to delete and use the entire disk.

    My problems focused around booting. After powerup, when the computer was running through its list of PCI connections, this process terminated early, and it changed to "Boot From CD ROM:" If the CD was in the drive, it rolled the CD. If not, it returned a "No Device Found error, and terminated the boot. The last thing in the PCI device report was ACPI, and this line was not displayed completely. Many sources recommend adding "noapci" in the bootloader file. This may help, but as my computer would not boot, I found it hard to edit that line. Some skill with using a live CD to edit files in the install will be valuable, and I intend to learn them. On the other hand, Wubi may have modified the MBR of my Win7 install, and in that case some of my helpers have suggested that the answer is to run FIXMBR using the Windows rescue disk.

    There seem to be a number of people who fall into this problem, and the traffic I have found focuses on ACPI, Wubi, Ubuntu 10.4, and, again, the upgrades that are offered after you are running, which was the beginning of my problem. If Cannonical intends 10.4 to exploit the gap caused by the release of Windows Vista, then it must not be this easy to blow up a working machine.

    Thank you, All.


Upcoming Training