Maintaing & cleaning up boot files using cool tools like "efibootmgr" command

I tried to create a workable persistent Ubuntu pendrive using Rufus and even Ventoy which I never heard of until yesterday. One of the frequent problems I faced was this:

  • If I update my live OS packages, it will pollute the guest OS grub where I use Fedora only.

I wonder who you guys deal with such scenarios! Do you guys use “apt mark/hold grub2” command or something like that?

This doesn’t only happen while upgrading the live OS package, it also helps, when I tried to install Ubuntu in pendrive. Grub will push itself in boot loader because of which I had to type exit after each normal boot to shift from “ubuntu’s grub menu” to “fedora invisible grub menu”. (Invisible because we don’t really see Fedora grub menu these days, which is cool since it saves time.)

So I googled some sort of tool/command to clean up my grub menu.
I went to this directory /boot/efi/EFI where I saw “ubuntu” directory. I used sudo rm -rf to delete it.

Inside /boot/efi/EFI/boot directory, I see these files:

  2. BOOTX64.EFI
  3. fbia32.efi
  4. fbx64.efi
  5. mmx64.efi

I wonder which one Fedora uses! Please do let me know. I think 1 and 2 are used by Windows, I wonder how it got there. Can I just delete it?!

And last but not least, the efibootmgr command, which is very simple and yet important:

⟹  efibootmgr -v
BootCurrent: 0002
Timeout: 0 seconds
BootOrder: 0002,0003,0001,2001,2002,2003
Boot0001* Fedora	HD(1,GPT,5073d7c8-a7f0-40c1-85df-479f8626cbdf,0x800,0x12c000)/File(\EFI\fedora\shim.efi)RC
Boot0002* ubuntu	HD(1,GPT,5073d7c8-a7f0-40c1-85df-479f8626cbdf,0x800,0x12c000)/File(\EFI\ubuntu\shimx64.efi)
Boot0003* Fedora	HD(1,GPT,5073d7c8-a7f0-40c1-85df-479f8626cbdf,0x800,0x12c000)/File(\EFI\fedora\shimx64.efi)
Boot2001* EFI USB Device	RC
Boot2003* EFI Network	RC

I used sudo efibootmgr -b Boot0002 --delete-bootnum to delete Ubuntu.
I’m curious about my WHY efibootmgr command shows 2 fedora files?! The only difference I see is shim.efi and shim64.efi at the last of their name. Does Fedora use 32 bit to load OS? Isn’t Shim64.efi more faster than Shim.efi? Do we really need both of them? Unlike ubuntu which apparently only needed Shim64.efi to work? EL5 on this one.

Thank you in advance. I’m trying to know how things work along with cleaning my boot menu files. Any tips/ideas are appreciated.

it seem like not from fedora


When I run the catcommand in that file, I do a lot of “Canonical”. You are right.
When I run the same command in BOOTX64 and BOOTA32, I do see lots of “Microsoft” words. I think I can delete this too.

For the double Fedora list in efibootmgr you can test it out with -A to make it inactive and -ato activate again. Please refer to efibootmgr --help. The active list will have * sign after bootnum list and the inactive list will not have * sign and should be hidden on your BIOS UEFI boot list.

1 Like

I have used -A option to disable Fedora…shim.efi, it seems to boot without an issue.
But I don’t delete it yet since it might be important.

Thank you for all info/tips.