Bug 1965800 - when booting windows error displayed: /EFI/fedora/grubenv not found
Summary: when booting windows error displayed: /EFI/fedora/grubenv not found
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: grub2
Version: 34
Hardware: x86_64
OS: All
unspecified
low
Target Milestone: ---
Assignee: Javier Martinez Canillas
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-05-30 05:29 UTC by Matt Gillard
Modified: 2023-07-16 00:59 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-06-07 21:11:06 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
boot error when selecting windows (132.83 KB, image/jpeg)
2021-05-30 05:29 UTC, Matt Gillard
no flags Details

Description Matt Gillard 2021-05-30 05:29:22 UTC
Created attachment 1788054 [details]
boot error when selecting windows

Description of problem:

I upgraded from Fedora 33 -> 34 on a dual boot system with Windows 10 using EFI. Post upgrade when booting to my Windows partition by selecting the appropriate entry in the grub2 boot menu, I got the error that grubenv was not found - however Windows continued to boot successfully afterwards.  Also - grub did not remember my last boot selection, even when I have this in my /etc/default/grub:
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true

grubenv appeared to be renamed:

/boot/efi/EFI/fedora/grubenv.rpmsave

I renamed it back and the error disappeared + Grub remembered my last boot selection as expected.

This confuses me as I thought this got moved as of fedora 34 to here:

$ sudo ls -l /boot/grub2/
total 16
-rwx------. 1 root root 7033 May 30 11:20 grub.cfg
-rw-------  1 root root 1024 May 30 13:40 grubenv
drwxr-xr-x. 3 root root 4096 Oct 20  2020 themes


Version-Release number of selected component (if applicable):


How reproducible:

Unsure if I can reproduce. I only upgraded the system once.

Steps to Reproduce:
1. Upgrade from fedora 33 -> fedora 34 on UEFI laptop dual booting with windows
2. Boot system
3. Select windows at bootloader
4. Error should display

Actual results:

Error attached displayed but pressing enter continued windows boot.

Expected results:

No error be displayed.

Additional info:

Comment 1 Matt Gillard 2021-05-30 05:30:44 UTC
also i appear to still have a grub.cfg in the efi dir

$ sudo ls -l /boot/efi/EFI/fedora/
total 12224
-rwx------ 1 root root     112 Apr 21 20:51 BOOTIA32.CSV
-rwx------ 1 root root     110 Apr 21 20:51 BOOTX64.CSV
drwx------ 2 root root    4096 May 30 10:14 fonts
drwx------ 2 root root    4096 May 30 10:47 fw
-rwx------ 1 root root   62073 Apr 18 06:00 fwupdx64.efi
-rwx------ 1 root root 1598728 Apr 12 09:14 gcdia32.efi
-rwx------ 1 root root 2536712 Apr 12 09:14 gcdx64.efi
-rwx------ 1 root root    7023 May 30 11:44 grub.cfg
-rwx------ 1 root root    7136 Oct 31  2020 grub.cfg.rpmsave
-rwx------ 1 root root    1024 May 16 10:44 grubenv
-rwx------ 1 root root 1598728 Apr 12 09:14 grubia32.efi
-rwx------ 1 root root 2536712 Apr 12 09:14 grubx64.efi
-rwx------ 1 root root  676040 Apr 21 20:51 mmia32.efi
-rwx------ 1 root root  850032 Apr 21 20:51 mmx64.efi
-rwx------ 1 root root  928592 Apr 21 20:51 shim.efi
-rwx------ 1 root root  740344 Apr 21 20:51 shimia32.efi
-rwx------ 1 root root  928592 Apr 21 20:51 shimx64.efi

Comment 2 Javier Martinez Canillas 2021-06-22 14:52:02 UTC
The grub.cfg in the efi dir should be a minimal config that just loads the one in the /boot directory.

Can you please share that file? Also dnf reinstall grub2-common should fix your GRUB config if isn't
correct.

Comment 3 thepiguy0 2021-06-22 16:40:17 UTC
I also experience this issue on a fresh Fedora 34 install. Having tested a few things, it appears specifically the line "GRUB_SAVEDEFAULT=true" is causing the issue, without this my PC boots without any errors (but of course does not then save which OS was last booted).

I don't believe I have a grubenv file inside /boot/efi/EFI/fedora at all, which is where my PC is looking when the error shows. I have reinstalled the entire grub2 set of packages ("sudo dnf reinstall grub2-*") and the issue disappears (along with my customisations of /etc/default/grub) but comes straight back when I re-run "sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg".

