Shared library versions to reduce snap size?

I know that snaps being massive (one of the criticisms of snappy well expressed here; compared to Debs or RPMs) is an accepted part of the nature of how snaps work - bundling dependencies so that they work on any release of any Linux distribution, and also that they store three copies so that new versions can be quickly rolled back if necessary. I also accept that storing snaps as compressed filesystems helps mitigate this issue, as does the use of deltas, and the use of content snaps as appropriate (for GNOME and KDE snaps). Could snapd go even further though? The Nix package manager seems to (I haven’t installed it before so this is rudimentary understanding) work on the basis of installing individual libraries but letting different versions run side-by-side. Could the dependencies in snappy work in a similar way, where the same library versions across different snaps could be shared? This would not be getting back into the old dependency hell of forcing different applications share the same dependency versions!

I recognize that this is something of a pie-in-the-sky post and am reminded that the installed size of snaps is tiny compared to Debs so actually this may not be that much of an issue.

The premise of snaps being massive is false. You can ship larger snaps, and there is no policy in the store that blocks you from doing that, which means you will indeed find larger snaps, but as we just discussed there are other factors that need to be taken into account.

The example of 0ad-data is a clear one in that regard. When you install just the data deb package alone you have more disk space used (1.5GB) than with the entire snap with code and dependencies (850MB) due to compression. Then the use of deltas on every refresh also reduces the impact during downloads

Finally, the actual sharing of library versions already exists via the content interface. In fact, not just libraries but data is shared too. The gnome-platform snap is one example of that.

1 Like

I was meaning a more granular sharing of library versions than the content snap which provides a set of libraries as a block in a fashion which really only certain apps (e.g. GNOME apps for the GNOME content snap, or KDE apps for the KDE content snap) can use.

The motivation of sharing is larger when you have a larger block, but the files you share (libraries or otherwise) can be as large or as small as you want already.

So dependencies could, in theory, be made share-able if every stage-package was converted into an individual content snap…