zfs/etc/systemd/system
Didier Roche 8ae8b2a144 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 <antonio.e.russo@gmail.com>
Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Didier Roche <didrocks@ubuntu.com>
Closes #9360
2019-10-02 10:51:55 -07:00
..
.gitignore Add systemd unit files for ZFS startup 2014-02-05 12:25:30 -08:00
50-zfs.preset.in New service that waits on zvol links to be created 2019-07-17 15:33:05 -07:00
Makefile.am Restore :: in Makefile.am 2019-08-26 11:48:31 -07:00
zfs-import-cache.service.in Move dracut specifics to dracut module 2019-04-02 17:14:39 -07:00
zfs-import-scan.service.in Move dracut specifics to dracut module 2019-04-02 17:14:39 -07:00
zfs-import.target.in Cleanup systemd dependencies 2017-11-08 09:39:15 -08:00
zfs-mount.service.in Workaround to avoid a race when /var/lib is a persistent dataset 2019-10-02 10:51:55 -07:00
zfs-share.service.in Race between zfs-share and zfs-mount services 2019-07-28 18:13:56 -07:00
zfs-volume-wait.service.in New service that waits on zvol links to be created 2019-07-17 15:33:05 -07:00
zfs-volumes.target.in New service that waits on zvol links to be created 2019-07-17 15:33:05 -07:00
zfs-zed.service.in Add kernel module auto-loading 2018-03-13 10:45:55 -07:00
zfs.target.in Systemd configuration fixes 2016-05-27 11:54:29 -07:00