Search This Blog


GRUB Restoring and Editing

A very common problem with GRUB is either losing the GRUB files or having incorrect information in the GRUB pointing to a OS that doesn't exist. I have run into this problem enough times that I figured it would be a good idea to share some of the more important features of troubleshooting and restoring GRUB.

Restoring a lost GRUB menu:

  • Boot into a live CD
  • Open terminal and run:
    • sudo grub
  • Then:
    • find /boot/grub/stage1
    • root (hd?,?)
      • Replace the "?" with the output of the last command 
      • [Like: root(hd0,1), probably
  • Finally:
    • setup (hd0)
    • quit
Adding Boot Items to GRUB
During boot, in Grub hit the C button to enter the command line mode:
  • grub> root (hd0,1) ;where (hd0,1) should be your boot partition
  • grub> kernel /boot/vmlinuz-2.6.XX-xx-generic ;you can use TAB to autocomplete
  • grub> initrd /boot/initrd.img-2.6.XX-xx-generic ;you ca use TAB to autocomplete
  • grub> boot
If you made some mistake with initrd config file you should also see in your /boot directory (with TAB autocomplete) some initrd.bak boot image

Error 15 File Not Found on Startup

  • Hit c:
    • grub>
    • find /grub/stage1
    • find /boot/grub/stage1
  • Using the information you got from the above commands use the following and input the correct boot partition
    • root (hd0,0)
  • Next associate the kernel
    • kernel (hd0,0)/boot/ 
    • hit TAB for auto complete
      • You put the name of the kernel after /boot/

Temporary Fix to change the boot HAD to get into OS
Press “e” to edit grub and you can temporarily change the hda to get in

No comments:

Post a Comment