unable to remove old versions of apps

I found that i have 14 firefox versions on my disk taking up 4.2GB. There are more than 2 versions for core, code and chrome too.

I used sudo snap list firefox --all but it only listed two versions for firefox. snap firefox firefoxes on disk

I tried sudo snap set system refresh.retain=2 but that doesn’t clean up existing versions.

How should i remove those old firefox versions?

If i use for example sudo snap remove firefox --revision 3799, it would complain revision 3799 of snap "firefox" is not installed.

Also I noticed that snap is not detecting those newer versions (39**) as well.

Is this a bug in snap?

1 Like

Can you clarify where you found those versions if they aren’t listed in snap list --all ?

I think this is a feature request.

It’s under /var/lib/snapd/snaps

Looks related to:

Which is indeed a snap related bug, each snap should always only retain two versions on desktops…

1 Like

I can confirm snapd is “losing track”:

$ ls /var/lib/snapd/snaps -1 | sed "s/_[0-9]*\.snap//" | uniq -c | sort -r | head
      3 telegram-desktop
      3 miriway
      3 mattermost-desktop
      3 element-desktop
      2 zoom-client
      2 wpe-webkit-mir-kiosk
      2 wayland-debug
      2 vlc
      2 umlet-standalone
      2 ubuntu-frame-vnc_edge
$ snap list --all | cut -d\  -f 1 | uniq -c | sort -r | head
      2 zoom-client
      2 wpe-webkit-mir-kiosk
      2 wayland-debug
      2 vlc
      2 umlet-standalone
      2 ubuntu-frame-vnc_edge
      2 ubuntu-frame-vnc_beta
      2 ubuntu-frame-vnc
      2 ubuntu-frame_stable
      2 ubuntu-frame-osk_stable

I’m of the opinion (because of the affected snaps) that this is when several versions are downloaded before I close an app that doesn’t refresh because it is running.

FWIW I’ve deleted the “forgotten” .snaps and not seen ill effects.

This appears to be a known issue, see Bug #2033268 “Leaks snaps in r-a-a mode” : Bugs : snapd and Bug #2052666 “/var/lib/snapd/snaps/ is not cleaned up” : Bugs : snapd which should be fixed in 2.62.

1 Like

Yeah, if it is just stale downloads that have been replaced by newer versions already anyway, deleting anything that’s not actually currently mounted should be a safe bet … still a bug we should fix indeed :slight_smile:

EDIT: and we apparently already have fixed in edge :slight_smile:

I guess i will just delete those redundant snaps. Glad to know that this issue will be fixed soon. Thank you guys!

just check if they are mounted before removing them … don’t rm a file if it is actively mounted, that might cause chaos …

1 Like

And will those changes also apply to content snaps?

I currently have: kf5-5-106-qt-5-15-9-core22 kf5-5-108-qt-5-15-10-core22 kf5-5-110-qt-5-15-11-core22

As you can imagine only the newest one is actually used by a snap package. Kolourpaint in this case. And every single one of those is above 400 MB.

I’ve been removing them manually but that’s definetly not how it should work.

Removal of unused content snaps is a different issue and (snapd team may correct me) IIRC on the roadmap already but that will first need some architectural design as i understand…

Hi @donny, Bug #2033268 “Leaks snaps in r-a-a mode” : Bugs : snapd is fixed in snapd 2.62 which is available in beta channel. Any test feedback would be appreciated.