Zend certified PHP/Magento developer

Installing two identical Linux systems with full disk encryption alongside each other – second one overwrites EFI entries

Disclaimer: I’ve seen a few similar posts online, answers to which suggested that reinstalling grub might help. I tried it (see below), but for me the issue is still unresolved.

I wanted to set up two Debian 11 systems, each in a separate LUKS container. After the second installation I realized that no new boot options appeared in boot menu, i.e. the second installation must have overwritten entries created by the first one. After giving it a thought, it made sense – since both installs are Debian, their EFI entries (i.e. folders in /boot/efi/EFI) must have the exact same names (by default: Debian for shim and debian for grub). Moreover, since the first partition was encrypted, the OS wasn’t detected during installation of the second system, so the installer just went ahead and overwritten the /boot/efi/EFI/debian directory with its own files.

As a result the first system is unbootable.

I tried booting into the second system and chrooting into the first one. From there I reinstalled grub, choosing a name (--bootloader-id) different from the default ones (i.e Debian and debian):

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Debian1

This partially helped – Debian1 boot entry was added and /boot/efi/EFI/Debian1 directory was created. What is more, to my limited knowledge, everything seems in order – both EFI directories contain their own grub.cfg files that point to the correct encrypted volume – I manually checked that. Despite all that, choosing Debian1 at boot time still loads the second, newer system.