grub2: diskfilter writes are not supported
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:
-
backup
/boot/grub2/grub.cfg
, for recovery in case of crash; -
cd into
/etc/grub.d/
and edit scripts containingsave_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 withchmod -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;
-
-
edit file
/etc/default/grub
; make sureGRUB_SAVEDEFAULT
is set tofalse
orGRUB_SAVEDEFAULT
doesnt exist; -
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;