SOLVED grub error loadenv sparse files not allowed

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:

  1. Move /boot to filesystem GRUB fully supports such as ext4, or
  2. Tweak fedora’s GRUB settings to disable all /boot/grub2/grubenvrelated features

Here are the steps that worked for me for (2). Hopefully this helps someone!

  1. Edit /etc/default/grub. Change the line:

To something like the following, which will default to booting the first GRUB menu entry.

  1. Find GRUB menu scripts that touch /boot/grub2/grubenv using either load_env or save_env.
grep 'load_env\|save_env' /etc/grub.d/*

Edit each matching file and comment out the offending lines with a #.

  1. 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.

1 Like