/var/lib/snapd/seed/snaps vs /var/lib/snapd/sn

Can someone tell me the difference between things stored in /var/lib/snapd/seed/snaps and /var/lib/snapd/snaps? On a ubuntu-18 system I have a large google-cloud-sdk_161.snap in snapd/seed/snaps, and then two more recent ones in snapd/snaps. The one in snapd/seed/snaps does not show up in snap list --all. I’m wondering if it’s safe to delete the one in snapd/seed/snaps.

seed dirs usually contain pre-installed packages … if your install had google-cloud-sdk pre-seeded, the original version will live and stay in that seed dir … any updates of the snap will go to the general update place in /var/lib/snapd/snaps

seed dirs usually contain pre-installed packages … if your install had google-cloud-sdk pre-seeded, the original version will live and stay in that seed dir … any updates of the snap will go to the general update place in /var/lib/snapd/snaps

Ok. So if there are higher-numbered snaps in snapd/snaps, then it should be safe to delete the one in seed/snaps?

no, like you should never ever “just delete” files that were delivered with a deb or rpm package, you should also not pull out files underneath the snap package management … you can try to use snap remove --revision= ... but i’m not sure this is possible for a pre-seeded snap.

you can also set the refresh.retain system option to limit the number of kept snaps to two instead of three, see:

no, like you should never ever “just delete” files that were delivered with a deb or rpm package, you should also not pull out files underneath the snap package management … you can try to use snap remove --revision= ... but i’m not sure this is possible for a pre-seeded snap.

That’s why I was asking:

sudo snap remove --revision=161 google-cloud-sdk
snap "google-cloud-sdk" is not installed

There are similar old versions for other things which have two more recent versions installed, including snapd. If I can’t remove them safely, and the minimum number to keep is 2, that means the minimum number you are keeping is actually 3.

Yes it is indeed the case that you can’t remove seed snaps, but not all systems have seeded snaps in them.

Thanks.
I’m sure I can remove them… but I believe you in that it wouldn’t be smart.
Can you give me a feel for the consequences of removing

  1. /var/lib/snapd/seed/snaps/google-cloud-sdk_161.snap
  2. The older of the two snaps in /var/lib/snapd/snaps for the above
  3. The same two questions for the snapd_xxxxx.snap files
    Just trying to understand how things work. I’m asking because I’m guessing that the initial install of snapd and google-cloud-sdk had a seed, and then the installed (subsequent) snap. In that case we were running with a seed and only one other snap, and the third one would only show up quite a while later when things got updated. In that case in seems like it’s not a big issue, other than being able to roll-back. For something like snapd or google-cloud-sdk, which one could presumably download if missing, it doesn’t seem like a big deal to not be able to roll-back.

Also, does refresh.retain include the snap in /var/lib/snapd/seed/snaps, or only the ones in /var/lib/snapd/snaps?

Well, it likely would not have much impact today to you, but it may break future features in snapd surrounding resetting a system or restoring, etc. but if you don’t use this snap then it’s probably fine to remove it with the caveat that you may be breaking things down the line. I would strongly recommend against deleting these files anyway.

You should remove these specifically with snap remove <name> --revision=..., do not remove them directly by rm’ing those files, you will make snapd confused and things may stop working randomly for you. You can remove any revision that is not currently active (inactive revisions will be listed as “disabled” in snap list <name> --all

snapd snap is the same as the other snaps in this respect, you can remove old revisions with --revision.

As you have found, the refresh.retain does not include the snaps in /var/lib/snapd/seed/snaps, which will always be available unless you manually go and delete those files (which will make you subject to breakage as discussed above).

Thanks for the clarifications.

To delete seed snaps you would have to stop snap seed service first, remove seed entries in seed configuration, delete seed snaps and start seed service. Optionally you can disable snap seeding completely.

sudo service snapd.seeded status
sudo service snapd.seeded stop
sudo vi /var/lib/snapd/seed/seed.yaml (remove all entries, but leave snaps: header)
sudo rm /var/lib/snapd/seed/snaps/*.snap (remove entries associated seed snaps)
sudo service snapd.seeded start
sudo service snapd.seeded status
sudo service snapd.seeded stop
sudo service snapd.seeded status
[optional] sudo systemctl disable snapd.seeded.service