I tried stopping an archlinux vm and it took forever to stop. So i lxc delete --force vm and it deleted alright. But trying to create the archlinux vm gives me the ‘rror: Failed instance creation: Failed creating instance record: Add instance info to the database: This “instances” entry already exists’ ERROR.
As I tried deleting the folders I also get 'Error: Failed to remove symlink “/var/snap/lxd/common/lxd/virtual-machines/archlinux”: remove /var/snap/lxd/common/lxd/virtual-machines/archlinux: directory not empty
’
Going into the subroot rot rm -rf the folder doesn’t work either. Any assistance would be much appreciated
And get this error ‘Error: Failed to remove symlink “/var/snap/lxd/common/lxd/virtual-machines/archlinux”: remove /var/snap/lxd/common/lxd/virtual-machines/archlinux: directory not empty’
Hrm, well something very unusual has been going on outside of LXD as LXD never unpacks the image into /var/snap/lxd/common/lxd/virtual-machines and instead unpacks into /var/snap/lxd/common/lxd/storage-pools/<pool_name>/virtual-machines/<instance_name> and then creates a symlink to it
in /var/snap/lxd/common/lxd/virtual-machines/<instance_name>.
Normally the image unpack occurs before creating the symlink.
As we can see has happened for the ubuntu instance.
I can’t say what has been happening on your system, but I guess the only solution is to manually remove that directory now using: sudo rm -rvf /var/snap/lxd/common/lxd/virtual-machines/archlinux
You should then be able to do lxc delete <instance> to clear the database too.