Error: ../../grub-core/fs/fshelp.c:257:file `/EFI/fedora/grubenv`

I am seeing following error at startup

error: ../../grub-core/fs/fshelp.c:257:file '/EFI/fedora/grubenv'

Something similar is reported here But in my case there is no /boot/efi/EFI/fedora/grubenv at all.

I have Fedora 34 fresh install.

How could I fix this?

1 Like

For a new fresh install of F34, the location of grub is changed to:

/boot/grub2/grub.cfg
/boot/grub2/grubenv

2 Likes

Why do I see that error then? bug may be?

Do you have the two files grub.cfg grubenv under /boot/grub2 ?

https://discussion.fedoraproject.org/t/failed-to-start-mark-boot-as-successful/72303/2?u=vgaetera

1 Like

Yes I have those two files under /boot/grub2

Still seeing it after sudo grub2-editenv create

Another thing I notice, is if I try to update /etc/default/grub using

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

it also fails with

/usr/sbin/grub2-mkconfig: line 268: /boot/efi/EFI/fedora/grub.cfg.new: No such file or directory

You are using the wrong path, read carefully: Changes/UnifyGrubConfig - Fedora Project Wiki

1 Like

For Fedora 34, this command should be:
sudo grub2-mkconfig -o /boot/grub2/grub.cfg

2 Likes

I am still seeing following error

error: ../../grub-core/fs/fshelp.c:257:file '/EFI/fedora/grubenv'

after sudo grub2-editenv create

It should be something like this:

BOOT_DEV="$(sed -n -e "s/\s\/boot\s.*$//p" /etc/mtab)"
BOOT_UUID="$(lsblk -n -o UUID ${BOOT_DEV})"
sudo tee /boot/efi/EFI/fedora/grub.cfg << EOF
search --no-floppy --fs-uuid --set=dev ${BOOT_UUID}
set prefix=(\$dev)/grub2
export \$prefix
configfile \$prefix/grub.cfg
EOF
sudo grub2-editenv create
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
sudo dracut -f --regenerate-all

Copy-paste the code directly to the terminal and run it.
Do not manually edit any configs.

4 Likes

I created grubenv file with the content you provided and executed given commands, but still seeing the error. Since Fedora 34 unified grub there should not be error like that at all, I think this is bug!

Many thanks.

I managed to get rid of the error with your command.

1 Like

I had the same issue, was dual booting win 10 with fedora. I had grub customizer installed and changed the default entry to predefined and solved the problem. I guess the problem lies when grub looks for the last booted os.

In my case I am not dual booting

Just in case the canonical contents of this file change in future, it’s probably safer to replace this part of your commands with:

sudo dnf reinstall grub2-common

As per Chris’s comment 9 here, “That will rerun the script that moves /boot/efi grub.cfg to /boot; and recreates the stub/forwarding ESP grub.cfg.”

2 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.