Jump to content

grub-install problems


oldwierdal
 Share

Recommended Posts

I recently encountered a problem with a lost or damaged MBR. There are a number of ways that this might happen. One of them is mixing dual-boot or multi-boot installations of IDE or scsi device naming schemes, e.g. /dev/hdx or /dev/sdx.

Usually, booting the install media and typing "linux rescue" at the prompt will take you, after answering a few questions and choosing the installation location of the OS you want to use for the boot loader, to a terminal. Then type "#chroot /mnt/sysimage", enter, and you can then cd to your /boot/grub directory, check and/or edit your grub.conf or menu.lst, and then type "#grub-install /dev/hdx (or /dev/sdx). The return will show the layout of your system, and you're done. Exit out of the rescue mode and reboot, and your grub menu is there.

However, this time, when I would type "#grub-install /dev/hda, this would be my return;

#grub-install /dev/hda

/dev/hda does not have any corresponding BIOS drive.

 

The most important thing I've learned in 40 years of fixing things, and 5 years of playing with Linux is this, DON'T PANIC!

Think, study, research, ask for help. Just don't do anything rash that you might not be able to recover from.

In this case I was fortunate, in that I was able to use the rescue mode as described above to finally find an OS,(I currently multi-boot with CentOS 5.2, Mandriva 2008 Spring, Mandriva 2009, and Ubuntu.) that I could do "grub-install" on and get my system to boot, even though it didn't happen to be my preferred installation. At least I had a working system from which I could work and try to find the problem.

My searching led me to this;

http://forums.fedoraforum.org/showthread.php?t=153679

 

Stoat, the author of this gem, explains this far more eloquently and intelligently than I could. I recommend reading this post thoroughly if you have questions about this. It is really quite good.

 

This is what I had for device.map in two of my installations;

The first is from the CentOS installation;

$ sudo cat /boot/grub/device.map

(hd0) /dev/sde

(hd1) /dev/sda

(hd2) /dev/sdb

(hd3) /dev/sdc

The next is from the Mandriva 2009 installation;

$ sudo cat /hda9/boot/grub/device.map

(hd0) /dev/sda

(hd1) /dev/sdb

(hd2) /dev/sdc

(hd3) /dev/sdi

 

Note the discrepancy between the two. Because of the screwy device.map(s), grub-install was confused, and couldn't install.

 

Following the information in the above link, I did this;

 

$ sudo /sbin/grub-install --recheck /dev/hda

 

and the return, as expected, described the device layout and succeeded.

My device.map then looked like this for the CentOS installation;

$ sudo cat /boot/grub/device.map

(hd0) /dev/hda

(hd1) /dev/hdb

(hd2) /dev/sdb

(hd3) /dev/sdc

and this for the Mandriva 2009 installation;

$ sudo cat /hda9/boot/grub/device.map

(hd0) /dev/sda

(hd1) /dev/sdb

(hd2) /dev/sdc

(hd3) /dev/sdi

Although they aren't identical, the drive order, allowing for the difference between IDE and scsi scheming, follows the same sequence.

So, I hope this information might be helpful if you should encounter a similar problem.

 

Thanks,

owa

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...