I read about System bootup process.
When the root device becomes available,
initrd-root-device.targetis reached.
Adding initrd-root-device.target works for me. I am running unencrypted Btrfs raid0.
boot.initrd.systemd.services."rootfs-cleanup" = {
wantedBy = [
"initrd.target"
];
after = [
"initrd-root-device.target"
];
before = [
"sysroot.mount"
];
unitConfig.DefaultDependencies = "no";
serviceConfig.Type = "oneshot";
script = cleanupBtrfs;
};
Guess the zfs/luks target mentioned above are after this target.