Ubuntu – Cleaning up and changing the EFI boot order permanently using eifbootmgr


Alright, so after a few days of figuring out how to dual-boot Windows 8 and Ubuntu 12.04, I made rEFInd my default bootloader.

My problem now lies in my EFI setup:

  1. Ubuntu (ST1…don't feel like typing that out lol)
  2. Windows Boot Manager (ST1…)
  3. Windows Boot Manager (ST1…)
  4. EFI Network 0 for IPv4
  5. EFI Network 0 for IPv6

Here is the thing: 1 and 2 do not work, but I don't want to get rid of them for now. 3 is where my rEFInd is, and I want this to be at the top. Every time I turn on the computer, this is the default boot order. I can change it each time I boot up, but I would prefer not to do so.

I noticed that there was some program eifbootmgr, but I am not exactly sure how to use it. Basically, I want to permanently reorder the list to: 3,4,5,1,2.

If I could get a guide as to how to do so, I would appreciate it 🙂

Rod, so I took screenshots of what happened, and I had a weird result in the boot menu…

enter image description here

enter image description here

Best Answer

Type sudo efibootmgr -v to view your current boot entries. After you type your password, you'll see something like this:

BootCurrent: 0003
Timeout: 0 seconds
BootOrder: 0003,0002,0000,0001
Boot0000* rEFInd Boot Manager   HD(1,28,96000,bc34b60c-6611-492f-99b0-d2c37bd77f48)File(\EFI\refind\shim.efi)
Boot0001* fedora    HD(1,28,96000,bc34b60c-6611-492f-99b0-d2c37bd77f48)File(\EFI\fedora\grubx64.efi)
Boot0002* rEFInd (via PreLoader)    HD(1,28,96000,bc34b60c-6611-492f-99b0-d2c37bd77f48)File(\EFI\refind\PreLoader.efi)
Boot0003* ubuntu    HD(1,28,96000,bc34b60c-6611-492f-99b0-d2c37bd77f48)File(EFI\Ubuntu\grubx64.efi)

Your details will be different, of course. You need to identify your entries and figure out the order in which you want them to appear. For instance, suppose you had these entries you wanted to boot rEFInd via shim by default, then rEFInd via PreLoader second, followed by Ubuntu and then finally Fedora if all the others fail. The desired order would then be 0000,0002,0003,0001. You can then specify that order via the -o option to efibootmgr:

sudo efibootmgr -o 0000,0002,0003,0001

The output will include a less verbose repeat of the original output, with the BootOrder line changed appropriately. Double-check that your changes are correct, then reboot to test that it's working. (Unfortunately, some EFIs are buggy, and there have been bugs introduced by mismatches between efibootmgr and the kernel in recent months.) If you have problems, there are ways to fix it with an EFI shell and its bcfg command, but I'll omit the details unless you report back that efibootmgr doesn't work.