zfs-mount-generator nofail option does not work
System information
| Type | Version/Name |
|---|---|
| Distribution Name | Arch Linux |
| Distribution Version | rolling |
| Kernel Version | 6.12.18-1-lts |
| Architecture | x86_64 |
| OpenZFS Version | 2.3.1-1 |
Describe the problem you're observing
Mount units generated by zfs-mount-generator with org.openzfs.systemd:nofail=on set on the dataset still have Before=local-fs.target set in the running system.
That is because according to man 5 systemd.mount: "Mount units referring to local file systems automatically gain an After= dependency on local-fs-pre.target, and a Before= dependency on local-fs.target unless one or more mount options among nofail, x-systemd.wanted-by=, and x-systemd.required-by= is set."
The zfs-mount-generator does not itself set the Before=local-fs.target ordering when org.openzfs.systemd:nofail=on is set, but that does not keep systemd from then still adding it as a default dependency.
I believe zfs-mount-generator should also include nofail in the mount Options= in this case.
Describe how to reproduce the problem
- Set
canmount=onandorg.openzfs.systemd:nofail=onon a dataset. systemctl soft-rebootsystemctl show mnt-<dataset>.mount | grep Before=- Observe that
local-fs.targetis still included
Include any warning/errors/backtraces from the system logs
I confirm this and it creates various ordering cycles in systemd, breaking the boot process.
Is there a workaround for this like an override or something? This really is a show-stopper for me right now.
Thanks
Is there a workaround for this like an override or something?
Yes, by overriding the mount unit via systemctl edit mnt-DATASET.mount and appending nofail to the existing mount Options:
[Mount]
Options=...,nofail
Ugly and error-prone due to the now static mount options, but at least it's a workaround until this issue got resolved.
Cheers
at least it's a workaround until this issue got resolved.
Actually, no. local-fs.target still sports an After=zfs-mount.service which in turn has a After=mnt-DATASET.mount in place. So, effectively, the order is still Before=local-fs.targetfor the mount unit due to these reverse dependencies. 😭