0

So, my computer was running low on memory (dual-booting does that, especially if your laptop didn't have that much memory to start off with), so I went looking for stuff to delete. I was surprised to find the folder /var/lib/snapd/snaps had 1.4GB of files in it, given that I really only use snap as my package manager when apt doesn't have the programs/libraries I want.

When I opened it up, this is what I found:

-rw------- 1 root root 102637568 Jan  6 16:20 core_10583.snap
-rw------- 1 root root  58052608 Oct 27 17:40 core18_1932.snap
-rw------- 1 root root  58073088 Dec 17 10:46 core18_1944.snap
-rw------- 2 root root  62349312 Dec  6 19:48 discord_119.snap
-rw------- 1 root root  62349312 Jan  3 15:32 discord_120.snap
-rw------- 1 root root 169254912 Jun  7  2020 gnome-3-28-1804_128.snap
-rw------- 1 root root 170778624 Oct 11 17:33 gnome-3-28-1804_145.snap
-rw------- 1 root root 228478976 Oct  2 01:21 gnome-3-34-1804_60.snap
-rw------- 1 root root 229629952 Jan 10 01:35 gnome-3-34-1804_66.snap
-rw------- 1 root root  67477504 Nov 25 12:31 gtk-common-themes_1513.snap
-rw------- 1 root root  67915776 Nov 28 00:34 gtk-common-themes_1514.snap
drwxr-xr-x 2 root root      4096 Apr 11  2020 partial
-rw------- 1 root root  32571392 Dec  5 18:33 snapd_10492.snap
-rw------- 1 root root  32600064 Jan  6 16:20 snapd_10707.snap
-rw------- 1 root root  53501952 Nov 25 19:32 snap-store_498.snap
-rw------- 1 root root  53522432 Dec 19 16:35 snap-store_518.snap

As you can see, there are two copies of everything - it looks like snap failed to delete the previous version while installing the new version, which probably explains why the folder ended up gobbling so much memory. I'm tempted to just delete all the old files, but I figured it was best to check this isn't just part of how snap works and those duplicate files aren't important somehow. And if this is somehow a design feature, I'd be very curious what benefits are gained by literally doubling the amount of memory that gets used up.

1
  • 1
    Snaps are designed to automatically fallback to the older version in the occasional event that the newer is corrupted or unusable. It avoids whole classes of apt errors, and avoids bricking devices like phones and appliances. It's possible that you don't need BOTH Gnome 3.28 and 3.34.
    – user535733
    Jan 21, 2021 at 16:23

1 Answer 1

2

When updating, snap keeps a previous version around. So it is normal you find two instances of a specific snap.

By design, you unfortunately cannot set snap to not retain a previous version. You can retain more version if you wish by changing a refresh-retain option.

You can always remove a specific snap version with a command, but to automatically remove the backup copies of all snaps, you could use a script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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