Ask Your Question
0

Way to stop Fedora making boot entries in UEFI NVRAM?

asked 2014-04-30 21:44:31 -0500

Charlweed gravatar image

updated 2014-04-30 22:00:08 -0500

I have a Dual boot UEFI system. Its a Gigabyte GA-Z87X-HD3 motherboard. /dev/sda and /dev/sdb are different SSD drives. After successful install of UEFI Windows and UEFI Fedora, I discovered that literally every other boot wold fail. Grub would not even load. The problem is/was a bogus boot entry in UEFI NVRAM. I used efibootmgr to delete it,and verified that it was gone. Two reboots later, and grub failed to load again. After manually specifying the beootloader, and re-entering Fedora, I saw the bogus entry was back! Here is the output from efubootmgr:

efibootmgr -v
BootCurrent: 0002
Timeout: 1 seconds
BootOrder: 0000,0002,0003
Boot0000* Fedora        ACPI(a0341d0,0)PCI(1f,2)03120a000100ffff0000HD(1,800,64000,960aab70-1e59-4f31-a3b6-d175e512a6a7)File(\EFI\FEDORA\shim.efi)..
Boot0002* UEFI OS       HD(1,800,64000,960aab70-1e59-4f31-a3b6-d175e512a6a7)File(\EFI\BOOT\BOOTX64.EFI)
Boot0003* Windows Boot Manager  HD(1,800,32000,cf3514ac-5ddc-40c0-8e4a-f22c8404f83a)File(\EFI\Microsoft\Boot\bootmgfw.efi)

The bogus entry is 0000, "Fedora ACPI(..." . For whatever reason, that entry does not work, while the other entries do. Worst, it keeps reappearing after I delete it. Why? Who is creating it, and how do I stop it? TY!

edit retag flag offensive close merge delete

Comments

This is likely a bug in grub/shim: shim Bug 995834

Charlweed gravatar imageCharlweed ( 2014-04-30 21:59:10 -0500 )edit

I experienced something similar on my HP EliteBook 840 running in UEFI (with CSM) mode; Fedora would create new UEFI boot entries (functional however) on every reboot and change boot order to the newly created one. The UEFI firmware would use the CSM-related Boot0000 entry no matter what though. However, I noticed that when booting from the actual Fedora UEFI entry everything would work fine without extra entries created, so I used the Customized Boot Option to specifically boot using \EFI\fedora\shim.efi . See https://wiki.archlinux.org/index.php/HP_EliteBook_840_G1 for details.

joelpet gravatar imagejoelpet ( 2015-01-04 09:45:01 -0500 )edit

Some problems can be fixed with different configuration or just learning usage - this isn't one of those problems. It's a bug. I think this type of bug is usually caused by your firmware working poorly, so check for and apply firmware updates. If that doesn't help, ask the Fedora maintainers for help.

This appears to be a different bug, but filing a bug is the correct approach to getting a real solution to the problem, and #995834 serves as an excellent template to follow. I'm curious, though - does the "UEFI OS" boot entry load Fedora?

randomuser gravatar imagerandomuser ( 2015-01-04 14:35:32 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-05-02 13:56:17 -0500

Charlweed gravatar image

updated 2014-05-02 14:10:59 -0500

OK, let's try this as a work-around. Here is a crude work-around to make booting less painful until this bug is fixed. It is a script and a system service file. To use: Use efibootmgr to create a working boot entry, and test it by booting to your uefi firmware, and manually selecting that boot entry. See the example in the script, and find an uefibootmgr tutorial via Google. Once you gave a good boot entry, install my script and the service:

As root, copy the script text to /root/bin/uefibootrepair (or wherever else, but then you must change the service file). Edit the script so that you have the boot order you want. Then, still as root, copy the service text to /lib/systemd/system/uefi-repair.service, and use systemctl to enable it.

mkdir /root/bin

{use editor to create /root/bin/uefibootrepair and paste script text into the file}

chmod ug+rx /root/bin/uefibootrepair

{use editor to create /lib/systemd/system/uefi-repair.service and paste service text into the file}

systemctl enable uefi-repair.service
systemctl daemon-reload

Good luck

****SCRIPT*****

    #!/bin/bash
    #**************************************************
    #  IMPORTANT !!!!
    # Ensure that the boot entry that you 
    # want to keep does not have a label containing the
    # string "Fedora" !!!
    # Before you run this script, manually create a boot
    # entry where the label does NOT contain this string.
    # For example, to delete the existing boot entry 0000, and
    #  create a  new one labled F-e-d-o-r-a
    #    efibootmgr --bootnum 0000 --delete-bootnum 0000
    #    efibootmgr --bootnum 0000 --create  --disk /dev/sdb --part 1 --write-signature --label "F-e-d-o-r-a"  --loader \\EFI\\BOOT\\BOOTX64.EFI

    #**************************************************
    #  This workaround is rather brittle and is specific to the
    # current state of shim bug Bug 995834. It eliminates
    # all boot entries that contain "Fedora". It works with 
    # efibootmgr version 0.5.4, YMMV
    #  Run as root manually, but for best results use systemd 
    # to run it at startup and before shutdown.
    set -u
    bootnums=""

    badentries=$(efibootmgr | grep Fedora )

    if [[ $? -ne 0 ]]; then
        exit 0
    fi

    if [[ -z badentries ]]; then
        exit 0
    fi

    for badentry in $badentries
       do
        if [[ "$badentry" = Boot* ]];then   
            if [[ -n $bootnums ]];then
                bootnums=$bootnums","
            fi
             bootnums=$bootnums""${badentry:4:4}
        fi
    done

    for bootnum in $bootnums
     do
        efibootmgr --bootnum  $bootnum --delete-bootnum $bootnum
    done

    #   When you know your correct boot order, uncomment these lines,
    # and edit the bootorder command it so that the correct order is stored.

#efibootmgr --delete-bootorder
#efibootmgr --bootorder 0002,0001
#efibootmgr --verbose

*****SERVICE*******

[Unit]
Description=Remove bogus boot entries
#This service runs a shell script to remove bogus boot entries inserted by shim bug 995834

[Service]
Type=oneshot
ExecStart=/root/bin/uefibootrepair


[Install]
WantedBy=default.target
WantedBy=shutdown.target
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2014-04-30 21:44:31 -0500

Seen: 2,222 times

Last updated: May 02 '14