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
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.
2010-02-06 09:43 at 09:02 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 !
2010-04-10 07:11 at 07:04 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!
2010-06-10 05:01 at 05:06 I think he forgot to add: chroot /mnt after all the mount commands. Then the --root-directory=/ would be valid.