grub-efi overwrites an existing grub*.efi file

Bug #1056101 reported by YannUbuntu
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)
Opinion
Wishlist
Unassigned

Bug Description

On Ubuntu 12.04 (grub 1.99), grub-efi creates a /efi/ubuntu/grubx64.efi file, which is recognized as an entry in the UEFI firmware.

When you install two Ubuntu (let's say UbuntuA, then UbuntuB) in dualboot, UbuntuB will overwrite the /efi/ubuntu/grubx64.efi file (linked to UbuntuA) by a new /efi/ubuntu/grubx64.efi file (linked to UbuntuB).

THE PROBLEM IS:
if UbuntuB's /boot/grub/grub.cfg is damaged or erased, the user can't access neither UbuntuA nor UbuntuB.

EXPECTED BEHAVIOR:
UbuntuA creates its own entry (eg /efi/ubuntu/grubx64_uuidA.efi ), and UbuntuB creates another entry (eg /efi/ubuntu/grubx64_uuidB.efi ), so that if UbuntuB's /boot/grub/grub.cfg is damaged, the user can still access UbuntuA via the UEFI firmware.

YannUbuntu (yannubuntu)
description: updated
Revision history for this message
Phillip Susi (psusi) wrote :

Note that if the primary config file is missing or corrupt, the grub rescue shell provides enough functionality to direct it to the config file of the other install, allowing recovery from such a scenario.

Changed in grub2 (Ubuntu):
importance: Undecided → Wishlist
status: New → Triaged
Revision history for this message
Jeremie Tamburini (jeremie2) wrote :

Discovered the same problem on Ubuntu 14.04 and 14.10.

One of the worst thing is that a step of the installation (GRUB position in the "mount point" settings) is just broken and doesn't work properly with multi-boot systems. The last installed *buntu will be always set as the default system, even if you DON'T select /dev/sda for GRUB.

After every installation I have to use BootRepair to set the system that I wanted as the default one. Other wise I can leave everything as it is, with a secondary system set as default, but at every kernel update there's the need to run the secondary system to run the "update-grub" command...

As this bug seems to be quite old, I'm afraid that probably there isn't an easy solution.
Is there at least a easier/faster workaround?

Revision history for this message
Jeremie Tamburini (jeremie2) wrote :

Today I was updating one of the system (Lubuntu) on one of my test partitions.
The system wasn't the default one at the boot, but as the grub packages have been updated, after the re-boot I have discovered that it was set as the boot default system...

This bug creates problems even with the updates.

At least I have found a quicker workaround here http://superuser.com/questions/376470/how-to-reinstall-grub2-efi
All you have to do is booting from the grub menu the *buntu system you would like as the default one and run this command:

sudo apt-get install --reinstall grub-efi-amd64

This might sounds obvious, but every time I was searching informations related to grub/uefi I always found instructions for external instruments such as boot-repair.

Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote :

This release of Ubuntu is no longer receiving maintenance updates. If this is still an issue on a maintained version of Ubuntu please let us know.

Changed in grub2 (Ubuntu):
status: Triaged → Incomplete
Revision history for this message
Jeremie Tamburini (jeremie2) wrote :

Bug is still there.

Quick example when my computer starts:
if I don't do anything, Ubuntu 19.10 will be booted.
If I press [F12] I get the Boot Menu list, which shows:
1. ubuntu
2. deepin
3. CD/DVD Drive ...
4. Drive0 HDD ...

There is only 1 entry for Ubuntu (which is the one for 19.10) but on my computer there are totally 4 different Ubuntu releases:
- Ubuntu 14.04
- Ubuntu 19.04
- Ubuntu 19.10
- Ubuntu 20.04

They should be all mentioned in the Boot Menu, but there is just one entry.

If you install one of the Ubuntu versions, it will be automatically set as the only "ubuntu" Boot Menu entry. It will also be set as the default system on boot.
To change it you have to boot the Ubuntu version you want as the default one at boot, and run the command "sudo grub-install".

P.S.
I apologize for my old messages (#2 and #3) as they were not strictly connected to this bug, sorry!

Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote :

Thanks for the update Jeremie.

Changed in grub2 (Ubuntu):
status: Incomplete → Triaged
Revision history for this message
Mate Kukri (mkukri) wrote :

I believe the expected solution is to use the GRUB from the latest Ubuntu installed on such a disk, and let that GRUB boot older releases.

I am also not 100% sure if dual-booting two revisions of GRUB on one disk was ever a supported scenario anyhow (even on BIOS GRUB was installed to the MBR). Additionally no other UEFI aware OS seems to do what's proposed.

Setting this to "Opinion" as this is a fundamental change on how the bootloader is installed, and should be proposed upstream instead.

Changed in grub2 (Ubuntu):
status: Triaged → Opinion
Revision history for this message
Jeremie Tamburini (jeremie2) wrote (last edit ):

@mkukri
A couple of years ago I had 2 installations of EndeavourOS on two different partition, and the Efi menu showed 2 different entries. I can't remember exactly but the menu entries looked like these:
- EndeavourOS 12345...
- EndeavourOS 14789...

I don't know if the boot process is meant to work as it works in Ubuntu or as it works in EndeavourOS. At least it looks it is possible to have two different Efi menu entries for 2 different installation of the same system... and it's good.
If for any reason my default system is broken and I can't access the other grub menu entries, I can still select a working system from the Efi menu. I recently had a situation like that.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.