For some reason on upgrading my kernel on a Fedora 11 install just now, I found on reboot that my grub install was no longer working.
I think possibly the offending laptop went into standby instead of a proper reboot (not my fault of course!)

Anyways a bit of research and use of a linux boot disk and I was able to restore grub.

  1. I had to boot from the Fedora 11 install DVD I originally installed with.
  2. I then went into rescue mode rather than going through with an install
  3. I asked the rescue mode to search for my local Fedora installs and mount them under /mnt/sysimage
  4. Using fdisk and blkid /dev/sdaX I figured out which was my boot partition .. sda5 in this case
  5. I then mounted proc and dev and boot under /mnt/sysimage
  6. Then I changed root into /mnt/sysimage
  7. I ran grub, pointed it at the boot partition from my hard drive (the find part didn’t work for me, might for you, but I carried on regardless)
  8. and ran setup to correct the broken grub boot stages

After a reboot, everything was hunky dory ( except I needed to update my proprietory graphics drivers still for the new kernel but that’s not the point )


# mount -t proc none /mnt/sysimage/proc
# mount -o bind /dev /mnt/sysimage/dev
# mount -t ext3 /dev/sd5 /mnt/sysimage/boot
# chroot /mnt/root /bin/bash
# grub
grub> find /boot/grub/stage1
grub> root (hd0,4)
grub> setup (hd0)
grub> quit
# exit
# exit

My boot partition was on sda5, but in grub speak that is hd0,4 as it counts from zero. hd0 just represents the boot drive and should be used verbatim.

And now for some light relief as grub is maintained by GNU and GNU need lots of attention and Stephen Fry is probably a better face for GNU than that weird horned thing…

Stephen Fry talks free software

Stephen Fry talks free software

Check out this highly informative video

References:
http://ubuntuforums.org/showthread.php?t=224351
http://stallman.org/fry/

Categories: LAMP

Jonathan Adjei

Jon's expertise in web development is legendary and he oversees all technical aspects of our projects from development to hosting (all through the command line!) Jon is excited by the latest techniques and keeps the company on track by finding ways to adopt new practices into our workflow.