Cannot delete snapd directory

I have recently tried to completely remove snap however I have a /var/lib/snapd directory left. I cannot rm -rf this directory (it gives me permission issues even while running it as root! says its read only?). Snapd is uninstalled and I need to clear this directory… how can I delete it?

  • Un-mounts any active snap mounted to /var/lib/snapd/snap/.

sudo umount $(mount | grep snap | awk ‘{print $3}’)

  • Remove the state directory and mount hook.

sudo rm -rvf /var/lib/snapd
sudo rm -rvf /var/snap

  • Remove any unit files that try to mount snaps from /var/lib/snapd/snaps to /var/lib/snapd/snap at boot

sudo find /etc/systemd/system -name “snap-.mount” -delete
sudo find /etc/systemd/system -name “snap.*.service” -delete

1 Like

Spent too many hours trying to figure that out, your answer worked perfectly. Thank you!

sudo apt purge snapd

should actually remove that dir and all traces of snaps on your system …

1 Like

I guess I should have asked how @inseighn installed the snap package… where I use Arch Linux I usually use the manual build process as opposed to the AUR or package manager and not to mention I wouldn’t have been able to re-create the issue since I don’t have any Debian/Ubuntu based distro’s on my machine… So I gave what I thought should work.
Obviously your solution makes more sense’ if he installed snap using apt-get..:wink:

It was actually on CentOS! But your solution worked.

1 Like