Comment 4 thepiguy0 2021-06-22 16:44:09 UTC
Re-reading your comment, should I be running "sudo grub2-mkconfig -o /boot/grub2/grub.cfg" instead (that is the location of the only other grub.cfg within my /boot folder)?

Comment 5 Rodrigo Renie 2021-06-23 00:33:23 UTC
Same problem here on a fresh Fedora 34 install. Immediately after installing Fedora, Windows boots up just fine, but the error appears when:

1) Edit /etc/default/grub to add "GRUB_SAVEDEFAULT=true";
2) Run "sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg" to apply the option above;

While writing this, I came across this link:

https://fedoraproject.org/wiki/Changes/UnifyGrubConfig

So, I believe the problem is caused by running the grub2-mkconfig with the wrong grub.cfg path. I'll try to reinstall grub try again with the correct path.

Comment 6 Javier Martinez Canillas 2021-06-23 11:33:34 UTC
Yes, I think all these are due re-generating the GRUB config using the old path. I'm
closing this but feel free to re-open if there's data that shows isn't this issue.

Comment 7 Troy Volin 2021-08-07 20:57:26 UTC
I hope this comment reopens the bug.
I believe this was introduced with one of the 2.06-rc1-X updates.
It is a bug.
prior to this release, grubenv was apparently known (by grubby as well, I assume) to live at /boot/efi/EFI/fedora/grubenv .
Whichever update removed that file (owned by package grub2-efi-x64) would tell us when it was introduced.

It is clear that grubby and grub2 itself, during boot, know to look for and maintain grubenv at /boot/grub2/grubenv .
However, the "savedefault" action in grub2 at runtime is still trying to update a file at /boot/efi/EFI/fedora/grubenv .
So the error is somewhere in the neighborhood of savedefault.
That logic is still looking in the old location.

I need to reboot now to capture the exact error. I think it is assuming a path relative to /boot/efi, which might be part of the problem. I hope savedefault is able to write to a grubenv on a different filesystem (/boot/grub2 is in the /boot partition not the EFI partition mounted at /boot/efi)

Comment 8 Troy Volin 2021-08-07 21:25:12 UTC
I now see that the error message is in the subject of this defect :)
It is issued by "grub-core/fs/fshelp.c" or something (the message only displays briefly)
And it is writing to a filename relative to the EFI filesystem. I hope that's not a problem (meaning, I hope "savedefault" is able to write to /boot filesystem where /boot/grub2/grub.cfg and /boot/grub2/grubenv live)

Maintainer: you should be able to recreate this bug pretty easily, just by adding into your /etc/grub.d/40_custom the same content we have on our dual-boot systems, that gets created by os-prober (at bottom of this comment). Your boot will fail of course, but not before you see the error output from "savedefault".

@matt-redhat can you please REOPEN this bug? Apparently I'm not empowered to do that.

Add the following to /etc/grub.d/40_custom
### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows Boot Manager (on /dev/nvme0n1p1)' --class windows --class os $menuentry_id_option 'osprober-efi-0AC3-54CC'
 {
        savedefault
        insmod part_gpt
        insmod fat
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root  0AC3-54CC
        else
          search --no-floppy --fs-uuid --set=root 0AC3-54CC
        fi
        chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
# Other OS found, undo autohiding of menu unless menu_auto_hide=2
if [ "${orig_timeout_style}" -a "${menu_auto_hide}" != "2" ]; then
  set timeout_style=${orig_timeout_style}
  set timeout=${orig_timeout}
fi
### END /etc/grub.d/30_os-prober ###

Comment 9 Troy Volin 2021-12-20 02:09:36 UTC
Upgraded to Fedora 35. Problem is gone.
Please close (as long as the OP agrees)

Comment 10 Ben Cotton 2022-05-12 15:13:30 UTC
This message is a reminder that Fedora Linux 34 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 34 on 2022-06-07.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '34'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 34 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 11 Ben Cotton 2022-06-07 21:11:06 UTC
Fedora Linux 34 entered end-of-life (EOL) status on 2022-06-07.

Fedora Linux 34 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 12 Bill Goodman 2023-07-16 00:59:29 UTC
I am seeing this exact same behavior after updating from Fedora 37 to Fedora 38.

I used both
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

I still see the error message "grubenv not found" before Windows boots.


Note You need to log in before you can comment on or make changes to this bug.