1

When I run grub-mkconfig on Debian 10, it generates something like:

...
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  fc6c3fbf-8cfc-411c-ac5d-072c6e8c8092
        else
          search --no-floppy --fs-uuid --set=root fc6c3fbf-8cfc-411c-ac5d-072c6e8c8092
        fi
        linux /boot/vmlinuz-4.19.0-9-amd64 root=UUID=e0674dbf-3546-4898-9933-c9eb55703cb5 ro single
        initrd /boot/initrd.img-4.19.0-9-amd64
...

What is being done in this piece of the program and why does it use different UUIDs? And where are these UUIDS taken from?

1

These are the UUIDs for two file systems / and /boot.

The first section tells grub how to find the /boot partition containing the Linux Kernel (and initramfs):

    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  fc6c3fbf-8cfc-411c-ac5d-072c6e8c8092
    else
      search --no-floppy --fs-uuid --set=root fc6c3fbf-8cfc-411c-ac5d-072c6e8c8092
    fi

The next section tells grub to boot Linux, passing the root kernel parameter which controls the file system it uses as /:

linux /boot/vmlinuz-4.19.0-9-amd64 root=UUID=e0674dbf-3546-4898-9933-c9eb55703cb5 ro single

I've never investigated how it finds them but ultimately they are controlled by /etc/fstab. It's worth noting that if you change fstab to point to a different / or /boot you should always run this after as root:

update-grub
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.