[systemd-devel] btrfs raid not ready but systemd tries to mount it anyway

Lennart Poettering lennart at poettering.net
Fri Oct 16 15:51:15 UTC 2020


On Fr, 16.10.20 17:45, Lennart Poettering (lennart at poettering.net) wrote:

> > 2. Debugging with "rd.udev.debug systemd.log_level=debug":
> > The same 10 HDD BTRFS volume with 4 drives connected to the motherboard
> > and 6 drives connected to the HBA *fails* to mount automatically at boot
> > time. The log for this with "rd.udev.debug systemd.log_level=debug" set
> > in grub is here:
> >
> > https://drive.google.com/file/d/1jVHjAQ8CY9vABtM2giPTB6XeZCclm7R-/view?usp=sharing
>
> Ths btrfs udev rule file appears to be missing in the initrd. The
> block devices with the btrfs file systems on them will thus be marked
> ready in systemd instantly instead of being delayed until all other
> devices of the same btrfs fs have shown up in udev too.
>
> Fix your initrd.

So my educated guess is that this is a dracut bug: it excludes the
btrfs udev rule file from the initrd unless the root fs is btrfs.

But this doesn't work, because the absence of that file means that all
btrfs file systems will be marked as ready instantly as they appear,
which then blows up later if during later boot btrfs file systems that
are backed by multiple devices shall be mounted.

It's basically a race: if yor block devices appear in the initrd
already, then you lost, because all such devices will be instantly be
marked "ready to be mounted" because the udev rule file is missing
there. However, if the block devices take longer to appear, and are
thus first seen after the initrd→host transition, then all will be
good, as the udev rules file for it exists there, and the devices are
not marked ready until all necessary devices have shown up in udev.

Fix is: dracut should just include the file unconditionally. It's
tiny.

If it really really insist to not include it on systems where btrfs isn't
used, then it should scan the host for any btrfs use at all. it's not
sufficient to determine whether the rootfs is btrfs or not.

Anyway, please report to dracut.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list