Total Pageviews

Tuesday, October 09, 2012

Grub error 17 and a possible solution


Give this a try if you are getting grub rescue:
  1. At grub>. enter these commands
    find /boot/grub/stage1
    
    This will return a location. If you have more than one, select the installation that you want to provide the grub files.
  2. This is important: what was returned for the find command use it in the next line for the "?" -
    root (hd?,?)
    
    Again use the value from the find command i.e. if find returned (hd0,1) then you would enter root (hd0,1)
  3. Next enter the command to install grub to the mbr
    setup (hd0)
    
  4. Finally exit the grub shell
    quit
    
Now you are done. Reboot the machine.

Another option is to run this command:
grub-install /dev/hda

If you don't have grub rescue:

  1. Try booting from a live CD
  2. In case Live CD doesn't have package "grub" install it first (eg. sudo apt-get install grub)
  3. Take a look at your partition table: sudo fdisk -l
    /dev/sda5            1276        1397      979902   82  Linux swap / Solaris
    /dev/sda6            1398        2550     9261441   83  Linux
  4. In this case grub should be installed on /dev/sda6 (in grub this is hd0,5).
    NOTE: Every device in grub starts with "hd", even if it's a SATA device.
  5. Type in the following in a shell:
  6.  sudo grub  
     grub > root (hd0,5)  
     grub > setup (hd0)  
     grub > quit  
    
  7. More infos can be found in this article.