#570524 grub-pc installs on first disk instead of boot disk without questions - bricking the computer

Package:
grub-pc
Source:
grub2
Description:
GRand Unified Bootloader, version 2 (PC/BIOS version)
Submitter:
Gabor Nagy
Date:
2010-02-19 15:27:04 UTC
Severity:
normal
#570524#5
Date:
2010-02-19 15:16:24 UTC
From:
To:
I use my linux installation as an external (USB) harddisk. I boot on other computers.
In the past my external harddisk was recognized as sda, the internal disks as sdb.

On this machine that I use now, my disk appears as sdb, internal hdd as sda.

One day I have upgraded some packages, including linux-image.

The next day the owner of the computer told me that she cannot boot anymore,
she only has GRUB, without any menu.

What has happened apparently is that grub has installed itself on the mbr of
sda, and then failed to start the only operating system on the single partition
of that disk.

I don't know what grub does with the install_disk if it only has one partition
with ntfs filesystem and windows installed, but even after replacing the mbr,
this windows still cannot boot. I am not sure this is grub's fault, but I am
suspicious.

I think here is a fundamental problem: I see now, from the configuration that
grub only knows about sda, and thinks that sda is the install_device.  However,
the harddisk sometimes appears as sda, sometimes as sdb, maybe sometimes with
other names. grub should not use sda as the identifier, it should use some
unique identifier instead, like uuid if that exists for a whole disk.

The second problem: if grub knows about sda only, but apparently the
configuration has changed, because now we have sda and sdb, it should at least
give a warning, and ask me if it is OK to install on sda. Also, I think it
would be a better default option to install the boot configuration on the
harddisk that we have used to boot the system (which in my case was sdb).

Third problem: if grub is installed on the harddisk, and there is no grub
configuration to read, I think it should at least try to start the boot block
on the active partition - this way even if it was installed on the wrong disk,
that computer would be able to boot.

Four: it would be nice to be able to undo the last grub installation somehow.
Like I find out that this girl's computer cannot boot anymore, I boot from my
external disk, do grub-undo, and give her computer as it was before grub ran.