How to remove snap version of docker when snap remove --purge fails
https://askubuntu.com/questions/1559665/how-to-remove-snap-version-of-docker-when-snap-remove-purge-fails
I had docker running on my LTS 24.04 system that I had installed from the docker site--not the snap version from Ubuntu. However, I had not installed the docker-compose script (didn't know it wasn't included by default). Anyway, I naively tried to grab it using apt-get and suddenly I have the snap version of docker. This caused all kinds of problems, and I'd like to get rid of it, and start over.
I thought this would be easy, but my computer just hangs whenever I try
sudo snap docker disable
sudo snap remove docker # have tried with and without --purge
After running the command, I check on the process with
ps aux | grep snap
and see 2 processes that are in interruptible sleep mode (STAT Ss and S+) with sudo, and another process by root that has STAT Sl+, i.e, they are waiting on something...
I've tried killing the process and that causes snap to stop with
error: Change finished in status Hold with no error message.
I can reset the snap demon following the solution here
How can I force remove a snap
But even after resetting the snap daemon, when I execute
sudo snap remove --purge docker
I'm back to a hung system.
I can see that the docker service and docker.socket are stopped, so that should not be why the snap.daemon is waiting.
@Rinzwind:
No the service is not active. The system attempts to load it, but fails.
This did prompt me to remove the manually installed version of docker. That eliminates the docker service from even trying to start (it was broken since the snap install) since nothing is installed anymore. However, I still cannot get rid of the snap docker version. Even after reboot and cleaning the snapd/state.json activity related to previous attempts to remove docker.
snap changes
yields
docker 28.4.0 3377 latest/stable canonical✓ disabled
sudo systemctl status docker
yields
Unit docker.service could not be found.
docker.socket is also not running.
Edit#2 @Rinzwind. As expected dpkg found nothing and most of the directories were empty. However, I did purge /var/lib/containerd and .docker
The zombie remove processes did not awake, so I tried rebooting and remove again. I had to clean the json state again, but no luck afterwards.
Is there a more manual (drastic) way to remove snap app from the system? I just need the snap version gone because I'd rather not blow up my system just to get rid of a snap app, but I need docker. I'm really surprised this is so hard because I thought the whole point of snap apps was that they were containerized and "easy to remove". ha.
Any suggestions?