31

After an installation of Ubuntu 12.04, erasing an old partition with Ubuntu 10.10, I can't get grub to load. I can't access my Windows 7 partition either

I get the message:

> error: no such device: 58ABF29C...  
grub rescue>

I suppose my master boot record got erased/corrupted. How can I check and fix this?

Stephan Vierkant
  • 1,236
  • 2
  • 14
  • 35
andandandand
  • 1,269
  • If your MBR were erased, GRUB would not run at all. What is happening here is that the MBR code is running, and has been told to look on the partition with the UUID of 58abf29c... for the configuration menu. Most likely, this was the partition you erased, so it doesn't exist anymore. The easiest way to fix it would be to download the grub boot repair CD, which will probably fix it automatically. – Marty Fried May 29 '12 at 16:22
  • A complete answer is here http://askubuntu.com/questions/125428/grub-complains-of-no-such-partition-after-installing-1204 – Bryce Nov 11 '13 at 17:58

3 Answers3

25

Re-install your GRUB.

  1. Boot using a live cd of ubuntu.

  2. Open a terminal and run the command
    sudo fdisk -l
    It lists the complete partition table of the hard disk. In there, identify which partition you have got your linux installed on. You can identify it using the drive size you had allocated for it and looking at the last column of the output which will be extended or Linux for all of your linux partitions. The partition will most probably be something like /dev/sda5 or something. Remember this partition.

  3. Create a temporary folder in your home directory (Note: You can make the temporary folder anywhere you want. I’m using the home folder just for the sake of explanation). I’m calling it temp for now. So that temp folder’s path will be/home/ubuntu/temp`.

  4. Mount your linux partition there. That is, assuming that you found your linux partition to be /dev/sda5, you mount that at the temp folder by doing the following command

    sudo mount /dev/sda5 /home/ubuntu/temp

  5. If you want to check whether you have mounted the correct partition, go to your home folder and open temp. You will be in the / directory. In there you will find home, in which your home folder’s name will be there. Once you’ve confirmed you have mounted the correct partition, do step 6.

  6. You have to install grub by showing the system where to read the data from the hard disk at the beginning. Don’t worry, just run the following command

    sudo grub-install --root-directory=/home/ubuntu/temp /dev/sda

    The /dev/sda corresponds to your hard disk name. Replace it by whatever the command sudo fdisk -l command showed you.

  7. You’re done. You may restart your system.

Anwar
  • 76,649
harisibrahimkv
  • 7,256
  • 11
  • 44
  • 71
  • wnen I run the mount command I get the following error: mount: you must specify the filesystem type – andandandand May 29 '12 at 14:29
  • I did sudo mount /dev/sdb2 /home/ubuntu/temp, the partition appeared as "Extended" with fdisk -l – andandandand May 29 '12 at 14:42
  • Are you sure sdb is is your hard disk's name? Confirm that. 2. /dev/sdb2 might be your logical partition container and not the partition in which you installed '/'. So try sdb3 or an other partitions that you have on your system.
  • – harisibrahimkv May 29 '12 at 14:44
  • /dev/sdb2 is marked as Boot and appears with filesystem "Extended" in fdisk -l – andandandand May 29 '12 at 15:00
  • /dev/sdb is plausible too, as it has 40 GB, but it doesn't specify "Extended" or is marked as boot, when I try to mount /dev/sdb I get: mount: /dev/sdb already mounted or /home/ubuntu/temp busy – andandandand May 29 '12 at 15:04
  • /dev/sdb7 appears with System "Linux", not "Extended" and allowed me to mount it.. – andandandand May 29 '12 at 15:05
  • Cool. Check the contents inside it. If you find the folders 'var', 'boot', etc in there, then that's what we need. – harisibrahimkv May 29 '12 at 15:08
  • On the command sudo grub-install --root-directory=/home/ubuntu/temp /dev/sda

    There's a space between tempspace/dev/sda, is that space intentional or a typo? Does it matter?

    – andandandand May 29 '12 at 15:11
  • That space is needed! – harisibrahimkv May 29 '12 at 15:14
  • /usr/sbin/grub-setup: error: will not proceed with blocklists :( – andandandand May 29 '12 at 15:21
  • That is weird. I'm reaching my limit here I guess. Do refer to the following. It might help you: http://ubuntuforums.org/showthread.php?t=1769391 – harisibrahimkv May 29 '12 at 15:26