This is a tricky one because all of the dependencies make sense in
isolation. Even if we remove the dependency added by that upstream
OpenZFS commit, given that modern systems use zfs-mount-generator,
systemd-random-seed.service is going to Require= and After= var-
lib.mount because of its RequiresMountsFor=/var/lib/systemd/random-seed.
The generated var-lib.mount will be After=zfs-import.target because you
can't mount a filesystem without importing the pool. And zfs-
import.target is After= the two zfs-import-* services. Those are after
cryptsetup.target, as you might be running your pool on top of LUKS.
Mostly side note: it does seem weird and unnecessary that zfs-load-
module.service has After=cryptsetup.target. We should probably remove
that. That is coming from debian/patches/2100-zfs-load-module.patch
(which is what provides zfs-load-module.service in its entirety).
One idea here would be to eliminate the After=cryptsetup.target from
zfs-import-{cache,scan}.service and require that someone add them via a
drop-in if they are running on LUKS. However, in that case, they'll run
into the same problem anyway. So that's not really a fix.
Another option might be to remove the zfs-mount.service Before=systemd-
random-seed.service and effectively require the use of the mount
generator for Root-on-ZFS setups. That is what the Ubuntu installer does
and what the Root-on-ZFS HOWTO will use for 20.04 anyway. (I'm working
on it actively right now.) Then, modify zfs-mount-generator to NOT After
=zfs-import.target (and likewise for Wants=) if the relevant pool is
already imported (and likewise for the zfs-load-key- services). Since
the rpool will already be imported by the time zfs-mount-generator runs,
that would be omitted.
I've attached an *untested* patch to that effect. I hope to test this
yet tonight as I test more Root-on-ZFS scenarios, but no promises.
** Patch added: "2150-fix-systemd-dependency-loops.patch"
https://bugs.launchpad.net/ubuntu/+source/zfs-linux/+bug/1875577/+attachment/5366544/+files/2150-fix-systemd-dependency-loops.patch
--
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 [email protected]/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
[email protected]/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 : [email protected]
Unsubscribe : https://launchpad.net/~kernel-packages
More help : https://help.launchpad.net/ListHelp