Can't start lxd, zfs pool import fails

While I was away for xmas lxd stopped working. I haven’t touched the system for a week, and now when I tried to do lxc ls I got Error: Get "http://unix.socket/1.0": EOF. I looked at the forums which brought me to the logs:

Dec 28 12:08:31 worker1 lxd.daemon[116408]: => Starting LXD
Dec 28 12:08:31 worker1 lxd.daemon[116553]: t=2021-12-28T12:08:31+0100 lvl=warn msg=" - Couldn't find the CGroup network priority controller, network priority will be ignored"
Dec 28 12:08:31 worker1 lxd.daemon[116553]: t=2021-12-28T12:08:31+0100 lvl=eror msg="Failed to start the daemon" err="Failed initializing storage pool \"lxd\": Failed to run: zpool
 import -f -d /var/snap/lxd/common/lxd/disks lxd: cannot import 'lxd': no such pool available"
Dec 28 12:08:31 worker1 lxd.daemon[116553]: Error: Failed initializing storage pool "lxd": Failed to run: zpool import -f -d /var/snap/lxd/common/lxd/disks lxd: cannot import 'lxd'

I do run zfs, but I never had a zpool called “disks”, so something must have happened there:

sqlite3 /var/snap/lxd/common/lxd/database/global/db.bin
SELECT * FROM storage_pools;
id  name     driver  description  state
--  -------  ------  -----------  -----
1   lxd      zfs                  1
3   default  zfs                  1

Not sure if something is wrong here or how I can fix it.

I tried to create a “disks” pool but that didn’t help either. Here is the current list from zfs list

root@worker1:/var/snap/lxd/common/lxd# zfs list
NAME                                                                                          USED  AVAIL     REFER  MOUNTPOINT
storage                                                                                      50.8G   825G       96K  /storage
storage/dockers                                                                              13.2M   825G     4.23M  /storage/dockers
storage/lxd                                                                                  50.7G   825G       96K  none
storage/lxd/containers                                                                       50.1G   825G       96K  none
storage/lxd/containers/algorand                                                              11.3G   825G     3.88G  none
storage/lxd/containers/localstuff                                                            2.17G   825G     1.86G  none
storage/lxd/containers/machine1                                                               331M   825G      331M  none
storage/lxd/containers/machine2                                                               270M   825G      270M  none
storage/lxd/containers/nft-web                                                                516M   825G      415M  none
storage/lxd/containers/robot                                                                 35.6G   825G     29.2G  none
storage/lxd/custom                                                                             96K   825G       96K  none
storage/lxd/deleted                                                                           585M   825G       96K  none
storage/lxd/deleted/containers                                                                 96K   825G       96K  none
storage/lxd/deleted/custom                                                                     96K   825G       96K  none
storage/lxd/deleted/images                                                                    585M   825G       96K  none
storage/lxd/deleted/images/7f669bb048ec2b44229a2b9d9c04b8d209150b4d5e1140606e98fb662c8ba61c   195M   825G      195M  none
storage/lxd/deleted/images/8054e116e0c707476b67d2c6a10186d708b219da94371c4297edff26167b163e   195M   825G      195M  none
storage/lxd/deleted/images/f374e59b4184e1bb8bb315729ebffadfa74a7af9cf7b29d8b166b70a8877c8e4   195M   825G      195M  none
storage/lxd/deleted/virtual-machines                                                           96K   825G       96K  none
storage/lxd/disks                                                                              96K   825G       96K  none
storage/lxd/images                                                                             96K   825G       96K  none
storage/lxd/virtual-machines                                                                   96K   825G       96K  none

I’m running snap on Debian, Linux worker1 5.10.0-10-amd64 #1 SMP Debian 5.10.84-1 (2021-12-08) x86_64 GNU/Linux, with lxd 4.21

https://github.com/lxc/lxd/issues/7583 seems related, but I’m not sure how to get it working, but I’ll give it a shot.

Not sure what the proper solution is, but I dropped all instances via delete from instances with vim /var/snap/lxd/common/lxd/database/patch.global.sql, re-added the storage pool “default” and did lxd recover and now my machines are up again.