How do snap packages handle shared dependencies?

The first two situations are handled in a clever way.

One of the interesting features talked about is deduplication support for content within Snap packages. Snaps would be automatically deduplicated of common files shared between snaps based upon their file hashes. There would be de-duplication on the file-system layer, de-duplication on snap downloads (with server support), and perhaps de-duplication of mapped libraries from the linker. Deduplication is a big work item and likely will take a while to implement fully, but it's an interesting goal nevertheless.

Source: http://www.phoronix.com/scan.php?page=news_item&px=Ubuntu-Snappy-Deduplication

As for the third situation, they have something similar to the runtimes that you mentioned:

There are three layers that make up a snappy machine: the system layer, provided by Canonical, a layer of frameworks that extend the base system produced by vendors in collaboration with Canonical, and a set of snappy applications, provided directly by vendors. Updating any piece just means using the new version of a read-only image. Reverting to a previous version is just as easy.

Source: http://www.ubuntu.com/cloud/snappy

There is no good documentation describing frameworks yet, primarily because they seem to still be working out the boundaries of what a framework is. Here is an excerpt from their mailing list that might help clarify things.

I am experimenting with Frameworks to essentially extend the Snappy base system by software and services which lots of snaps require but should not be included in any and each snap due to update issues and size. The best example i have for this, is the openssl binary. Many snaps need this to generate and validate keys and certificates.

The other issue i tied to solve with a framework is the access to system wide resources, mote notably ports. Eg, a web server framework would provide ways for other snapps to inject their web service api and end points via reverse proxy into the framework running the web server.

I was told on IRC that i am kind of abusing the framework concept, but still these two issues come up on my desk often.

Source: https://lists.ubuntu.com/archives/snappy-app-devel/2015-November/000442.html


I don't think that snaps check what dependencies are already installed. It just includes all of its dependencies and runtime (which is partly why the LibreOffice snap is 287 MB and the flatpak is about 200MB).

Snaps include pretty much everything the software needs to run. I don't think anything gets shared between snaps.

When a snap updates however, it will only download the dependencies that are new, and not the entire snap.


Additional clarification is in order about the way snap packaging handles shared dependencies.

Snaps include pretty much everything the software needs to run. I don't think anything gets shared between snaps.

This statement in one of the answers is partially true, however all installed snap packages except for the core snap depend on two packages, one of which is the core snap.

  1. snapd - which is installed by default in 16.04 and later

  2. core   - (the core snap) which is automatically downloaded and installed when the first installed snap package is installed

All snap packages except for core itself depend on the core snap. If there is anything wrong with the core snap, then some or all of the other snaps won't work. A problem with the core snap can be fixed in the following two ways.

  1. Update the core snap. Even if this doesn't work, the results of running the following command will provide additional information that will help solve the problem.

    sudo snap refresh core  
    
  2. Uninstall the core snap and all snap packages and then reinstall them.

    sudo snap remove core snap-package1 snap-package2  
    sudo snap install core snap-package1 snap-package2