For several releases, grub-installer sometimes could not find the right place to install the bootloader. See:

Objectives

History

Behaviour in wheezy

http://anonscm.debian.org/cgit/d-i/grub-installer.git/commit/grub-installer?id=422f689aa22cca77e2d476b016c628844cf67a0e

http://anonscm.debian.org/cgit/d-i/grub-installer.git/commit/grub-installer?id=2ef649c4f7617b9fc085d278e962500c58bc04e5

http://anonscm.debian.org/cgit/d-i/grub-installer.git/commit/grub-installer?id=25d35cb658723f58ad2ab617732cdd44fa768510

:TODO: what happens if existing bootloader / OSes are detected?

Behaviour in current daily d-i

the same complex logic as before http://sources.debian.net/src/grub-installer/1.96/grub-installer/?hl=641#L678

if (hd0) seems correct after the checks above, it will ask to install to "the MBR of the first disk" (this yes/no dialog doesn't give the user any information to help identify the disk)

otherwise, a new dialog asks the user to confirm http://sources.debian.net/src/grub-installer/1.96/grub-installer/?hl=641#L608

the first option is "Enter device manually", followed by $dev_list in grub-mkdevicemap order; each device listed in the dialog includes a description to help identify it

choosing "Enter device manually" gives a much less informative dialog asking for an exact device path

:FIXME: in the first dialog, $default_choice is supposed to preset the default selection to our best guess - is that not working properly?

in preseed installs, "Enter device manually" seems to be always chosen and the install gets stuck, see:

Dialogs

    Install the GRUB boot loader to the master boot record?
    <Go Back>  <Yes> <No>

This is not very good. It is sometimes wrong about which disk has the MBR. It doesn't give information to help the user identify the device before confirming. This dialog is only shown in some cases (typically CD/DVD/PXE installs).

    Device for boot loader installation:
    [o] Enter device manually
    [ ] /dev/sda (ata-QEMU_HARDDISK_QM00001)
    <Go Back>

This dialog (new since wheezy) is much better. Sometimes(?) the default selection is something other than the "Enter device manually" option. All devices detected by grub-mkdevicemap are listed, along with some information to help identify them.

    Device for boot loader installation:
    /dev/sda________
    <Go Back>  <Continue>

This is also not very good. Only an expert user should be asked something like this. No list of detected devices is shown. It is too late to return to partman and look at mount points.

Test cases

#

version

arch, platform/hardware

install media

install target

other

result

references / who can test

1

wheezy

i386 on old Fujitsu Amilo laptop

Xfce ISO booted from USB stick

the first hard disk (of two)

manual, whole-disk LVM

{X} asks to enter device manually, pre-filled with /dev/sdb (correct) but the instructions are to use /dev/sda for the first disk (which is wrong, that's the install media); detection is right but the user is given wrong instructions

n/a - not my laptop

2

jessie d-i daily 20140908

linux-i386 in Qemu

PXE

the only hard disk

-

(./) grub-installer guesses (hd0), asks (yes/no) whether to install to MBR, it works

anyone: qemu -hda hda.raw + TFTP options

3

jessie d-i daily 20140911

kfreebsd-amd64 in Qemu

PXE

the only hard disk

-

(./) grub-install does *not* assume (hd0), actually due to a bug, instead asks to choose from a list (other; /dev/ada0), but works if choosing /dev/ada0

stevenc

4

jessie d-i daily

amd64 in VirtualBox

ISO image mounted as virtual CD-ROM

the only hard disk

auto preseed

{X} grub-install does *not* assume (hd0), but instead displays the new dialog of "Enter device manually" and only one more option (the only disk); this dialog interrupts the preseed process

mail on -boot@

5

jessie d-i daily 20140914

kfreebsd-amd64 on BigV.io

mini.iso as virtual CD-ROM

the first hard disk (of two)

expert mode; gpt, ZFS root, /boot on UFS

{X} asks (yes/no) whether to install to MBR, then asks to "Enter device manually" with no other options - grub-mkdevicemap doesn't understand recognise virtio device /dev/vtbd0

stevenc

6

jessie d-i daily 20141001

linux-amd64 in Qemu

mini.iso as (first) virtual hard drive

one real hard disk

-

{X} 763580 pre-selects /dev/sda in list

anyone: qemu -hda mini.iso -hdb foo.cow

TODO: add examples of real hardware, which is where we have the most issues

When the detection is right

most CD/DVD installs? PXE installs?

When the detection is wrong

most(?) installs from a removable USB stick; the removable drive may appear as the first disk drive; the install media is broken if the bootloader is overwritten, and the system's real hard drive left without a bootloader

installs to an external hard drive (but is it possible to guess the user's intent in this situation?)

perhaps when firmware is loaded from USB stick - could be inserted before or after boot - could grub-mkdevicemap ever mistake it for (hd0)?

multipath? SATA RAID?