Zfs pool always mounted in degraded mode

I have a zfs pool that is a raidz1 consisting of 3 normal hard disks and one mdadm JBOD that mimics the fourth hard disk. When I boot the system, it always is mounted in degraded mode. The system claims that the mdadm JBOD is missing and it started the zpool without it. It looks like assembling the zfs raid is done before assembling the mdadm JBOD is complete. In the past I solved that by making zfs-import dependent on mdmonitor in systemd, but that no longer seems to work in Leap 15.5. I would appreciate any advise on how to delay assembling the zfs raid until the mdadm JBOD is ready.

Show full output after boot of

udevadm info --export-db
sudo journalctl -b --no-pager --full

Upload to https://paste.opensuse.org/

Hmmm, tried to attach the output, but this stupid system doesn’t seem to allow ASCII attachments… So here is a link instead.

http://homepage.oma.be/pvh/leap/

You need to paste your text into input box. It does not make it stupid, so far others managed it. There is even command to automate posting to this site.

zfs pool is imported in initrd and md0 becomes active only after initrd has finished and switched to real root. I am not familiar with ZFSoL details, but I suppose either you need to setup md0 in initrd or you need to avoid importing zfs pool there.

The md0 device is under systemd control, so to tell zfs service that imports this pool to wait for md0 you can use something like

Requires=sys-devices-virtual-block-md0-md0p1.device
After=sys-devices-virtual-block-md0-md0p1.device

You can check systemctl -t device output for the correct device names. Maybe it is even possible to use by-partuuid as device alias.

Adding the dependencies did not help. I guess the first step should be to take the initialization of the zfs pool out of initrd. What would be the proper way to configure that?

If you explain how it gets there in the first place, we can think how to prevent it. Or show the output of

sudo lsinitrd /boot/initrd-5.14.21-150500.55.31-default

I have no idea how it got there, I did not do anything for that. Either the installer did it, or it is automatically picked up by dracut. The requested output was too big to be pasted here, so I added it to the link above. I still have no idea how pasting is supposed to work here…

Thinking further about this, I guess it is more plausible that installing the zfs rpms also adds instructions for dracut to add the zfs module.

Read

man susepaste

or use https://paste.opensuse.org/ directly.

OK, I see, you have a custom server for that…

Looking further into that, the zfs rpm adds the following directories: /usr/lib/dracut/modules.d/02zfsexpandknowledge and /usr/lib/dracut/modules.d/90zfs. I looks like these are responsible for including the zfs module in initrd. When I move the 90zfs directory out of the way, and run dracut, it produces an initrd without the zfs module. Rebooting with that results in a zpool that comes up clean. So we are on the right track. But this trick is clearly not permanent. Once I upgrade the zfs rpm, the 90zfs directory will reappear. So how do I make this permanent?

echo 'omit_dracutmodules+=" zfsexpandknowledge zfs "' > /etc/dracut.conf.d/skip-zfs.conf
man dracut.conf.d

That is solved now. Thanks!