7

My root partition is /dev/md0, I changed the size of the partition and filesystem. Now when I run update-grub and install-grub it fails:

# grub-install /dev/sda
Installing for i386-pc platform.
grub-install: error: unknown filesystem.

# update-grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.0-67-generic
Found initrd image: /boot/initrd.img-4.4.0-67-generic
/usr/sbin/grub-probe: error: unknown filesystem.
Found linux image: /boot/vmlinuz-4.4.0-66-generic
Found initrd image: /boot/initrd.img-4.4.0-66-generic
/usr/sbin/grub-probe: error: unknown filesystem.
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
done

.

# cat /proc/mdstat
...
md0 : active raid1 sda1[1] sdb1[0]
      14553024 blocks [2/2] [UU]

unused devices: <none>

.

# cat /proc/partitions
major minor  #blocks  name

   8        0   39082680 sda
   8        1   14553088 sda1
   8       16   15646680 sdb
   8       17   14553088 sdb1
   9        0   14553024 md0

I don't dare reboot this server until this is fixed. Any suggestions?

Michael
  • 141
  • how did you change the size of the partition? – Yaron Mar 22 '17 at 12:13
  • take a look at this answer – Yaron Mar 22 '17 at 12:15
  • To change size: remove raid partition from md, create new larger partition, add new larger partition, wait for sync, make md larger 'mdadm --grow /dev/md0 --size max', make filesystem larger resize2fs /dev/md0', remove other raid partition, copy partition table to other disk using sfdisk, add other parition to md, sync. Mostly using instructions like this https://www.howtoforge.com/how-to-resize-raid-partitions-shrink-and-grow-software-raid – Michael Mar 22 '17 at 12:42
  • Thanks for l ink, but not sure how it helps. it just says update-grub && grub-install /dev/sda. This is a server, graphical options are not available. – Michael Mar 22 '17 at 12:44

2 Answers2

13

I had this error on a ext4 filesystem (without RAID). So maybe your problem is completely different. But in case it's useful for others landing here like I did:

When an ext4 filesystem has the metadata_csum_seed feature enabled, then grub-install will not work and report this grub-install: error: unknown filesystem error.

This is documented in Debian bug 866603 which also has a simple test for the problem:

grub-probe --target=fs --device /dev/sda1

It will give the same error if sda1 has that feature enabled.

You can also use tune2fs to check:

tune2fs -l /dev/sda1 | grep metadata_csum_seed

and you can disable the feature with

tune2fs -O ^metadata_csum_seed /dev/sda1
mivk
  • 5,312
  • 1
    Saved my day!!! Grub should probably make a more informative message. – shouldsee May 13 '19 at 14:46
  • 3
    Wow, thank you for writing that answer, which is spot on. Apparently, this problem can also occur for other recently added ext4 features: casefold and large_dir. GRUB does not (yet) know about them, and since they are marked "incompat" in ext4, GRUB does what any ext4 program should do in such a case: refuse to work with the filesystem. Hopefully the fix is trivial, at least for the checksum feature. – Adrien Beau Nov 05 '20 at 16:03
  • 1
    The ea_inode feature also cannot be used with GRUB. Even worse in that case, the feature cannot be disabled with tune2fs, the filesystem must be recreated from scratch. – Adrien Beau Nov 05 '20 at 18:02
  • saved me as well. I have to agree to @shouldsee grub could tell you which flag it doesn't want to work with. – Pablo Apr 12 '23 at 14:23
  • Feature metadata_csum may also be problematic even without seed. – Mikko Rantalainen Mar 21 '24 at 13:51
0

I encountered this "grub-install: error: unknown filesystem." when I attempted to fix non-booting fresh installs of Debian11.6. (The Gparted help document on the Gparted live boot disk (USB) suggested trying grub-install, but it didn't work) I had used gparted to partition and mkfs my drives ahead of running the debian installer. The grub bootloaders installed would not work - they just booted to a black screen with the message "Error!" in lo-res text.

WORKAROUND: Perform the partitioning & mkfs(es) with the debian installer, NOT with gparted.

HTH someone installing Linux, plus support teams chasing this problem. Maybe try a byte-to-byte comparison of "identical" partitions set up by both methods

Rick
  • 1