When I install a snap with snap install <SNAPNAME> then it is being downloaded and mounted. When I remove it with snap remove <SNAPNAME> then 'everything' is being deleted like the snap, user settings dependecies and so on. But when I re-install the snap after removing it, it has no download time so the snap must be stored somewhere.

How can I clear the cache of snapd with all uninstalled snaps?

  • They are kept in /var/lib/snapd/cache though not with snap names. You may be able to make an educated guess thru the properties of the file, i.e size and date created. Otherwise you's need to have folder open when installing a snap, see what file is created & note it's name or partial name & size in a file elsewhere for future use..
    – doug
    Sep 13, 2018 at 21:40
  • 1
    @doug That's true, I could observe that the hardlink-count changes for a certain file when installing and removing a snap repeatedly. Installing creates a hardlink in /var/lib/snad/snaps to one of the files in /var/lib/snapd/cache, same inode. Removing the file in /var/lib/snapd/cache results in a fresh download when attempting to install again.
    – mook765
    Sep 13, 2018 at 23:26

3 Answers 3


You can remove the files in /var/lib/snapd/cache without issue. Also there is no need to stop snapd before.

This was answered in Snapcraft forum:

The answers boil down to: you should not have a lot of files with hardlink count 1; at most 5 in the default install. If you have more than that, it’s a bug, please let us know.

And yes you can remove them without issue; no need to stop snapd.

Here the command to do that:

sudo sh -c 'rm -rf /var/lib/snapd/cache/*'
  • 6
    I had to first enter sudo mode completely with sudo -i only then it worked, this simple command sudo didn't work and it was saying that there is "no such file or a directory" even though sudo ls /var/lib/snapd/cache/ showed files ... you can exit the total sudo mode with logout :)
    – jave.web
    Mar 13, 2021 at 11:06
  • Same for me. That's why I did not add the command to do it. That was someone else.
    – neun24
    Mar 14, 2021 at 17:27
  • @neun24 Fixed the sudo call, hope you can approve ;)
    – Tino
    Apr 9, 2021 at 8:20
  • The real fix is now applied.
    – dolmen
    Feb 19 at 17:40
  • 2
    sudo find /var/lib/snapd/cache/ -exec rm -v {} \;
    – wesinat0r
    May 11 at 20:37

Also note that snap does not only keep removed snaps, but also up to 20 older versions of that snap (standard is 3 versions). So for me, cleaning up those remaining copies resulted in far more reclaimed storage than cleaning the cache (5GB vs 1GB). This website has a nice script which I used for that:

#Removes old revisions of snaps
set -eu
LANG=en_US.UTF-8 snap list --all | awk '/disabled/{print $1, $3}' |
    while read snapname revision; do
        snap remove "$snapname" --revision="$revision"

You can also simply do:

sudo snap remove --purge $PACKAGE
  • 2
    This removes the settings, which isn't useful when you're migrating from a snap package to a native package. Jun 22, 2021 at 7:14
  • Doesn't work for uninstalled packages.
    – jave.web
    Jan 20 at 10:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.