I have LUKS encrypted drives and ZFS on top of that. I unlock the drives on boot using a script. I made a systemd service for that, but the script take some time and the zfs-import-cache.service starts before my script finished.
- zfs-import-cache.service Journalctl
# journalctl -e -u cryptdisks-unlock.service -u zfs-import-cache.service Sep 25 15:53:45 server systemd[1]: Starting Unlock LUKS drives... Sep 25 15:53:45 server boot[1216]: Decrypting evo850m21-crypt ... Sep 25 15:53:47 server systemd[1]: Starting Import ZFS pools by cache file... Sep 25 15:53:47 server boot[1216]: Device evo850m21-crypt decrypted. Sep 25 15:53:47 server boot[1216]: Decrypting evo850m22-crypt ... Sep 25 15:53:49 server boot[1216]: Device evo850m22-crypt decrypted. Sep 25 15:53:49 server boot[1216]: Decrypting st30001-crypt ... Sep 25 15:53:50 server zpool[1390]: cannot import 'data': no such pool or dataset Sep 25 15:53:51 server zpool[1390]: Destroy and re-create the pool from Sep 25 15:53:51 server zpool[1390]: a backup source. Sep 25 15:53:51 server systemd[1]: zfs-import-cache.service: Main process exited, code=exited, status=1/FAILURE Sep 25 15:53:51 server systemd[1]: zfs-import-cache.service: Failed with result 'exit-code'. Sep 25 15:53:51 server systemd[1]: Failed to start Import ZFS pools by cache file. Sep 25 15:53:52 server boot[1216]: Device st30001-crypt decrypted. Sep 25 15:53:52 server boot[1216]: Decrypting st30002-crypt ... Sep 25 15:53:54 server boot[1216]: Device st30002-crypt decrypted. Sep 25 15:53:54 server systemd[1]: cryptdisks-unlock.service: Succeeded. Sep 25 15:53:54 server systemd[1]: Finished Unlock LUKS drives. cryptdisks-unlock.service
[Unit] Description=Unlock LUKS drives Before=zfs-import.target [Service] Type=oneshot ExecStart=/usr/local/cryptdisks-tools/boot [Install] WantedBy=zfs-import-cache.service
Before=zfs-import-cache.target, it appears that is the service that runs in parallel with but probably shouldn't?