Hi Richard and Dider, thanks - I have set up encrypted swap on mdraid1 instead. It works but is subject to the same cycle issue - sometimes swap doesn't load, sometimes the boot zfs pool won't mount.
I went to apply the patch, but my system doesn't seem to have the two files that are referenced, etc/systemd/system-generators/zfs-mount-generator.in and /etc/systemd/system/zfs-mount.service.in and so the patch command failed. I have probably misunderstood something, sorry... I'm way out of my depth here. FWIW here are the contents of the directories for the missing files: root@eu1 ~ ls -l /etc/systemd total 94 -rw-r--r-- 1 root root 1042 Apr 22 19:04 journald.conf -rw-r--r-- 1 root root 1042 Apr 22 19:04 logind.conf drwxr-xr-x 2 root root 2 Apr 22 19:04 network -rw-r--r-- 1 root root 584 Apr 2 04:23 networkd.conf -rw-r--r-- 1 root root 529 Apr 2 04:23 pstore.conf -rw-r--r-- 1 root root 634 Apr 22 19:04 resolved.conf -rw-r--r-- 1 root root 790 Apr 2 04:23 sleep.conf drwxr-xr-x 15 root root 21 May 3 13:08 system -rw-r--r-- 1 root root 1759 Apr 22 19:04 system.conf -rw-r--r-- 1 root root 604 Apr 22 19:04 timesyncd.conf drwxr-xr-x 3 root root 3 May 2 18:24 user -rw-r--r-- 1 root root 1185 Apr 22 19:04 user.conf (system-generators is missing) root@eu1 ~ ls -l /etc/systemd/system/ total 90 lrwxrwxrwx 1 root root 44 Apr 27 17:56 dbus-org.freedesktop.resolve1.service -> /lib/systemd/system/systemd-resolved.service lrwxrwxrwx 1 root root 36 Apr 27 18:15 dbus-org.freedesktop.thermald.service -> /lib/systemd/system/thermald.service lrwxrwxrwx 1 root root 45 Apr 27 17:56 dbus-org.freedesktop.timesync1.service -> /lib/systemd/system/systemd-timesyncd.service drwxr-xr-x 2 root root 3 Apr 27 17:56 default.target.wants drwxr-xr-x 2 root root 3 Apr 27 18:05 emergency.target.wants drwxr-xr-x 2 root root 3 Apr 27 17:56 getty.target.wants drwxr-xr-x 2 root root 4 May 3 13:08 mdmonitor.service.wants drwxr-xr-x 2 root root 21 Apr 28 19:21 multi-user.target.wants drwxr-xr-x 2 root root 3 Apr 27 18:05 rescue.target.wants drwxr-xr-x 2 root root 11 May 3 13:08 sockets.target.wants lrwxrwxrwx 1 root root 31 Apr 27 18:02 sshd.service -> /lib/systemd/system/ssh.service drwxr-xr-x 2 root root 10 May 3 13:08 sysinit.target.wants lrwxrwxrwx 1 root root 35 Apr 27 17:56 syslog.service -> /lib/systemd/system/rsyslog.service drwxr-xr-x 2 root root 10 May 2 18:29 timers.target.wants lrwxrwxrwx 1 root root 35 Apr 27 18:05 zed.service -> /lib/systemd/system/zfs-zed.service drwxr-xr-x 2 root root 3 Apr 27 18:05 zfs-import.target.wants drwxr-xr-x 2 root root 3 Apr 27 18:05 zfs-mount.service.wants drwxr-xr-x 2 root root 8 Apr 27 18:05 zfs.target.wants drwxr-xr-x 2 root root 3 Apr 27 18:05 zfs-volumes.target.wants (zfs-mount.service.in is missing) The system was installed with debootstrap: dpkg --install debootstrap_1.0.118ubuntu1_all.deb debootstrap --arch=amd64 focal /mnt http://archive.ubuntu.com/ubuntu/ I did not install any zfs packages separately - the system only has what debootstrap gave it: root@eu1 ~ dpkg -l | grep zfs ii libzfs2linux 0.8.3-1ubuntu12 amd64 OpenZFS filesystem library for Linux ii zfs-initramfs 0.8.3-1ubuntu12 amd64 OpenZFS root filesystem capabilities for Linux - initramfs ii zfs-zed 0.8.3-1ubuntu12 amd64 OpenZFS Event Daemon ii zfsutils-linux 0.8.3-1ubuntu12 amd64 command-line tools to manage OpenZFS filesystems Many thanks for looking at this so quickly! :-) -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to zfs-linux in Ubuntu. https://bugs.launchpad.net/bugs/1875577 Title: Encrypted swap won't load on 20.04 with zfs root Status in zfs-linux package in Ubuntu: Confirmed Bug description: root@eu1:/var/log# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04 LTS Release: 20.04 Codename: focal root@eu1:/var/log# apt-cache policy cryptsetup cryptsetup: Installed: (none) Candidate: 2:2.2.2-3ubuntu2 Version table: 2:2.2.2-3ubuntu2 500 500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages OTHER BACKGROUND INFO: ====================== 1. machine has 2 drives. each drive is partitioned into 2 partitions, zfs and swap 2. Ubuntu 20.04 installed on ZFS root using debootstrap (debootstrap_1.0.118ubuntu1_all) 3. The ZFS root pool is a 2 partition mirror (the first partition of each disk) 4. /etc/crypttab is set up as follows: swap /dev/disk/by-id/nvme-SAMSUNG_MZVLB1T0HALR-00000_S3W6NX0M802914-part2 /dev/urandom swap,cipher=aes-xts-plain64,size=256 swap /dev/disk/by-id/nvme-SAMSUNG_MZVLB1T0HALR-00000_S3W6NX0M802933-part2 /dev/urandom swap,cipher=aes-xts-plain64,size=256 WHAT I EXPECTED =============== I expected machine would reboot and have encrypted swap that used two devices under /dev/mapper WHAT HAPPENED INSTEAD ===================== On reboot, swap setup fails with the following messages in /var/log/syslog: Apr 28 17:13:01 eu1 kernel: [ 5.360793] systemd[1]: cryptsetup.target: Found ordering cycle on systemd-cryptsetup@swap.service/start Apr 28 17:13:01 eu1 kernel: [ 5.360795] systemd[1]: cryptsetup.target: Found dependency on systemd-random-seed.service/start Apr 28 17:13:01 eu1 kernel: [ 5.360796] systemd[1]: cryptsetup.target: Found dependency on zfs-mount.service/start Apr 28 17:13:01 eu1 kernel: [ 5.360797] systemd[1]: cryptsetup.target: Found dependency on zfs-load-module.service/start Apr 28 17:13:01 eu1 kernel: [ 5.360798] systemd[1]: cryptsetup.target: Found dependency on cryptsetup.target/start Apr 28 17:13:01 eu1 kernel: [ 5.360799] systemd[1]: cryptsetup.target: Job systemd-cryptsetup@swap.service/start deleted to break ordering cycle starting with cryptsetup.target/start . . . . . . Apr 28 17:13:01 eu1 kernel: [ 5.361082] systemd[1]: Unnecessary job for /dev/disk/by-id/nvme-SAMSUNG_MZVLB1T0HALR-00000_S3W6NX0M802914-part2 was removed Also, /dev/mapper does not contain any swap devices: root@eu1:/var/log# ls -l /dev/mapper total 0 crw------- 1 root root 10, 236 Apr 28 17:13 control root@eu1:/var/log# And top shows no swap: MiB Swap: 0.0 total, 0.0 free, 0.0 used. 63153.6 avail Mem To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/zfs-linux/+bug/1875577/+subscriptions -- Mailing list: https://launchpad.net/~kernel-packages Post to : kernel-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~kernel-packages More help : https://help.launchpad.net/ListHelp