GRUB error 24 in Ubuntu Karmic and the fix

Posted by Double Compile on Thursday, November 12. 2009 in GNU/Linux

I applied a bunch of updates to my installation of Ubuntu 9.10 Karmic Koala this morning. Let it be known that I upgraded to Karmic from a clean install of Jaunty, and my root partition was once an ext3 file system turned into ext4. I returned from taking a shower to find the system had completely locked up, so I rebooted. Anyway, I got just past GRUB and received the following error:

24 : Attempt to access block outside partition
hamster hard drive

As it turns out, the GRUB Manual gives the following as a possible reason.

"This error is returned if a linear block address is outside of the disk partition. This generally happens because of a corrupt filesystem on the disk

So I inserted the Live CD and ran fsck.ext4 -f on the device in question, and no errors were found. Peculiar.

Some Google searching turned up this Launchpad issue, which in turn pointed me to a blog post called "Grub voodoo error no 13/24 and how do i fixed it" for a possible fix.

Allow me to quote from that post (thanks so much, Marius) the correct procedure to fix this beast in case anyone else runs into this little problem. Fill in /dev/sda with the correct device name for your disk containing the root partition.

$ sudo su
$ mount /dev/sda1 /mnt
$ mount --bind /dev /mnt/dev
$ mount --bind /dev/pts /mnt/dev/pts
$ mount --bind /dev/shm /mnt/dev/shm
$ mount -t proc none /mnt/proc
$ mount -t sysfs none /mnt/sys
$ grub-install /dev/sda --root-directory=/ --recheck

I rebooted and everything was fine; crisis averted.


3 Comments for this entry

Display comments as Linear | Threaded

  • roybentig
    *I ran into this problem and this page saved me. I learned a lot as well. My system started life as an 8.04 Ubuntu and is currently runnin 9.10. I recently upgraded the root filesystem to ext4. The thing I find puzzling is why this particular corruption/bug struck while it has booted many times successfully after the ext4 upgrade. Another relevant link which echo's some of the recovery steps is: https://wiki.ubuntu.com/KernelTeam/Grub2Testing I don't understand the specific details of what went wrong but this certainly fixed it, crisis averted :-)!
  • Adam
    *Shouldn't that last line be grub-install /dev/sda --root-directory=/mnt --recheck The change being to pass the mount point to grub-install, after having set it all up!
  • lethalp1mp
    *I think he forgot to add: chroot /mnt after all the mount commands. Then the --root-directory=/ would be valid.

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

Pavatar, Gravatar, Identica, Twitter, Favatar, Identicon/Ycon author images supported.

Quicksearch

Search for an entry in /dev/weblog:

Did not find what you were looking for? Post a comment for an entry or contact us via email!

cronjob