User Tools

Site Tools


howtos:reinstall_grub

Restoring the GNU Grub

  1. Get yourself a LiveCD
  2. Boot using the LiveCD and mount the partition containing your distribution (if it hasn’t been already mounted by the LiveCD distro)
  3. Open a terminal window, gain root access, and type: “chroot /mnt/hd??” OR “chroot /media/hd??” where the first “?” stands for the hard disk letter and the second “?” stands for the partition number. Note that some distributions use “/media” for mounting drives, so check both “/mnt” and “/media” before attempting to manually mount the partition. If you don’t know which is the distribution partition (e.g. If you have multiple distros installed) then just navigate to the directories you mounted on the previous step until you determine which is the right one. Typing just “mount” should reveal any automounted filesystems
  4. Type “grub”, a message saying “Probing devices to guess BIOS drives” should appear, just wait for a couple of minutes and soon you will see the grub prompt (it looks like “grub> _”)
  5. Type “find /boot/grub/stage1”. The result will be like “(hd0,5)” or perhaps “(hd0)”. Keep this in mind because it is a key-text for the next steps.
  6. Type “root (hd?,?)”, replace the question marks with what the output of the command above was.
  7. Now we are ready to install grub, select one of the following options depending on the place you want to install grub:
    • If you want to install grub on the MBR (recommended for most installations) type “setup (hd?)” where “?” is the result BEFORE the comma that command in step 5 returned
    • If you know what you are doing and want to install it on a separate partition, type “setup (hd?,?)” where the first “?” stands for the pre-comma output of the command of step 5 and the second “?” stands for the partition number.
  8. Type “quit” to exit the grub prompt
  9. Reboot the computer and remove the LiveCD, grub should now appear

Source: http://lignuxer.blogspot.com/2007/02/restoring-gnu-grub_15.html

howtos/reinstall_grub.txt · Last modified: d/m/Y H:i by domingo