Ubuntu – Problem understanding a grub.cfg line with search.fs_uuid

grub-efigrub2

while learing and adjusting my boot setup, I am stuck unterstanding this content in my grub.cfg on the EFI patition of my drive:

search.fs_uuid <uuid> root hd8,gpt5
set prefix=($root)'/boot/grub'

My hunch is that this finds a specific UUID, sets this as root, then sets root to hd8,gpt5 and then sets the prefix with that root-var setup in order to find the grub loader at the right place.

Now hd8,gpt5 and the uuid are my troubles. My drive with this grub.cfg and EFI folder has the /boot/grub on the fith partition and is a gpt drive – so gpt5 seems ok.

hd8 seems odd, as I do boot this drive I would have expected it to be hd0.

And the uuid I thought it should be the one of the gpt5 partition, but maybe this should be the drives uuid?!

Could someone please explain what is happening here and what the correct values for /boot/grub on a fitht partition of a gpt drive should be? Thanks!

Best Answer

hd8,gpt5 is just hint for GRUB, which is used when uuid is found more than once (multiple partitions with the same UUID).

Full version of the first line could look like:

search --set=root --fs-uuid <uuid> --hint hd8,gpt5

Hint could be, in the most cases, safely ommited (or fixed to actual values without any risk to get unbootable system).