0

On my VM a significant space of space is eaten by /var/lib/snapd/snaps/

-rw------- 1 root root      4096 mar 16  2023 bare_5.snap
-rw------- 1 root root  66547712 sie 23 19:41 core20_2015.snap
-rw------- 1 root root  67014656 sty 15 18:15 core20_2105.snap
-rw------- 1 root root  77713408 sty 15 18:15 core22_1033.snap
-rw------- 1 root root  77492224 sie 30 00:33 core22_864.snap
-rw------- 1 root root 366682112 sie 23 19:42 gnome-3-38-2004_143.snap
-rw------- 1 root root 509100032 sie 23 04:31 gnome-42-2204_126.snap
-rw------- 1 root root 521121792 sty 15 18:16 gnome-42-2204_141.snap
-rw------- 1 root root  96141312 mar 16  2023 gtk-common-themes_1535.snap
drwxr-xr-x 2 root root      4096 gru  1  2022 partial
-rw------- 1 root root  42827776 wrz 19 07:38 snapd_20092.snap
-rw------- 1 root root  42393600 sty 15 18:15 snapd_20671.snap
-rw------- 1 root root  12922880 maj 25  2023 snap-store_959.snap

A lot of that looks like duplicates (core20_2015 and core20_2105 and core22_1033 and core22_864)

snap help snap help --all snap help --all|grep temp snap help --all|grep clean failed to reveal solution.

Is there some proper way to remove this apparent duplicates?

Sadly, in this case getting rid of snaps entirely is not viable as VM is supposed to mirror production (and there more important things need to be done than purging snap infestation).

snap --version
snap    2.61.1
snapd   2.61.1
series  16
ubuntu  20.04
kernel  5.15.0-84-generic

1 Answers1

2

snapd is keeping by default two (2) versions of each snap, the current one and the previous one. This can not be reduced, two is the minimum (but it can be increased if required).

core20_xxx and core22_xxx are not duplicates, but two different core systems. snaps can be build against both core version, that's within the decision of the provider of the snap. It is only safe to remove one of the core version if you are sure that no installed snap relies on this core version.

snaps should never be deleted manually but always using the snap command line interface using sudo snap remove name_of_the_snap.

Ubuntu as an operating system does not rely on snaps, at least not the releases which are supported as per today (20.04 LTS, 22.04 LTS, 23.10). So you could remove all snaps using the above command and then remove the snapd package running sudo apt purge snapd

noisefloor
  • 1,086