When GRUB (GRand Unified Bootloader) throws "Disk Filter writing not supported" (error:) during the installation or update process When the "disk filter writes are not supported" error occurs, it usually means that the boot program cannot handle specific disk configurations correctly (such as advanced features of LVM, RAID, encrypted volumes, or NVMe drives). The complete solution for addressing the root cause of this error is compiled in the following text, mainly covering the processing strategies in both BIOS and UEFI boot modes.
First, let's analyze the cause of the error. This error mostly occurs in the following scenarios: Incorrect selection of the GRUB installation target, attempting to install GRUB to a logical volume (LV) instead of a physical disk or partition; Disk filter conflicts. When using LVM, dmcrypt encryption or RAID, GRUB fails to correctly identify the physical storage layer. The UEFI and BIOS modes are confused. In a UEFI system, the BIOS mode is mistakenly used to install GRUB, or vice versa. File system compatibility issue: GRUB has insufficient support for certain file systems (such as subvolumes of Btrfs).
Basic investigation and repair steps
Step 1: Confirm the disk layout and the GRUB installation target
Use lsblk and fdisk to check the disk structure and ensure that GRUB is installed on a physical device (such as /dev/sda), rather than a logical volume (such as /dev/mapper/vg0root) :
sudo lsblk o NAME,FSTYPE,MOUNTPOINT
sudo fdisk l
Correct example:
NAME FSTYPE MOUNTPOINT
sda
├─sda1 vfat /boot/efi
├─sda2 ext4 /boot
└─sda3 LVM2_member
├─vg0root ext4 /
└─vg0swap swap [SWAP]
Here, GRUB should be installed on sda (the entire disk) or sda2 (independent /boot partition), rather than sda3 or vg0root.
Step 2: Reinstall GRUB to the correct location
Mount the key partition and execute grubinstall, mount the root partition and /boot (if independent)
sudo mount /dev/vg0root /mnt
sudo mount /dev/sda2 /mnt/boot
sudo mount /dev/sda1 /mnt/boot/efi UEFI system required
Bind the system directory
sudo mount bind /dev /mnt/dev
sudo mount bind /proc /mnt/proc
sudo mount bind /sys /mnt/sys
Chroot to the target system
sudo chroot /mnt
Install GRUB (select based on the boot mode) and the UEFI system
grubinstall target=x86_64efi efidirectory=/boot/efi bootloaderid=GRUB
BIOS system
grubinstall target=i386pc /dev/sda
Generate the configuration file
grubmkconfig o /boot/grub/grub.cfg
Step 3: Verify the installation result
Check the contents and logs of the /boot/grub directory:
The.mod module should exist in the ls /boot/grub/x86_64efi UEFI mode
cat /var/log/grubinstall.log | grep error
Advanced repair: Complex storage configuration processing
Scene 1: LVM logical Volume environment
If the root partition is located in LVM, it is necessary to ensure that /boot is an independent physical partition (not LVM), otherwise GRUB cannot read the boot file.
1. Create an independent /boot partition (at least 1GB, formatted as ext4);
2. Reinstall GRUB to the disk (such as /dev/sda);
3. Update /etc/fstab to ensure that /boot is mounted correctly.
Scene 2: Full Disk Encryption (LUKS)
GRUB 2.06+ supports LUKS2 encryption, but additional modules need to be enabled:
1. Edit /etc/default/grub and add:
GRUB_ENABLE_CRYPTODISK=y
2. Regenerate the GRUB configuration:
grubmkconfig o /boot/grub/grub.cfg
3. Ensure that initramfs contains the drivers required for decryption:
updateinitramfs u
Scene 3: RAID array
For software RAID (such as mdadm), RAID support needs to be enabled in GRUB. The grubpc (BIOS) or grubefiamd64 (UEFI) package needs to be installed. Confirm that /boot is located in a non-RAID partition or RAID1 array when executing grubinstall to specify the RAID member disk:
grubinstall /dev/sda
The grubinstall /dev/sdb multi-disk RAID needs to be installed one by one
Special processing in UEFI mode
Question 1: The ESP partition is not configured correctly
The EFI system partition (ESP) needs to be formatted as FAT32. Mount to /boot/efi; Size ≥100MB (512MB is recommended).
Fix the command and format the partition
sudo mkfs.vfat F32 /dev/sda1
Mount and reinstall GRUB
sudo mount /dev/sda1 /mnt/boot/efi
grubinstall target=x86_64efi efidirectory=/boot/efi removable
Question 2: Secure Boot conflict
Disable Secure Boot or sign GRUB:
Enter the BIOS Settings and turn off Secure Boot; Or use the shimsigned package to generate the signature:
sudo apt install shimsigned
sudo cp /usr/lib/shim/shimx64.efi.signed /boot/efi/EFI/ubuntu/grubx64.efi
Fault prevention and debugging tools
The first one, in the GRUB Rescue mode, manually load the module and start the system:
"ls" lists all partitions
set root=(hd0,gpt2) specifies the /boot partition
linux /vmlinuz5.15.078generic root=/dev/mapper/vg0root
The initrd/initrd img5.15.078 generic
boot
The second type is log collection and analysis. View the installation log:
journalctl u grubinstall
Enable GRUB debugging output:
grubinstall verbose debug /dev/sda
The third type is backup and recovery. Regularly back up the boot sectors and configuration files:
dd if=/dev/sda of=/boot/grub/grub_backup.bin bs=512 count=1 Back up MBR
cp /boot/grub/grub.cfg /boot/grub/grub.cfg.bak
Although the error "Disk filter writing is not supported" is rather troublesome, it is mostly due to a mismatch between the storage configuration and the GRUB installation target. By accurately identifying the disk topology structure, reasonably dividing the /boot partition, and strictly distinguishing the BIOS/UEFI installation mode, such problems can be completely avoided.