Failed to create container, no such pool

I’ve been using a file based zfs pool for lxd and recently had to create a new pool. I’ve tried running lxd init again to reconfigure which pool it uses, but lxc still keeps trying to use the old pool.

lxc launch ubuntu:trusty -p default -p codersquid              
Creating the container
error: Failed container creation:
 - https://cloud-images.ubuntu.com/releases: Failed to run: zfs create -o mountpoint=none -p lxd/images/8a3b6cc4b594724c69aaffa6fe2e847fce9533cd59377d8707f31f04e4aaaf22: cannot create 'lxd/images/8a3b6cc4b594724c69aaffa6fe2e847fce9533cd59377d8707f31f04e4aaaf22': no such pool 'lxd'

How do I know if I’ve successfully reconfigured lxd? It seems obvious that I haven’t, but first I want to verify that.

What version of LXD are you using?

I’m using version 2.15.

Ok, what does “lxc storage list” and “zpool list” show?

I’m not sure where I left off yesterday after flailing around with this, bu t here is what it currently shows

» lxc storage list
+---------+-------------+--------+--------------------------------------------+---------+
|  NAME   | DESCRIPTION | DRIVER |                   SOURCE                   | USED BY |
+---------+-------------+--------+--------------------------------------------+---------+
| default |             | zfs    | /var/snap/lxd/common/lxd/disks/default.img | 0       |
+---------+-------------+--------+--------------------------------------------+---------+
| lxd     |             | zfs    | lxd                                        | 3       |
+---------+-------------+--------+--------------------------------------------+---------+
| lxd2    |             | zfs    | /var/snap/lxd/common/lxd/disks/lxd2.img    | 0       |
+---------+-------------+--------+--------------------------------------------+---------+
| lxdfile |             | zfs    | lxdfile                                    | 0       |
+---------+-------------+--------+--------------------------------------------+---------+

» sudo zpool list
NAME   SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
lxd2  49.8G   267K  49.7G         -     0%     0%  1.00x  ONLINE  -

note, earlier I followed this post about using a file based zfs pool.

In trying to figure this out yesterday, I think I may have given up on creating the pool and decided to try and do something more standard, so I initialized lxd again and selected the option of having it create the pool.

I think I need to start over.

My ultimate goal is to have a pool that exists on my 1TB disk, since the / disk is tiny and I’ll run out of space. The file based approach has worked before, with only a few problems due to the pool not being found.

Oh wow, that’s quite a mess you have here :slight_smile:

So it looks like the one pool you have online at the ZFS layer is empty.
The one that’s supposed to have your containers is “lxd” but it’s unknown to ZFS so that’s not very good…

If you know what’s backing the “lxd” zpool, we can probably get it back online and then cleanup the rest, but that’s not going to be trivial to do.

If you don’t care about what you have right now. You can “zpool destroy lxd2”, then “systemctl stop lxd.service lxd.socket” and then wipe everything in “/var/lib/lxd”. That’ll clear everything that’s related to LXD from the machine. You can then do “systemctl start lxd” and you’ll be back to a completely empty LXD that you can setup with “lxd init” to use the block device you want.

I’m taking this route. I’ll let you know if it doesn’t work. Thanks for the help!

Okay, after I’ve followed this, lxc storage list still shows the bogus list of pools. Is there some way to clear that out? It causes lxd to think that the pools already exist, even though they do not.

By this point, I don’t care about any containers or pools. I’m happy to blow away anything to do with lxd so that I can start over. I’m also happy to get rid of the previous network bridges created by lxd.

You wiped /var/lib/lxd/*?

The list of storage pools in “lxc storage list” comes from the LXD database (/var/liblxd/lxd.db) so I don’t see how that’d survive you stopping LXD and wiping /var/lib/lxd clean.

Yes. Here’s what I did. I just did it again to be certain.

» sudo systemctl stop lxd.socket
» sudo systemctl stop lxd.service
» sudo rm -rf /var/lib/lxd/*
» sudo zpool list
no pools available
» ls /var/lib/lxd

» cd
» sudo systemctl start lxd
» lxc storage list
+---------+-------------+--------+--------------------------------------------+---------+
|  NAME   | DESCRIPTION | DRIVER |                   SOURCE                   | USED BY |
+---------+-------------+--------+--------------------------------------------+---------+
| default |             | zfs    | /var/snap/lxd/common/lxd/disks/default.img | 0       |
+---------+-------------+--------+--------------------------------------------+---------+
| lxd     |             | zfs    | lxd                                        | 3       |
+---------+-------------+--------+--------------------------------------------+---------+
| lxd2    |             | zfs    | /var/snap/lxd/common/lxd/disks/lxd2.img    | 0       |
+---------+-------------+--------+--------------------------------------------+---------+
| lxdfile |             | zfs    | lxdfile                                    | 0       |
+---------+-------------+--------+--------------------------------------------+---------+
» lxd init
Do you want to configure a new storage pool (yes/no) [default=yes]? 
Name of the new storage pool [default=default]: 
The requested storage pool "default" already exists. Please choose another name.
Name of the new storage pool [default=default]: ^C

I know, right?

Hmm, do you maybe have the LXD snap installed too? :slight_smile:

Oh, you definitely do, I missed it in the paths you posted earlier.

Ohhhhh. I forgot. I used to have the package and then I saw it was available as a snap.

Ok, so if you do want the snap rather than native package, you should do:

  • apt remove --purge lxd lxd-client
  • rm -Rf /var/lib/lxd
  • systemctl stop snap.lxd.daemon.service
  • rm -Rf /var/snap/lxd/common/lxd/*
  • systemctl start snap.lxd.daemon.service

That “should” clear the double LXD setup you have right now and also reset the LXD snap installation.

2 Likes