Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 938596

Summary: sys-fs/bcachefs-tools: bcachefs mount fails on boot since bcachefs-tools 1.9.0
Product: Gentoo Linux Reporter: Florian Schmaus <flow>
Component: Current packagesAssignee: Matt Jolly <kangie>
Status: CONFIRMED ---    
Severity: normal CC: csfore, flow, kangie, proxy-maint
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://github.com/koverstreet/bcachefs-tools/issues/308
Whiteboard:
Package list:
Runtime testing required: ---

Description Florian Schmaus gentoo-dev 2024-08-28 14:54:23 UTC
Starting bcachefs-tools 1.9.0 bcachefs mounts fail. I suspect that only systems with bcache *and* bcachefs are affected, hence this is not very widespread.

Please keep bcachefs-tools 1.7.0 in ::gentoo until this is fixed.

As requested by csfore, this is the downstream bug report to track the issue. Upstream report is at https://github.com/koverstreet/bcachefs-tools/issues/308
Comment 1 Matt Jolly gentoo-dev 2024-08-29 21:51:29 UTC
What's the use case for bcache _and_ bcachefs on the same system? Wouldn't you be better off using the 'bcache' drives as 'foreground' and 'metadata' drives is bcachefs?
Comment 2 Florian Schmaus gentoo-dev 2024-08-31 13:13:06 UTC
(In reply to Matt Jolly from comment #1)
> What's the use case for bcache _and_ bcachefs on the same system? Wouldn't
> you be better off using the 'bcache' drives as 'foreground' and 'metadata'
> drives is bcachefs?

It's an old system which had two bcache drives (one with data redundancy and one without) of which I migrated one to bcachefs (the scratch one, without redundancy). The other one is non trivial to migrate, due to the setup.

However, I am not sure how relevant for the bug this question is. It is not even confirmed that the dual bcache/bcachefs setup is causing this. And even if this is found to be the root cause, different kernel subsystems should be able to work side-by-side without causing issues.
Comment 3 Florian Schmaus gentoo-dev 2024-10-27 14:02:24 UTC
The root cause seems to be that starting with bcachefs-tools 1.9, mount.bcachefs is using the udev db for block devices. With multi-device bcachefs volumes, systemd may issue the mount.bcachefs as soon as the first block device with the provided UUID appears in the udev db. At this point, the other devices are potentially still missing in the udev db, causing the mount to fail.

FTR, setting the `BCACHEFS_BLOCK_SCAN` environment variable for the bcachefs mount unit works around the issue. For example via for a mount unit named data-scratch.

echo "BACACHEFS_BLOCK_SCAN=1 > /etc/systemd/system/data\\x2dscratch.mount.d/override.conf