zerkms
February 7, 2024, 8:56pm
1
I’m running ubuntu 20.04 and recently discovered that /var/lib/snapd/snaps/
contains a lot of quite old snaps that I expect to be cleaned up.
For instance skype:
# ls -la /var/lib/snapd/snaps/skype_*
-rw------- 1 root root 146771968 Apr 19 2023 /var/lib/snapd/snaps/skype_266.snap
-rw------- 1 root root 146771968 Apr 24 2023 /var/lib/snapd/snaps/skype_267.snap
-rw------- 1 root root 147140608 Apr 25 2023 /var/lib/snapd/snaps/skype_269.snap
-rw------- 1 root root 147746816 May 24 2023 /var/lib/snapd/snaps/skype_274.snap
-rw------- 1 root root 148983808 Jun 16 2023 /var/lib/snapd/snaps/skype_280.snap
-rw------- 1 root root 189390848 Aug 17 12:56 /var/lib/snapd/snaps/skype_291.snap
-rw------- 1 root root 183963648 Oct 2 20:54 /var/lib/snapd/snaps/skype_301.snap
-rw------- 1 root root 183963648 Oct 6 22:56 /var/lib/snapd/snaps/skype_302.snap
-rw------- 1 root root 184414208 Nov 1 20:45 /var/lib/snapd/snaps/skype_306.snap
-rw------- 1 root root 184659968 Dec 5 23:00 /var/lib/snapd/snaps/skype_314.snap
-rw------- 1 root root 185167872 Dec 8 18:47 /var/lib/snapd/snaps/skype_317.snap
-rw------- 1 root root 185163776 Dec 11 22:19 /var/lib/snapd/snaps/skype_318.snap
-rw------- 1 root root 185167872 Dec 14 11:36 /var/lib/snapd/snaps/skype_320.snap
-rw------- 1 root root 185294848 Jan 23 22:58 /var/lib/snapd/snaps/skype_323.snap
-rw------- 1 root root 187752448 Jan 31 19:28 /var/lib/snapd/snaps/skype_325.snap
-rw------- 1 root root 187752448 Feb 5 16:23 /var/lib/snapd/snaps/skype_326.snap
yet only 2 versions are actually installed:
# snap list --all|grep -i skype
skype 8.111.0.607 323 latest/stable skype** -
skype 8.110.0.218 320 latest/stable skype** disabled
But even here there is some oddity - see that the installed are 320 and 323, but also 325 and 326 are in the snaps :shrug:
I wouldn’t bother otherwise, but currently /var/lib/snapd/snaps/
already takes 15Gb and over the time it will only grow more.
This machine is rebooted regularly (usually every kernel release, so at least once or twice a month), so it definitely is not that some cleanup routine that didn’t have chance to trigger the actual cleanup.
Am I doing something wrong and should I somehow clean it up manually? Or is it some well known bug, which I honestly couldn’t find.
PS: this question is the exact copy from my original post at askubuntu.com
1 Like
mrk
February 7, 2024, 9:35pm
2
this thread may be of interest to you
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…
Not sure if there is any official bug report of this yet
1 Like
Hi @zerkms .
To remove the unnecessary data, I recommend you to follow this guide https://snapcraft.io/docs/snapshots .
zerkms
February 7, 2024, 10:05pm
5
I don’t have any snapshots created:
➜ snap saved
No snapshots found.
zerkms
February 7, 2024, 10:08pm
6
@mrk @ogra as there is no known bug report created and I couldn’t find any myself - here I created new: Bug #2052666 “/var/lib/snapd/snaps/ is not cleaned up” : Bugs : snapd
2 Likes
@zerkms , precede the above command by sudo to see .
zerkms
February 7, 2024, 10:31pm
8
I did check it with sudo initially too, sorry I didn’t mention it:
➜ sudo snap saved
No snapshots found.
And there is only one user (me) on this laptop.
zerkms:
I’m running ubuntu 20.04 and recently discovered that /var/lib/snapd/snaps/
contains a lot of quite old snaps that I expect to be cleaned up.
For instance skype:
# ls -la /var/lib/snapd/snaps/skype_*
-rw------- 1 root root 146771968 Apr 19 2023 /var/lib/snapd/snaps/skype_266.snap
-rw------- 1 root root 146771968 Apr 24 2023 /var/lib/snapd/snaps/skype_267.snap
-rw------- 1 root root 147140608 Apr 25 2023 /var/lib/snapd/snaps/skype_269.snap
-rw------- 1 root root 147746816 May 24 2023 /var/lib/snapd/snaps/skype_274.snap
-rw------- 1 root root 148983808 Jun 16 2023 /var/lib/snapd/snaps/skype_280.snap
-rw------- 1 root root 189390848 Aug 17 12:56 /var/lib/snapd/snaps/skype_291.snap
-rw------- 1 root root 183963648 Oct 2 20:54 /var/lib/snapd/snaps/skype_301.snap
-rw------- 1 root root 183963648 Oct 6 22:56 /var/lib/snapd/snaps/skype_302.snap
-rw------- 1 root root 184414208 Nov 1 20:45 /var/lib/snapd/snaps/skype_306.snap
-rw------- 1 root root 184659968 Dec 5 23:00 /var/lib/snapd/snaps/skype_314.snap
-rw------- 1 root root 185167872 Dec 8 18:47 /var/lib/snapd/snaps/skype_317.snap
-rw------- 1 root root 185163776 Dec 11 22:19 /var/lib/snapd/snaps/skype_318.snap
-rw------- 1 root root 185167872 Dec 14 11:36 /var/lib/snapd/snaps/skype_320.snap
-rw------- 1 root root 185294848 Jan 23 22:58 /var/lib/snapd/snaps/skype_323.snap
-rw------- 1 root root 187752448 Jan 31 19:28 /var/lib/snapd/snaps/skype_325.snap
-rw------- 1 root root 187752448 Feb 5 16:23 /var/lib/snapd/snaps/skype_326.snap
yet only 2 versions are actually installed:
# snap list --all|grep -i skype
skype 8.111.0.607 323 latest/stable skype** -
skype 8.110.0.218 320 latest/stable skype** disabled
But even here there is some oddity - see that the installed are 320 and 323, but also 325 and 326 are in the snaps :shrug:
I wouldn’t bother otherwise, but currently /var/lib/snapd/snaps/
already takes 15Gb and over the time it will only grow more.
This machine is rebooted regularly (usually every kernel release, so at least once or twice a month), so it definitely is not that some cleanup routine that didn’t have chance to trigger the actual cleanup.
Am I doing something wrong and should I somehow clean it up manually? Or is it some well known bug, which I honestly couldn’t find.
PS: this question is the exact copy from my original post at askubuntu.com
According the output of the command ls -la /var/lib/snapd/snaps/skype_ *, the root have the right to write on thes files. Normally, you can remove them if you are a super user .
zerkms
February 7, 2024, 11:07pm
10
Well, yes and no
I expect software to maintain its own storage.
And it’s not immediately obvious if messing with filesystem structure would not corrupt some snapd index (as I’m not aware how exactly snapd manages those directories and handles their absence). So in general I expect to NOT remove anything by myself unless I know it’s 100% safe
1 Like
If you execute the same command with in more -t option, the output will be in order from newest to oldest .
Like :
ls -atl *.snap
Otherwise, you can remove the skype snap, then remove the files in questions.
You can then install skype again .