Lxc storage delete lxd Error: No such object

I’ve deleted the zfs pool manually and still I’m unable to get lxc to remove this storage “lxd” (the name of the zfs pool I created). When I rebooted the server lxd refused to start because the lxd zfs pool was missing. However I can’t figure out where the metadata is coming from and/or how to change the default pool to a different zfs pool.

How do I change the default storage pool to lxdmirror and remove all traces of lxd… and get lxd to read from the right storage pool on start up?

# lxc storage delete lxd

Error: No such Object
# lxc storage list lxd
+-----------+-------------+--------+-----------+---------+
|   NAME    | DESCRIPTION | DRIVER |  SOURCE   | USED BY |
+-----------+-------------+--------+-----------+---------+
| lxd       |             | zfs    | lxd       | 2       |
+-----------+-------------+--------+-----------+---------+
| lxdmirror |             | zfs    | lxdmirror | 15      |
+-----------+-------------+--------+-----------+---------+

# lxc storage show lxd
config:
  source: lxd
  zfs.pool_name: lxd
description: ""
name: lxd
driver: zfs
used_by:
- /1.0/images/beb29682c9b598c824592166ee619c8478f5ccba226f525a7d7c0e8810bf3874
- /1.0/images/e1e62217dabb1acff585f13472af44b2720839546d1c3fb60d6187afa91fc995
status: Created
locations:
- none

The errors may be coming from those images.
Can you do lxc storage volume list lxd and then attempt to delete them with:

  • lxc storage volume delete lxd image/beb29682c9b598c824592166ee619c8478f5ccba226f525a7d7c0e8810bf3874
  • lxc storage volume delete lxd image/e1e62217dabb1acff585f13472af44b2720839546d1c3fb60d6187afa91fc995

It could be that this is what’s failing and preventing the deletion of the storage pool.

If they don’t go away willingly (likely since you wiped the pool), you may need a bit of DB surgery, can you show:

  • lxd sql global “SELECT * FROM storage_pools;”
  • lxd sql global “SELECT * FROM storage_volumes;”
1 Like

Sorry for bumping this thread again.

Recently I had this problem too.

$ lxc storage volume list local

+------+------+-------------+---------+----------+
| TYPE | NAME | DESCRIPTION | USED BY | LOCATION |
+------+------+-------------+---------+----------+

It show empty list

But, when I try to delete it

$ lxc storage delete local

Error: Failed getting image info for “2cfc5a5567b8d74c0986f3d8a77a2a78e58fe22ea9abd2693112031f85afa1a1”: No such object

I tried the DB surgery command

$ lxd sql global “SELECT * FROM storage_pools;”

+----+--------------+--------+-------------+-------+
| id |     name     | driver | description | state |
+----+--------------+--------+-------------+-------+
| 1  | local        | zfs    |             | 1     |
| 6  | brickpool    | zfs    |             | 1     |
| 7  | datapool     | zfs    |             | 1     |
| 9  | ujian_online | cephfs |             | 1     |
+----+--------------+--------+-------------+-------+

$ lxd sql global “SELECT * FROM storage_volumes WHERE name=‘2cfc5a5567b8d74c0986f3d8a77a2a78e58fe22ea9abd2693112031f85afa1a1’;”

+----+------------------------------------------------------------------+-----------------+---------+------+-------------+------------+
| id |                               name                               | storage_pool_id | node_id | type | description | project_id |
+----+------------------------------------------------------------------+-----------------+---------+------+-------------+------------+
| 2  | 2cfc5a5567b8d74c0986f3d8a77a2a78e58fe22ea9abd2693112031f85afa1a1 | 1               | 1       | 1    |             | 1          |
| 6  | 2cfc5a5567b8d74c0986f3d8a77a2a78e58fe22ea9abd2693112031f85afa1a1 | 1               | 3       | 1    |             | 1          |
+----+------------------------------------------------------------------+-----------------+---------+------+-------------+------------+

How can I get rid this image from the pool?

Can you show the output of:

lxd sql global 'select * from images where fingerprint = "2cfc5a5567b8d74c0986f3d8a77a2a78e58fe22ea9abd2693112031f85afa1a1"'

My suspicion is that you won’t get a row back, and this is what is causing the error when deleting the pool here: https://github.com/lxc/lxd/blob/66fd330d466b22ed474717c6985aae632da583fc/lxd/storage_pools.go#L615-L618

@stgraber is there any particular reason why we are checking whether the image exists first before attempting to delete the image volume? As the only property we use from the returned imgInfo is the Fingerprint field, which we already have as the volume name? Is the check there purely to confirm that the volume we are about to delete is indeed an image volume? If so then we could change the query to return the volume type instead and check that.

Hi,
I have the same issue.
Can’t delete the default pool.