Several forum posts have noted the following error message when /boot
is on a btrfs filesystem.
error: ../../grub-core/commands/loadenv.c:216:sparse files not allowed.
I’m summarizing the solution here in case it can help someone else out.
This cryptic but mostly-harmless error message arises from GRUB not supporting writes to /boot/grub2/grubenv
on a btrfs filesystem. The /boot/grub2/grubenv
file is used to store and recall state information about which kernel you booted last and whether the kernel booted successfully. You can safely ignore the error message if you don’t need those features. If you would like to get rid of the error message completely you can either:
- Move
/boot
to filesystem GRUB fully supports such as ext4, or - Tweak fedora’s GRUB settings to disable all
/boot/grub2/grubenv
related features
Here are the steps that worked for me for (2). Hopefully this helps someone!
- Edit
/etc/default/grub
. Change the line:
GRUB_DEFAULT=saved
To something like the following, which will default to booting the first GRUB menu entry.
GRUB_DEFAULT=0
GRUB_SAVEDEFAULT=false
- Find GRUB menu scripts that touch
/boot/grub2/grubenv
using eitherload_env
orsave_env
.
grep 'load_env\|save_env' /etc/grub.d/*
Edit each matching file and comment out the offending lines with a #
.
- Rebuild the GRUB configuration.
grub2-mkconfig -o /boot/grub2/grub.cfg
Now test out your changes by rebooting. The error message should no longer appear. If your grub menu appears and you want it hidden, read about GRUB_TIMEOUT_STYLE=hidden
and related features.