0

I just had a whole series of problems with boot on my Debian system (SID) suddenly it reported:

/grub/i386-pc/normal.mod not found.

Eventually I got it back (fsck moved lots of stuff from /boot into lost+found and I needed to replace via grub-install)

But after it was all working and I did reinstalls of various grub-* packages (in case they were now in lost+found). I noticed the grub.cfg had many differences, of the form:

<               set root='hd2,msdos1'                                                                                                                                                                
---                                                                                                                                                                                                  
>               set root='hd0,msdos1'                                                                                                                                                                
  

                        

An indeed my /boot (and / (root)) device was now /dev/sdc (hd2) and not /dev/sda (hd0). On the one hand I can't see how/why it changed but on the other I realise the /dev/sdX name is not fixed and CAN change from one boot to the next. So given all this my question is:

How can grub.cfg contain entries like:

set root='hd2,msdos1'

Since (there is no mapping file) this equates to /dev/sdc ...what if at the next boot that disk appears as sdb or sda ?

ABTW. The initial cause was probably corrupted /boot ...I note it's ext2 , can't I use ext4? ... and is that not the default now? [ Bug 985470 ]

2 Answers 2

1

It should look something like

    set root='hd0,msdos1'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1'  f19c92f4-9ead-4207-b46a-723b7a2c51c8
    else
      search --no-floppy --fs-uuid --set=root f19c92f4-9ead-4207-b46a-723b7a2c51c8
    fi

So the initial value is just an optional hint. And what it's really doing is searching for a filesystem UUID.

0

It is the task of grub-probe (https://www.gnu.org/software/grub/manual/grub/html_node/Invoking-grub_002dprobe.html) to convert a /dev/sda1 name to (hd0,msdos1).

But if the conversion fails, you can help it with a device-map file (https://www.gnu.org/software/grub/manual/grub/html_node/Device-map.html#Device-map).

You can type grub-probe -t drive / to get the drive of / with the Grub naming scheme.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .