My config: opensuse 11.4, boot partition at pendrive and hard drives with partitions sda1, sda2, sdb1.
Today I changed chassis for my computer, and by mistake I attached second drive to SATA 3 instead of SATA 2. So second drive was not mounted correctly. I turned off computer, attached it correctly and then my problem started.
Now, I cannot boot system at all. Previously I set booting from removable drive in BIOS (pendrive), but now it seems computer (BIOS) does not recognize pendrive as removable drive, but regular HDD. So it won't boot for "removable drive". When I change boot order, and select to boot from hard drive (and I set first hard drive as pendrive) or if I directly set from boot menu to boot from pendrive I get error in GRUB which goes into rescue mode.
My guess is, since because of some reason, pendrive is no longer recognized as removable media, but hard disk, hard drives are mapped differently and I should fix the mappings.
I can boot CD installer and mount pendrive to see the content of grub config, but when I am in grub rescue mode and I execute "ls" I get
(hd0) (hd0,msddos1) (hd1) (hd1,msddos2) (hd1,msdos1) (hd2)
(hd2,msddos1)
But I don't see the mapping, so I don't know what hd0 really means. I can only suspect hd1 here is sda, because it has 2 partitions (if suffix msdsos is indication of partitions).
How can I make grub work again?
Best Answer
The problem is probably with grub seeing usb disks at boot time differently than once run from a running system. Here's how you might solve it:
When you boot (normally, from the hd) and grub appears, open grub console (usually you do that just by pressing
c
). At grub prompt, start typingroot (hd
:then press Tab and you'll see the disks as possible completions. Choose the disk and partition where your
/boot
is. If you are not sure, then with each one you suspect, do the following:root
command to choose the partition and press Enter)cat /
and press Tab. You will see the list of files found on the partition./boot/
).Once you've found how the partition is known to grub, you can re-install the boot loader (using
setup
command) and point to the correct partition/files in your/boot/grub/menu.lst
or/boot/grub/grub.conf
(you must determine, which of those your version uses, or just make them contain the same).[Edit]: Per special request form Macias, here are more details on how to fix the MBR using grub:
One way to re-install the MBR on a drive using
grub
is thesetup
command I referred to above. This is a command known to grub versions 0.9X (see the Documentation). But you seem to be using the newer branch of grub (1.9X) and the commands for it are different. Have a look at the corresponding documentation - in this version, you can install grub to the MBR using thegrub-install
utility and I am not sure if there is any other way - from the grub "rescue" prompt, as with grub-0.97. Maybe not and maybe that is one of the reasons why many distros prefer the "legacy" version.