WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [Solved] grub cannot read usb drive's ext4 partition  (Read 3945 times)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11322
Re: grub cannot read usb drive's ext4 partition
« Reply #15 on: February 07, 2024, 01:43:39 PM »
Hi GNUser
... My suspicion is that the  mkfs.ext4  step in TCL is silently failing to write some metadata to the usb stick. ...
Maybe try running:
Code: [Select]
e2fsck -f /dev/sdXXafter  mkfs.ext4  step?

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 684
Re: grub cannot read usb drive's ext4 partition
« Reply #16 on: February 07, 2024, 01:49:39 PM »
Are you using some old grub version ?
Or is this only then you boot from the usb ?
And what i would test, just format the partition with a lover ver of ext, like ext2.
That not have any journal.

Offline GNUser

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1378
Re: grub cannot read usb drive's ext4 partition
« Reply #17 on: February 07, 2024, 01:59:42 PM »
Maybe try running:
Code: [Select]
e2fsck -f /dev/sdXXafter  mkfs.ext4  step?

No luck. I also tried a different usb stick to exclude something wrong with the stick itself.

Can anyone reproduce this? To try, simply grab a usb stick you don't care about, then:

0. tce-load -wil gdisk e2fsprogs
1. use  gdisk  to delete all the partitions and create a single "Linux filesystem" (hex 8300) partition
2. use  mkfs.ext4  to format the partition
3. reboot and, at grub menu, press "c" for a command prompt
4. try listing the partition's contents with ls (hdX,gptX)/
5. press Esc to leave the grub prompt and return to the grub menu

When I do 1-2 above in TCL15 x86_64, I consistently get an error at step 4.
When I do 1-2 above in Devuan, I don't get an error at step 4 using same machine, same grub, same usb stick.
« Last Edit: February 07, 2024, 02:28:32 PM by GNUser »

Offline GNUser

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1378
Re: grub cannot read usb drive's ext4 partition
« Reply #18 on: February 07, 2024, 02:42:42 PM »
On TCL15 x86_64 I tried using  fdisk  then  mkfs.ext4  (instead of  gdisk  then  mkfs.ext4). It made no difference.

I think that confirms the problem is with the  mkfs.ext4  step on TCL. I'll keep investigating.

Offline GNUser

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1378
Re: grub cannot read usb drive's ext4 partition
« Reply #19 on: February 07, 2024, 03:22:04 PM »
I tried two experiments:

Experiment 1: gdisk step in Devuan, mkfs.ext4 step in TCL15
Result: "error: unknown filesystem" in grub

Experiment 2: gdisk step in TCL, mkfs.ext4 step in Devuan
Result: no error in grub

Everything points to  mkfs.ext4  creating the filesystem in a way that causes problems for grub.

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 684
Re: grub cannot read usb drive's ext4 partition
« Reply #20 on: February 07, 2024, 04:51:39 PM »
Don't give up :)

I think you haven't read my thread.

https://forum.tinycorelinux.net/index.php/topic,26756.msg172495.html#msg172495

What grub ver ?
And why not try ext2 that have not any journal.

Offline GNUser

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1378
Re: grub cannot read usb drive's ext4 partition
« Reply #21 on: February 07, 2024, 09:49:58 PM »
Hi, patrikg. Grub is version 2.06. I don't want to downgrade from ext4 to ext2 because journaling makes the filesystem more resistant to error.

Juanito, grub is unable to read ext4 partitions created with e2fsprogs version 1.47.0 in TCL15 x86_64. If I boot into TCL14 x86_64 and use e2fsprogs 1.46.5, the problem goes away.

Offline GNUser

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1378
Re: grub cannot read usb drive's ext4 partition
« Reply #22 on: February 07, 2024, 11:22:56 PM »
The fix is in this commit to grub from July 2021, which unfortunately happened just after the release of grub 2.06 in June 2021.

The problem did turn out to be related to metadata, with the grub and e2fsprogs projects being briefly out of sync regarding how partition metadata is handled. Theodore Ts'o explains the issue here.

The latest grub release, version 2.12, includes the fix.
« Last Edit: February 07, 2024, 11:25:44 PM by GNUser »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14641
Re: grub cannot read usb drive's ext4 partition
« Reply #23 on: February 07, 2024, 11:49:47 PM »
Juanito, grub is unable to read ext4 partitions created with e2fsprogs version 1.47.0 in TCL15 x86_64. If I boot into TCL14 x86_64 and use e2fsprogs 1.46.5, the problem goes away.

