tytso / e2fsprogs

Ext2/3/4 file system utilities
http://ext4.wiki.kernel.org
373 stars 219 forks source link

ext4fs not allowing to install grub1.98 in my usb stick #153

Closed rprasanth closed 4 months ago

rprasanth commented 1 year ago

Hi,

Recently I am trying to install Grub 1.98 version on my USB drive. Where I came to notice this issue.

  1. Using Ubuntu-18 and above e2fsprogs version - 1.44.1 in Ubuntu-18
$ sudo mkfs.ext4 /dev/sdX1
$ sudo linux64 chroot .
bash-5.1# grub-install /dev/sdX
/usr/sbin/grub-probe: error: unknown filesystem.
Auto-detection of a filesystem module failed.
Please specify the module with the option `--modules' explicitly.

If the file format of /dev/sdX1 is ext2, no error occurs.

$ sudo mkfs.ext2 /dev/sdX1
$ grub-install /dev/sdX
Installation finished. No error reported.

The same USB formatted with the 1.44 version in ubuntu-18 can't be used in lower version distros too, like Ubuntu-16.

=================================================================================================

Whereas the same format procedure was done in Ubuntu-16 e2fsprogs version - e2fsprogs 1.42.13

$ sudo mkfs.ext4 /dev/sdX1
$ sudo linux64 chroot .
bash-5.1# grub-install /dev/sdb 
Installation finished. No error reported.

I don't see the issue.

Summary, mkfs.ext4 used in Ubuntu-16 allows grub to be installed on all machines(higher version distros too). whereas mkfs.ext4 used in ubuntu-18 & above doesn't allow in any machine.

Query: is there any change relevant to this

Please specify the module with the option `--modules' explicitly.

Could you help with the exact step for using the correct argument to be passed as mentioned above?

Thanks, Prasanth R

tytso commented 4 months ago

Older versions of grub are missing a one-line change so they can support file systems with the metadata_csum_seed feature. You can disable this by using "mke2fs -O ^metadata_csum_seed" or editing the mke2fs.conf file to remove metadta_csum_seed. Some distributions have done this, although it means that changing the file system UUID becomes very slow, which may be an issue if you are doing this a lot for VM's root file system images.

In order for grub to be able to accept a file system with metadata_csum_seed, it must have commit 7fd5feff97c4 ("fs/ext2: Ignore checksum seed incompat feature"). This commit landed in July 2021, which just missed the Grub 2.06 release in June 2021. Grub 2.11 was slated for "H1'2022" but unfortunately it has not yet been released as of August 2022. The latest upstream version of grub now has support for this feature, but if you are creating file systems that need to be used as the root file system with older versions of grub, this can still be an issue. the workaround is to disable the metadata_csum_seed feature.