diff options
author | Didier Roche <[email protected]> | 2019-10-02 19:51:55 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-10-02 10:51:55 -0700 |
commit | 8ae8b2a1445bcccee1bb8ee7d4886f30050f6f53 (patch) | |
tree | 6fd7ed21d929ae760ad0fe92365d5626e8e26281 /etc | |
parent | d31277abb1db51dece836dd47628ca42c07e528c (diff) |
Workaround to avoid a race when /var/lib is a persistent dataset
If /var/lib is a dataset not under <pool>/ROOT/<root_dataset>, as
proposed in the ubuntu root on zfs upstream guide
(https://github.com/zfsonlinux/zfs/wiki/Ubuntu-18.04-Root-on-ZFS),
we end up with a race where some services, like systemd-random-seed
are writing under /var/lib, while zfs-mount is called. zfs mount will
then potentially fail because of /var/lib isn't empty and so, can't be
mounted.
Order those 2 units for now (more may be needed) as we can't declare
virtually a provide mount point to match
"RequiresMountsFor=/var/lib/systemd/random-seed" from
systemd-random-seed.service.
The optional generator for zfs 0.8 fixes it, but it's not enabled
by default nor necessarily required.
Example:
- rpool/ROOT/ubuntu (mountpoint = /)
- rpool/var/ (mountpoint = /var)
- rpool/var/lib (mountpoint = /var/lib)
Both zfs-mount.service and systemd-random-seed.service are starting
After=systemd-remount-fs.service. zfs-mount.service should be done
before local-fs.target while systemd-random-seed.service should finish
before sysinit.target (which is a later target).
Ideally, we would have a way for zfs mount -a unit to declare all paths
or move systemd-random-seed after local-fs.target.
Reviewed-by: Antonio Russo <[email protected]>
Reviewed-by: Richard Laager <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Didier Roche <[email protected]>
Closes #9360
Diffstat (limited to 'etc')
-rw-r--r-- | etc/systemd/system/zfs-mount.service.in | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/etc/systemd/system/zfs-mount.service.in b/etc/systemd/system/zfs-mount.service.in index a18691a46..6507c0765 100644 --- a/etc/systemd/system/zfs-mount.service.in +++ b/etc/systemd/system/zfs-mount.service.in @@ -6,6 +6,7 @@ After=systemd-udev-settle.service After=zfs-import.target After=systemd-remount-fs.service Before=local-fs.target +Before=systemd-random-seed.service [Service] Type=oneshot |