I cannot delete incus container

I having a problem with deleting container, I tried to stop, start, restart it. Nothing helps. Btw, the image or metadata in it is broken, because I spent 4 hours attempting to download debian iso with right metadata (my internet provider is hardly blocking incus while my vpn doesn’t work for wsl). I already found right image, but I can’t delete the old one.

root@LAPTOP-ROG:~# incus delete wazuh-server --force
Error: Stopping the instance failed: The instance is already stopped
root@LAPTOP-ROG:~# incus delete wazuh-server
Error: The instance is currently running, stop it first or pass --force
root@LAPTOP-ROG:~# incus list
±-------------±------±-----±-----±----------±----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
±-------------±------±-----±-----±----------±----------+
| wazuh-server | ERROR | | | CONTAINER | 0 |
±-------------±------±-----±-----±----------±----------+
root@LAPTOP-ROG:~# incus stop wazuh-server
Error: The instance cannot be cleanly shutdown as in Error status
root@LAPTOP-ROG:~# incus start wazuh-server
Error: The instance cannot be started as in Error status
root@LAPTOP-ROG:~# incus restart wazuh-server
Error: The instance cannot be cleanly shutdown as in Error status
root@LAPTOP-ROG:~# incus delete wazuh-server --force
Error: Stopping the instance failed: The instance is already stopped
root@LAPTOP-ROG:~# incus list
±-------------±------±-----±-----±----------±----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
±-------------±------±-----±-----±----------±----------+
| wazuh-server | ERROR | | | CONTAINER | 0 |
±-------------±------±-----±-----±----------±----------+
root@LAPTOP-ROG:~#

Can you show the config of that container? incus config show wazuh-server

You could try to delete the project, something like:

incus project show default # remember the config
incus profile show default # remember the devices

incus project create tmp
incus project switch tmp
incus project delete default
incus project create default
incus project edit default # add config again
incus project switch default
incus profile edit default # add devices again

could work

You could also just remove /var/lib/incus/* - maybe reinstall the package - and init incus again.

root@LAPTOP-ROG:~# incus config show wazuh-server
architecture: x86_64
config:
volatile.apply_template: create
volatile.base_image: 430725f7db4e5ef179321576605a651f0c00b4e96c03fc3638b022d06601cd8c
volatile.cloud-init.instance-id: 1d34b2f9-4917-4dc3-b7b1-63f030117e1d
volatile.eth0.hwaddr: 00:16:3e:28:74:4f
volatile.idmap.base: “0”
volatile.idmap.next: ‘[{“Isuid”:true,“Isgid”:false,“Hostid”:1000000,“Nsid”:0,“Maprange”:1000000000},{“Isuid”:false,“Isgid”:true,“Hostid”:1000000,“Nsid”:0,“Maprange”:1000000000}]’
volatile.last_state.idmap: ‘
volatile.uuid: 0a241452-41a4-4bfe-8aa5-33331d073f73
volatile.uuid.generation: 0a241452-41a4-4bfe-8aa5-33331d073f73
devices: {}
ephemeral: false
profiles:

  • default
    stateful: false
    description: “”

Thank you, I found the solution:
root@LAPTOP-ROG:~# rm -rf /var/lib/incus/*
rm: cannot remove ‘/var/lib/incus/guestapi’: Device or resource busy
rm: cannot remove ‘/var/lib/incus/shmounts’: Device or resource busy
root@LAPTOP-ROG:~# systemctl stop incus
Stopping ‘incus.service’, but its triggering units are still active:
incus.socket
root@LAPTOP-ROG:~# systemctl stop incus.socket
root@LAPTOP-ROG:~# rm -rf /var/lib/incus/*
root@LAPTOP-ROG:~# incus list
Error: The incus daemon doesn’t appear to be started (socket path: /var/lib/incus/unix.socket)
root@LAPTOP-ROG:~# systemctl start incus
root@LAPTOP-ROG:~# incus list
±-----±------±-----±-----±-----±----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
±-----±------±-----±-----±-----±----------+
root@LAPTOP-ROG:~#

1 Like

I think you need something like incus admin init now