zfs
zfs copied to clipboard
zfs-mount-generator should use WantsMountsFor= instead of RequiresMountsFor=
System information
Type | Version/Name |
---|---|
Distribution Name | Gentoo |
Distribution Version | current |
Kernel Version | 6.6.13-gentoo-dist |
Architecture | x86_64 |
OpenZFS Version | 2.2.2 |
Describe the problem you're observing
Using systemd ZFS mounts are being unmounted again after being mounted on boot if keyfile was loaded from a automount device. Please see (https://github.com/systemd/systemd/issues/31280):
We added WantsMountsFor= (https://github.com/systemd/systemd/pull/30214) for that use case. zfs-mount-generator needs to be taught to use that instead, which is beyond the scope of systemd's bug tracker.
Describe how to reproduce the problem
- use systemd
- have USB device with keyfile on it
- have dataset with property like
keylocation=file:///mnt/stick/zfs.key
- use
zfs-mount-generator
units to unlock/mount encrypted datasets - have a
/etc/fstab
entry like:/dev/disk/by-id/usb-some-id-of-device /mnt/stick ext2 x-systemd.device-timeout=5min,x-systemd.automount,x-systemd.idle-timeout=5s 0 0
Now after loading the key from the usb device all encrypted zfs datasets are being unmounted as soon as /mnt/stick unmount is triggered by systemd