Error: Failed to create storage pool 'default'

I do the lxd init for the second time, and the Error information appears.
$ lxd init

Error: Failed to create storage pool 'default': Failed to run: zpool create -f -m none -O compression=on default /var/snap/lxd/common/lxd/disks/default.img: cannot create 'default': pool already exists

Even though I sudo snap remove --purge lxd, and then sudo snap install lxd. When I do lxd init, such Error information appears too.
How can I deal with it?

Can you show the output of sudo zpool list and sudo zfs list please?

I don’t have “zpool” and “zfs” programs installed. So I do sudo apt install zfs-fuse on my Ubuntu 16.04 real machine.

$ sudo zpool list
connect: no such file or directory
Please make sure that the zfs-fuse daemon is running.
internal error: failed to initialize ZFS library

$ sudo zfs list
connect: no such file or directory
Please make sure that the zfs-fuse daemon is running.
internal error: failed to initialize ZFS library

Can you install the zfsutils-linux package rather than zfs-fuse?

I find a usable apt mirror site, and finally apt install zfsutils-linux.

Here are the results of commands.

 $ sudo zpool list
default       36.2G   409K  36.2G         -     0%     0%  1.00x  ONLINE  -
storage_0503  36.2G   199M  36.1G         -     0%     0%  1.00x  ONLINE  -

 $ sudo zfs list
NAME                                                                                   USED  AVAIL  REFER  MOUNTPOINT
default                                                                                376K  35.1G    19K  none
default/containers                                                                      19K  35.1G    19K  none
default/custom                                                                          19K  35.1G    19K  none
default/deleted                                                                         95K  35.1G    19K  none
default/deleted/containers                                                              19K  35.1G    19K  none
default/deleted/custom                                                                  19K  35.1G    19K  none
default/deleted/images                                                                  19K  35.1G    19K  none
default/deleted/virtual-machines                                                        19K  35.1G    19K  none
default/images                                                                          19K  35.1G    19K  none
default/virtual-machines                                                                19K  35.1G    19K  none
storage_0503                                                                           199M  34.9G    19K  none
storage_0503/containers                                                               2.76M  34.9G    19K  none
storage_0503/containers/b1                                                            2.75M  34.9G   196M  /var/snap/lxd/common/lxd/storage-pools/storage_0503/containers/b1
storage_0503/custom                                                                     19K  34.9G    19K  none
storage_0503/deleted                                                                    95K  34.9G    19K  none
storage_0503/deleted/containers                                                         19K  34.9G    19K  none
storage_0503/deleted/custom                                                             19K  34.9G    19K  none
storage_0503/deleted/images                                                             19K  34.9G    19K  none
storage_0503/deleted/virtual-machines                                                   19K  34.9G    19K  none
storage_0503/images                                                                    196M  34.9G    19K  none
storage_0503/images/a5d6ba5d76295898d4be41ec12ff39da11b57f8a6dca42cab861d0cc24748cc2   196M  34.9G   196M  /var/snap/lxd/common/lxd/storage-pools/storage_0503/images/a5d6ba5d76295898d4be41ec12ff39da11b57f8a6dca42cab861d0cc24748cc2
storage_0503/virtual-machines                                                           19K  34.9G    19K  none

OK great, so you have two zpools, one called default (probably left over from the first time you ran lxd init) and one called storage_0503.

The storage_0503 zpool has one container called b1 in it, and the default zpool doesn’t have any containers in it.

So I would say you can safely delete the default zpool using zpool destroy default and then you should be able to run lxd init again.

Big brother, you are right!
I use sudo zpool destroy default. And I can successfully lxd init, presssing “Enter” key all the time with all default configurations.

But may the development team of LXD come up with a tool command inside the lxd? In that way I can operate easily and more relevantly to the lxd.

On a fresh system lxd init should complete fine, but we we don’t want to use an existing zpool if one already exists, which is why it warns you. You can choose to use a different zpool in the case where you were genuinely using default zpool for for some other purpose.