Can't delete container

I can’t get distrobox rm to delete a container:

❯ distrobox ls
ID           | NAME                 | STATUS             | IMAGE                         
992a366e5e06 | tst                  | Exited (1) 5 minutes ago | docker.io/library/clearlinux:latest

~ 
❯ distrobox rm -f tst
Removing exported binaries...

~ 
❯ distrobox ls
ID           | NAME                 | STATUS             | IMAGE                         
992a366e5e06 | tst                  | Exited (1) 2 seconds ago | docker.io/library/clearlinux:latest

I am not sure what the problem is. I can create other containers and remove them:

❯ distrobox create --name other --image debian:latest
Resolved "debian" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull docker.io/library/debian:latest...
Getting image source signatures
Copying blob 609c73876867 done   | 
Copying config e15dbfac2d done   | 
Writing manifest to image destination
e15dbfac2d2b38406db17278673b8d905785386f916a843887115566d7a9d97a
Creating 'other' using image debian:latest	 [ OK ]
Distrobox 'other' successfully created.
To enter, run:

distrobox enter other


~ took 4s 
❯ distrobox ls
ID           | NAME                 | STATUS             | IMAGE                         
992a366e5e06 | tst                  | Exited (1) About a minute ago | docker.io/library/clearlinux:latest
5d24f0977054 | other                | Created            | docker.io/library/debian:latest

~ 
❯ distrobox rm -f other
Removing exported binaries...
Removing container...
other

~ took 52s 
❯ distrobox ls
ID           | NAME                 | STATUS             | IMAGE                         
992a366e5e06 | tst                  | Exited (1) 40 seconds ago | docker.io/library/clearlinux:latest

But this particular one (whose creation I interrupted with Ctrl-C) seems to have gone into some weird state. It simply won’t go away…

I also can’t enter the container:

❯ distrobox enter tst
Starting container...                   	 [ OK ]
Installing basic packages...            	 [ OK ]
Setting up devpts mounts...             	 [ OK ]
Setting up read-only mounts...          	 [ OK ]
Setting up read-write mounts...         	 [ OK ]
Setting up host's sockets integration...	 [ OK ]
Integrating host's themes, icons, fonts...	 [ OK ]
Setting up package manager exceptions...	 [ OK ]
Setting up distrobox profile...         	 [ OK ]
Setting up sudo...                      	 [ OK ]
Setting up user groups...               	 [ OK ]
Setting up kerberos integration...      	 [ OK ]
Setting up user's group list...         	 [ OK ]
Setting up existing user...             	 [ OK ]
Setting up existing user: /etc/passwd...	 [ OK ]
Setting up existing user: /etc/group... 	 Error: An error occurred

Any idea how to nuke this?

Can you try to delete the container with podman instead?

If you don’t mind destroying all your containers: rm -rf ~/.local/share/containers/

Thank you, this has worked.

The problem is that I immediately tried to recreate another clear linux box (from docker.io/library/clearlinux, tried both base and latest) and got into the same situation for both. Can’t delete them, have to nuke the entire folder!

I was still able to create (and then remove) others, like fedora:39 and debian:12 without issue.

It is not comforting to know that you could get stuck with an invalid container (especially if you have actual images).

I wonder why clear linux in particular does not work…

Interesting!
Have you tried creating the container by specifying the same OS image from the cloud with docker or podman (via terminal)? I am suspecting that the images linked could be corrupted.