when the /boot partition is on lvm or raid, grub2 can emit the following error message during boot:

error: diskfilter writes are not supported.

this is caused by save_env commands in /boot/grub2/grub.cfg; this command saves environment variables into the grub environment block;

however, for safety reasons, the environment block is not available on lvm or raid:

For safety reasons, this storage is only available when installed on a plain disk (no LVM or RAID), using a non-checksumming filesystem (no ZFS), and using BIOS or EFI functions (no ATA, USB or IEEE1275).

enabling lvm write looks impossible, as such request has been rejected before:

therefore, to fix the problem, you need to remove save_env commands from /boot/grub2/grub.cfg; it is not recommended to edit this file manually; instead, follow these steps:

  1. backup /boot/grub2/grub.cfg, for recovery in case of crash;

  2. cd into /etc/grub.d/ and edit scripts containing save_env commands; you need to remove these commands, and make sure the script still works correctly after your edit; if you dont want a script, you can also remove its execution bit with chmod -x; some scripts are related and need to be kept in sync, so keep all or none of them;

    different distros can add different scripts; so the solutions vary across distros; here are some solutions that may or may not match your distro:

    • on ubuntu, visit this old thread;

    • on fedora, remove execution bit on these scripts:

      chmod -x \
          08_fallback_counting \
          10_reset_boot_success \
          12_menu_auto_hide
      

      these scripts look like crap, but i am not certain that changing them will not break your system; tell me you have backed up the old config and change them at your own risk;

  3. edit file /etc/default/grub; make sure GRUB_SAVEDEFAULT is set to false or GRUB_SAVEDEFAULT doesnt exist;

  4. write to grub2 config file:

    grub2-mkconfig -o /boot/grub2/grub.cfg
    

    make sure save_env commands dont exist (or will never be run, if they exist) in the new config file;