8

I use Ubuntu 18.04 on my computer. This Ubuntu installation appears as ubuntu at system EFI boot menus.

I also have a external USB storage that has a EFI Ubuntu installation. This external USB storage also appears with the name ubuntu at system EFI.

I see two ubuntu menus at system EFI boot menus when external USB storage is attached. This makes it hard to figure out which ubuntu menu item points to the Ubuntu installation on the computer, and which one points to the Ubuntu installation on the external USB storage.

How I can change the EFI boot label to something different?

For example, how can I change ubuntu EFI boot label on the external USB storage to appear as External Ubuntu at system EFI boot menus?

The Ubuntu on my external USB storage has its own EFI partition.

This question is different from How to safely change OS name in grub boot menu?

This question is about how to change the Efi Boot name that appears in the EFI Firmware setup and not in the GRUB boot menu.

Picture of EFI Firmware setup

Zanna
  • 70,465
user8888180
  • 91
  • 1
  • 1
  • 4
  • can you attach a pic please? – PRATAP Mar 15 '19 at 13:48
  • 2
    Old bug, not resolved. https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1561712 Your two entries are grub & shim from last installed Ubuntu. You currently cannot have two entries with default installs. But if external drive you can boot it directly, if you have ESP on external and move boot files/ESP to it as external drives boot from /EFI/Boot/bootx64.efi as fallback entry. And that goes by drive name. – oldfred Mar 15 '19 at 14:48
  • Thanks @oldfred for comments. Those two "Ubuntu" entries are not from same Ubuntu installation on same storage. The external drive is portable and independent. it has its own ESP. It can be booted on different computer.

    As soon as I boot from external device, it add its own "Ubuntu" entries to the list. Both "Ubuntu" entries works and point to right Ubuntu installation, they just have same name. My question is how I can change that "Ubuntu" entry to something different when I connect my external device to a different computer.

    – user8888180 Mar 15 '19 at 15:01
  • Then link to duplicate should work. I have changed name, but with multiple ubuntu installs in one ESP different name shows up, but /EFI/ubuntu/grub is only file used to boot. If separate UEFI, then each should use the GRUB_DISTRIBUTOR= setting. Its just in grub and UEFI it really is a "efi_distributor" variable which we cannot reset to enable separate labels in one ESP. – oldfred Mar 15 '19 at 15:16
  • @oldfred I applied following after booting into external storage:

    sudo nano /etc/default/grub

    GRUB_DISTRIBUTOR=lsb_release -i -s 2> /dev/null || echo Debian

    GRUB_DISTRIBUTOR="EXTERNAL UBUNTU"

    sudo update-grub

    After shutdown, replug and restart, again same second "Ubuntu" entry added to EFI firmware boot menu followed by displaying "EXTERNAL UBUNTU" when grub menu appeared after boot.

    The link to duplicate post only change the Ubuntu name when grub menu appear. It does not change the "Ubuntu" entry at system firmware Efi menu that displays before grub menu.

    – user8888180 Mar 15 '19 at 16:17
  • The efibootmgr that grub uses to update ESP, uses default "ubuntu", you can create your own entry with your description. See second entry as it is not default sda1 that you want to change description on. And it is the bootx64.efi if external. https://askubuntu.com/questions/668506/changed-the-uefi-motherboard-on-a-dell-laptop-now-it-says-no-os-detected & more examples: https://askubuntu.com/questions/486752/dual-boot-win-8-ubuntu-loads-only-win/486789#486789 – oldfred Mar 15 '19 at 18:34
  • Thanks @oldfred for those links. Close to solution but not prefect. After applying following:

    sudo efibootmgr -c -L "External Ubuntu" -l "EFI\BOOT\BOOTX64.EFI"

    A new working "External Ubuntu" entry added to EFI firmware boot menu but it disappear if I unplug the external storage. It do not appear if I plug the external storage again. While this might work for fixed storage, It does not work for removable storage. It seems this solution only update EFI firmware and not the ESP. The original "Ubuntu entry always appears at EFI firmware menu and it appears somehow hard coded in ESP!.

    – user8888180 Mar 16 '19 at 14:54
  • With an external install, UEFI boots by default from /EFI/Boot/bootx64.efi and uses the description/label of the drive. But an entry in UEFI to boot an install can have any description you want, but when a drive is disconnect UEFI resets entry, so if always unplugging drive, you can only boot from hard drive or similar external drive boot in UEFI. Not sure if way to change default UEFI description, probably in UEFI code, not anywhere else. – oldfred Mar 16 '19 at 15:45
  • EFI takes the boot entry label from the name of the folder in the ESP. If you simply rename the folder ubuntu to ubuntu external on the ESP of the external drive. Since grub is installed there with the --removable-option (this makes the entry not to appear when the drive is not connected), you should see the desired label on next boot. Caveat: when a new version of grub is going to be installed, you will again see an extra ubuntu entry, the folder will be recreated thus would need to be removed. Or remove the folder ubuntu external and rename the new folder like done before. – mook765 Nov 30 '20 at 10:36

2 Answers2

5

I had exactly the same issue with Ubuntu 18.04 on my Lenovo S540: two similar-looking "ubuntu" entries in the boot menu, one for the system on the local drive, and another for the system on the USB drive.

I saw a number of discussions suggesting to remove ambiguous boot entries and to re-create them with efibootmgr:

Something like this:

efibootmgr --create --disk /dev/sda --part 1 --label "My new label" --loader \\EFI\\ubuntu\\shimx64.efi

These discussions convinced me this technique should work, and it did the job for me. The entry for the USB drive does not disappear upon drive disconnection, and it is even listed as available boot option when the external drive is missing. It still may be that different EFI firmware flavors (Lenovo vs whatever) behave differently in this respect...

Continuous exercising with renaming these entries motivated me to write an automation tool :) , that is now available as https://github.com/s-n-ushakov/rename-efi-entry

Please feel free to try and comment...

Sergey Ushakov
  • 283
  • 3
  • 8
2

When you run grub-install on an EFI system, it will set the name of the EFI menu entry, by default to the grub_distributor config entry. On Ubuntu this is set in /etc/default/grub (GRUB_DISTRIBUTOR=`lsb_release ...`).

  1. Change GRUB_DISTRIBUTOR in /etc/default/grub.
  2. Run update-grub to update the GRUB configuration files.
  3. Run grub-install to (re)install GRUB in the EFI menu - now with the new name.
  4. You might have to manually remove the old EFI menu entries.