donny
March 19, 2024, 11:11am
1
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
?
Aminda
March 19, 2024, 11:17am
3
I think this is a feature request.
In flatpak I can type `flatpak uninstall --unused` and in apt I can type `sudo apt autoremove` to remove unused packages.
There is no similar command in snap, only little scripts people make to do the same job, that break when snap's columns change...
donny
March 19, 2024, 11:21am
4
It’s under /var/lib/snapd/snaps
ogra
March 19, 2024, 11:31am
5
Looks related to:
I’ve been struggling with a full hard drive for a few years; blaming my use of nodejs/git etc.
I’ve set refresh.retain to 2 and manually copied and checked a script from https://www.linuxuprising.com/2019/04/how-to-remove-old-snap-versions-to-free.html so that I can run it when my filesystem is full.
Finally I’ve figured out today that /var/lib/snapd/snaps still holds many older versions of downloaded snaps. I run du -h -x --max-depth=6 -t 1100000000 regularly and write it’s output to a timest…
Which is indeed a snap related bug, each snap should always only retain two versions on desktops…
1 Like
alan_g
March 19, 2024, 12:03pm
6
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” .snap
s and not seen ill effects.
ogra
March 19, 2024, 12:19pm
8
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
EDIT: and we apparently already have fixed in edge
donny
March 19, 2024, 12:44pm
9
I guess i will just delete those redundant snaps.
Glad to know that this issue will be fixed soon.
Thank you guys!
ogra
March 19, 2024, 12:47pm
10
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
Bestia
March 20, 2024, 9:08pm
11
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.
ogra
March 20, 2024, 10:25pm
12
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.