Dual boot and the files /boot/grub/grub.cfg -- which one is used?

Say, I have 2 linux systems. They both of them have /boot/grub/grub.cfg, but the one that's used on boot is from one of them. There's no /boot partition. How is it determined which /boot/grub/grub.cfg should be used and how change that?

I have 1 physical disk, 2 partitions and UEFI/GPT.


It's not quite clear from your question but I believe:

  • Assuming we have two physical disks, it'll depend on where BIOS/UEFI is looking. Otherwise known as the boot order. This is slightly different with UEFI because the installer talks directly to the system to install its shim, but you could have two systems with two separate UEFI shims installed. The order is decided by the system at boot.

  • Assuming two partitions on one physical disk with BIOS, it'll depend on who wrote to the MBR (master boot record, beginning portion of the disk) last (at install, or since you ran install-grub). They can overwrite each other if you reinstall grub. update-grub should only update the local configuration.

  • Assuming two partitions, one physical disk, UEFI, both should be able to co-exist peacefully. You'll get a pick of order at boot at the system level, and each bootloader might know about the other one but they aren't competing for one MBR.