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
sampsonf
(Sampson Fung)
May 18, 2021, 5:31am
2
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?
sampsonf
(Sampson Fung)
May 18, 2021, 8:34am
4
Do you have the two files grub.cfg grubenv under /boot/grub2 ?
vgaetera
(Vladislav Grigoryev)
May 18, 2021, 10:12am
5
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
vgaetera
(Vladislav Grigoryev)
May 18, 2021, 11:19am
8
You are using the wrong path, read carefully: Changes/UnifyGrubConfig - Fedora Project Wiki
1 Like
sampsonf
(Sampson Fung)
May 18, 2021, 11:22am
9
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
vgaetera
(Vladislav Grigoryev)
May 18, 2021, 4:06pm
11
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!
edwkmho
(Edward Ho)
May 25, 2021, 3:42pm
13
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
jwatt
(Jonathan Watt)
June 22, 2021, 9:18am
16
vgaetera:
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
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
system
(system)
Closed
July 20, 2021, 9:18am
17
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.