I’m traveling at the moment, I should be able to update grub in two weeks time.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11322
Re: grub cannot read usb drive's ext4 partition
« Reply #24 on: February 08, 2024, 12:32:43 AM »
Hi GNUser
From Theodore Ts'o explanation:
Quote
There are two ways we can fix this. One is we can disable the
checksum seed feature
in the Debian release of mke2fs.conf. Or we can
land this above-mentioned commit into the grub2 package. Since the
hard freeze is almost upon us, I'm happy to handle this either way.
You should be able to work around this if you want by creating mke2fs.conf.
Running grep for etc on mkfs.ext4 returns:
Code: [Select]
/usr/local/etc/mke2fs.conf

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 684
Re: grub cannot read usb drive's ext4 partition
« Reply #25 on: February 08, 2024, 01:15:42 AM »
HI GNUser,
It's so great that you don't give up, and now found the problem.

Now I can understand why my Arch being updating grub a lot.

So just one question more if you have time to answer of course ?

Is this only related to grub when using it to usb drive ?
I haven't seen any evidences with this to any other drives I have worked with.
Maybe this because me not using UEFI a lot, yes because i don't have so many computers that uses that.

Thanks again, I like the Linux community a lot that we can help each other like we do.


Offline Leee

  • Jr. Member
  • **
  • Posts: 92
Re: grub cannot read usb drive's ext4 partition
« Reply #26 on: February 08, 2024, 06:25:57 AM »
FWIW, I've used juanito's instructions (referenced in the OP) to install Core on several different USB sticks using ext4 without any problems.  With a new stick, I usually zero the first gigabyte or so with dd before starting, just so I have a clean slate.

core 14.0 x86_64

Offline gadget42

  • Hero Member
  • *****
  • Posts: 673
Re: grub cannot read usb drive's ext4 partition
« Reply #27 on: February 08, 2024, 06:27:58 AM »
i am going to quote @GNUser and also add the complete URL links below the quote(so screenshots will include the complete webpage address).

The fix is in this commit to grub from July 2021, which unfortunately happened just after the release of grub 2.06 in June 2021.

The problem did turn out to be related to metadata, with the grub and e2fsprogs projects being briefly out of sync regarding how partition metadata is handled. Theodore Ts'o explains the issue here.

The latest grub release, version 2.12, includes the fix.

(from circa 2021)
https://git.savannah.gnu.org/cgit/grub.git/commit/?id=7fd5feff97c4b1f446f8fcf6d37aca0c64e7c763
(from circa 2023)
https://groups.google.com/g/linux.debian.bugs.dist/c/HiBoBMllrlU/m/RNQ6jmEuAQAJ
(and following a link from Andreas Henriksson in the above group back to circa 2018)
https://github.com/go-debos/debos/issues/78


this years-long potential-for-breakage saga is a learning-lesson, teaching-moment, and given the severity(as evidenced by this very thread) might even be a candidate for some type of "sticky-posting" perhaps...sigh...
The fluctuation theorem has long been known for a sudden switch of the Hamiltonian of a classical system Z54 . For a quantum system with a Hamiltonian changing from... https://forum.tinycorelinux.net/index.php/topic,25972.msg166580.html#msg166580

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Re: grub cannot read usb drive's ext4 partition
« Reply #28 on: February 08, 2024, 06:40:03 AM »
Hi smart guys!

I'm too stupid to understand the drama, could You be so kind to say one word for the dumb ones: are MBRs affected?

Offline GNUser

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1378
Re: grub cannot read usb drive's ext4 partition
« Reply #29 on: February 08, 2024, 07:27:09 AM »
Hello friends. The bottomline is that an ext4 filesystem created with e2fsprogs version 1.47.0 with the new default options will not be recognized by grub version 2.06. I don't know whether other filesystems are also affected.

The issue has to do with filesystem metadata, so hardware (HDD, SDD, USB) and partition table (MBR, GPT) make no difference.

Among TCL versions, the problem only affects TCL15 x86_64 because it is the only TCL version whose repo has this new e2fsprogs version (1.47.0) that doesn't play nice with grub 2.06.

If you are not on TCL15 x86_64, you have nothing to worry about.

If you are on TCL15 x86_64, use grub 2.06, and need to create a new ext4 partition that will contain files that grub needs to find (e.g., vmlinuz64, corepure64.gz), you have several options:

- use an older version of e2fsprogs (e.g., 1.46.5 in TCL14 x86_64) to create the ext4 filesystem
- use repo's e2fsprogs 1.47.0 but disable checksum seed feature (see Rich's post above)
- wait until Juanito updates grub2-multi.tcz to version 2.12, reinstall grub, then use e2fsprogs 1.47.0 with default options

I hope that's clear. Rich, thread may be marked as solved.

Happy hacking!

----------

P.S. In my original post, I mentioned that my SDD worked when I converted it from BIOS-only to BIOS+UEFI. The reason is that my SDD's ext4 partition was created a long time ago with an old version of e2fsprogs. When I tried to create the bootable USB drive, I had to create a new ext4 partition on it and was doing this in TCL15 x86_64 with e2fsprogs 1.47.0. This is how I discovered the problem.
« Last Edit: February 08, 2024, 07:56:56 AM by GNUser »