Zfs pool has disappeared, visible with zpool import but not in zpool list

I have a file-based zfs pool for prototyping purposes on a Gentoo Linux machine running kernel 5.4.16, zfs 2.0.6 and lxd 4.0.8.

LXD will not start because the zfs pool fails to import:

t=2021-12-16T14:27:47-0700 lvl=eror msg="Failed to start the daemon" err="Failed initializing storage pool \"lxd_zfs\": Failed to run: zpool import zfs_lxd: cannot import 'zfs_lxd': no such pool available"

zpool cannot find any pools:

# zpool list
no pools available

/etc/zfs/zfs.cache is empty (0 bytes).

If try to manually import the pool, it looks like it exists:

# zpool import -d /var/lib/zfs_img/
   pool: zfs_lxd
     id: 15622706274310801825
  state: ONLINE
status: Some supported features are not enabled on the pool.
 action: The pool can be imported using its name or numeric identifier, though
        some features will not be available without an explicit 'zpool upgrade'.
 config:

    zfs_lxd                        ONLINE
      mirror-0                     ONLINE
        /var/lib/zfs_img/zfs0.img  ONLINE
        /var/lib/zfs_img/zfs1.img  ONLINE
      mirror-1                     ONLINE
        /var/lib/zfs_img/zfs2.img  ONLINE
        /var/lib/zfs_img/zfs3.img  ONLINE

But even after doing this, the supposedly imported pool still isn’t visible:

# zpool status
no pools available

I’ve done updates like this before and beyond rebuilding and installing the kernel module, I haven’t had to do anything to keep things working. What happened here? What can I do?

(The mtime on /etc/zfs/zfs.cache is November 22, one day after the update to lxd 4.0.8, so it looks like this problem began with the update from 4.0.7, but I don’t see how this is an LXD problem. It could be just a coincidence.)

Okay, I misunderstood how the import command works. You need to specify the poolname even if it is in the label:

# zpool import -d /var/lib/zfs_img/ zfs_lxd
# zpool status
  pool: zfs_lxd
 state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
        still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
        the pool may no longer be accessible by software that does not support
        the features. See zpool-features(5) for details.
  scan: resilvered 45K in 00:00:00 with 0 errors on Thu Aug 19 07:00:27 2021
config:

        NAME                           STATE     READ WRITE CKSUM
        zfs_lxd                        ONLINE       0     0     0
          mirror-0                     ONLINE       0     0     0
            /var/lib/zfs_img/zfs0.img  ONLINE       0     0     0
            /var/lib/zfs_img/zfs1.img  ONLINE       0     0     0
          mirror-1                     ONLINE       0     0     0
            /var/lib/zfs_img/zfs2.img  ONLINE       0     0     0
            /var/lib/zfs_img/zfs3.img  ONLINE       0     0     0

errors: No known data errors

# lxc list
Error: Get "http://unix.socket/1.0": dial unix /var/lib/lxd/unix.socket: connect: no such file or directory
# rc-service lxd status
 * status: crashed
# rc-service lxd restart
 * Stopping lxd service (but not containers) ...
 * start-stop-daemon: no matching processes found                                                                                                                     [ ok ]
 * Starting lxd service ...                                      
# rc-service lxd status
 * status: started