lxc / incus

Powerful system container and virtual machine manager
https://linuxcontainers.org/incus
Apache License 2.0
2.48k stars 198 forks source link

Error: Failed creating instance from image: Error inserting volume #1184

Closed skyxx closed 2 weeks ago

skyxx commented 2 weeks ago

Required information

incus_info.log

Issue description

After INCUS upgrade from 6.3 to 6.4 im not able create/launch new container. No extra info in incus log or systemd.

Steps to reproduce

  1. incus launch 8e8bd0b64a4d mycontainer --storage pool-system

Launching mycontainer Error: Failed creating instance from image: Error inserting volume "8e8bd0b64a4d2572a2b2c798c2720e1cbee16dd96d6f3d0bc56a5cb533fa11da" for project "default" in pool "pool-system" of type "images" into database "UNIQUE constraint failed: index 'storage_volumes_unique_storage_pool_id_node_id_project_id_name_type'"

Information to attach

stgraber commented 2 weeks ago

What's that 8e8bd0b64a4d2572a2b2c798c2720e1cbee16dd96d6f3d0bc56a5cb533fa11da image?

The error makes it sound like the image is partly present on the system, causing some DB records to be out of sync with the rest.

Can you maybe show:

skyxx commented 2 weeks ago

Yes 8e8bd0b64a4d2572a2b2c798c2720e1cbee16dd96d6f3d0bc56a5cb533fa11da is an local image.

Here is result of requested info sql.log

I figureout that im removed some time ago generated lvm disk of that image by # lvremove ins/images_8e8bd0b64a4d2572a2b2c798c2720e1cbee16dd96d6f3d0bc56a5cb533fa11da

So it was my fault removing volume not by incus but with lvm tool. And launching new instance want create that volume, but info already exist in config database so there was UNIQUE constraint violation.

So remove that volume from incus config or reimport that local image fix issue.

thank you for your help :)

stgraber commented 2 weeks ago

Okay, so indeed, running a incus admin sql global "DELETE FROM storage_volumes WHERE name='8e8bd0b64a4d2572a2b2c798c2720e1cbee16dd96d6f3d0bc56a5cb533fa11da' should take care of this by aligning the database with the disk.