ZFS pool import fails on boot, but appears to be imported after

i have also come across this issue today

- fresh install of pve 8.1 inside a VM
- zfs rootfs (rpool)
- added a single disk and put zfs on that via pve gui (name testzfs)
- reboot

getting several of these on reboot

Feb 13 21:48:27 pve systemd[1]: Starting zfs-import-cache.service - Import ZFS pools by cache file...
Feb 13 21:48:27 pve systemd[1]: zfs-import-scan.service - Import ZFS pools by device scanning was skipped because of an unmet conditi>
Feb 13 21:48:27 pve systemd[1]: Starting zfs-import@testzfs.service - Import ZFS pool testzfs...
Feb 13 21:48:27 pve zpool[521]: cannot import 'testzfs': pool already exists
Feb 13 21:48:27 pve systemd[1]: zfs-import@testzfs.service: Main process exited, code=exited, status=1/FAILURE
Feb 13 21:48:27 pve systemd[1]: zfs-import@testzfs.service: Failed with result 'exit-code'.
Feb 13 21:48:27 pve systemd[1]: Failed to start zfs-import@testzfs.service - Import ZFS pool testzfs.
Feb 13 21:48:27 pve systemd[1]: Finished zfs-import-cache.service - Import ZFS pools by cache file.
Feb 13 21:48:27 pve systemd[1]: Reached target zfs-import.target - ZFS pool import target.


did some "zpool export testzfs" and the pool reappeared automatically.

after that, the error was gone and not reproducable any more.

then i deleted testzfs pool and wipefs'd /dev/sdb - and recreated zpool via gui with new name "testzfs2"

on reboot, the error is back, but not with "pool already exists" but with "no such pool available". but it's there after boot - and mounted

Feb 13 22:41:53 pve systemd[1]: Starting zfs-import@testzfs2.service - Import ZFS pool testzfs2...
Feb 13 22:41:53 pve systemd[1]: Finished ifupdown2-pre.service - Helper to synchronize boot up for ifupdown.
Feb 13 22:41:53 pve zpool[514]: cannot import 'testzfs2': no such pool available
Feb 13 22:41:53 pve systemd[1]: zfs-import@testzfs2.service: Main process exited, code=exited, status=1/FAILURE
Feb 13 22:41:53 pve systemd[1]: zfs-import@testzfs2.service: Failed with result 'exit-code'.
Feb 13 22:41:53 pve systemd[1]: Failed to start zfs-import@testzfs2.service - Import ZFS pool testzfs2.
Feb 13 22:41:53 pve systemd[1]: Finished zfs-import-cache.service - Import ZFS pools by cache file.

another "zpool export testzfs2" and - voila - the error is gone again.

@Stoiko Ivanov

also see

https://forum.proxmox.com/threads/gelöst-problem-mit-zfs-zpool-cache.122980/
 
Hi,

a note for people landing here: the failing zfs-import@<pool>.service itself is mostly harmless (the pool gets imported by something else; bug #4835, the units are ordered differently since PVE 8.2). But one of the "something else" is PVE's storage activation, which imports the pool on demand from pvestatd and from the guest autostart, at almost the same time. While the first import runs, the second fails with "no such pool available" - and if that is the autostart, onboot guests on that pool stay stopped.

If you see "Starting VM ... failed: could not activate storage ..., no such pool available" (or "dataset is busy") after a reboot: I filed that as bug #8230 with a patch on pve-devel. Description, a test package for libpve-storage-perl 9.1.13 and workarounds here: