Search

Error 17 while trying to reinstall the grub

 Issue:  Error 17 while  trying to reinstall the grub 


Background: 

 If you happened to install ( or reinstall ) windows after installing Linux, you would not be able to see the grub menu. That is because our dear windows assumes that it is the only OS on the system and over writes the MBR ( Master Boot Record) which erased the Grub ( boot loader for Linux).
The easiest work around is always install Windows first and then Linux, because Grub boot loader makes sure to keep what is previously installed.

The standard way of reinstalling Grub, in case you are not using Grub2 is.

Boot using a Live CD
open a terminal
Type the following commands

  • sudo grub ( this should take you to a grub prompt) 

  • root (hd0,0)
  • setup (hd0). 
  • quit. 
There are chances that you when you type the third command ( i. e. setup (hd0) ) 
you might get an error  
error 17 can not mount partition ( or some thing similar) 

This is because the command that we executed before i.e. root (hd0,0)  we have passed the wrong number in the second argument. To know what to pass 

run the command ( in the Grub Prompt itself) 
find /boot/grub/stage1 

this will give you an output with the right partitions ( i.e.  hd(0, "some number"). 

Use this number in the above "root" command and the run the "setup" command and you should be able to reinstall the grub successfully. 

Follow by Email