My machine is an UEFI enabled ubuntu 20.04, with three partitions:
/dev/nvme0n1p1 boot (grub2+initrd+kernel)
I'm in a situation, that from time to time I need to attach a secondary USB HDD, which is an older replica of my integrated main NVME drive and reboot the PC.
The problem is that all partition names, their UUIDs and etc are identical on both HDDs and the UEFI BIOS upon booting the GRUB2 from the integrated main NVME HDD, will mark it as HD1 and the USB HDD is marked as HD0, thus initrd and kernel booting from the USB HDD, instead of the NVME HDD, which has the latest initrd and kernel. This is the row in my grub.cfg, which makes the issue
search --no-floppy --set root --part-label some_boot_label --hint-efi=hd0,gpt1
Do you know of a dynamic way to identify (search) the nvme0n1p1 and use it, instead of hd0,gpt1 which is static?
device.map will not work, as it is a static file (hostdisk//dev/nvme0n1,gpt1) and reorderring occurs, when USB is inserted. My only guess is to disable the *hci.mod modules, which load the USB devices, but not sure if this is a good idea.
Your help is very welcome