OK, I retested with 0.7.5-1ubuntu3 and it's almost there but zfs-
mount.service still runs before the zfs kernel module is loaded:

$ systemctl --failed
  UNIT              LOAD   ACTIVE SUB    DESCRIPTION
● zfs-mount.service loaded failed failed Mount ZFS filesystems

$ sudo journalctl -u zfs-mount.service
-- Logs begin at Fri 2018-03-02 19:08:55 UTC, end at Fri 2018-03-02 19:31:42 
UTC. --
Mar 02 19:09:00 ubuntu systemd[1]: Starting Mount ZFS filesystems...
Mar 02 19:09:00 ubuntu zfs[557]: The ZFS modules are not loaded.
Mar 02 19:09:00 ubuntu zfs[557]: Try running '/sbin/modprobe zfs' as root to 
load them.
Mar 02 19:09:00 ubuntu systemd[1]: zfs-mount.service: Main process exited, 
code=exited, status=1/FAILURE
Mar 02 19:09:00 ubuntu systemd[1]: zfs-mount.service: Failed with result 
'exit-code'.
Mar 02 19:09:00 ubuntu systemd[1]: Failed to start Mount ZFS filesystems.

But, by the time the system is fully up, something else has loaded the
zfs kernel module along the way:

$ lsmod|grep zfs
zfs                  3407872  3

I do see that zfs-load-module.service has "WantedBy=zfs-mount.service",
but maybe zfs-mount.service needs "After=zfs-load-module.service" to
insure the dependency order? Looking at the dependency tree, zfs-
mount.service and zfs-import.target happen in parallel with the start of
zfs-load-module.service resulting in a race condition.

-- 
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/1741081

Title:
  zfs-import-cache.service fails on startup

Status in zfs-linux package in Ubuntu:
  Fix Released
Status in zfs-linux source package in Artful:
  In Progress
Status in zfs-linux source package in Bionic:
  Fix Released

Bug description:
  == SRU Request, Artful ==

  Enable ZFS module to be loaded without the broken ubuntu-load-zfs-
  unconditionally.patch.

  == Fix ==

  Add a new zfs-load-module.service script that modprobes the ZFS module
  and remove any hard coded module loading from zfs-import-cache.service
  & zfs-import-scan.service and make these latter scripts require the
  new zfs-load-module.service script.  Also remove the now defunct
  ubuntu-load-zfs-unconditionally.patch as this will no longer be
  required.

  == Testcase ==

  On a clean VM, install with the fixed package, zfs should load
  automatically.

  == Regression potential ==

  ZFS module may not load if the changes are broken. However, testing
  proves this not to be the case.

  --------------------

  I just noticed on my test VM of artful that zfs-import-cache.service
  does not have a ConditionPathExists=/etc/zfs/zpool.cache. Because of
  that, it fails on startup, since the cache file does not exist.

  This line is being deleted by 
debian/patches/ubuntu-load-zfs-unconditionally.patch. This patch seems to exist 
per:
  https://bugs.launchpad.net/ubuntu/+source/lxd/+bug/1672749

  This patch still exists in bionic, so I assume it will be similarly
  broken.

  If the goal of the patch is to load the module (and only that), I
  think it should create a third unit instead:

  zfs-load-module.service
   ^^ runs modprobe zfs

  zfs-import-cache.service & zfs-import-scan.service
    ^^ per upstream minus modprobe plus Requires=zfs-load-module.service

  I have tested this manually and it works. I can submit a package patch
  if this is the desired solution.

  Interestingly, before this change, zfs-import-scan.service wasn't
  starting. If started manually, it worked. I had to give it a
  `systemctl enable zfs-import-scan.service` to create the Wants
  symlinks. Looking at the zfsutils-linux.postinst, I see the correct
  boilerplate from dh_systemd, so I'm not sure why this wasn't already
  done. Can anyone confirm or deny whether zfs-import-scan.service is
  enabled out-of-the-box on their system?

  Is the zfs-import-scan.service not starting actually the cause of the
  original bug? The design is that *either* zfs-import-cache.service or
  zfs-import-scan.service starts. They both call modprobe zfs.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/zfs-linux/+bug/1741081/+subscriptions

-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to