Error validating license on install

I published a snap with the field license: Apache 2. Publishing worked fine and there was no linting issue (I have the review-tools installed) but when installing it failed with:

error: cannot perform the following tasks:
- Mount snap "erlang" (14) (cannot validate license "Apache 2": unknown license: Apache)

I removed the license field from snapcraft.yaml and republished and it worked fine to install.

If the license metadata should cause it to fail to install it should likely fail publishing or at least the linting, right? Not sure if this is an issue with the installer or the publisher.

Can you show the generated snap.yaml in the snap at meta/snap.yaml ? It’s possible that snapd (which is what is complaining in your error message) needs to be updated with the licenses or that there’s a bug in validating the licenses set in snapcraft.yaml (which would be a bug in snapcraft)

The store doesn’t really look at the license: field in the snap.yaml file, which is why this was missed by the store-side license checks. Apparently, neither snapcraft at build time nor the review tools at upload/scan time look at licensing information within the snap (probably because of all the open questions remaining about how to express and scope licensing information on a snap).

So the snap’s license expression in the snap.yaml file is not really validated server-side, the snap with a bad license trickles down to snapd, which does validate and barfs as seen here.

The problem here is that “Apache 2” is not a valid SPDX 2.0 expression. You should be able to update your license: field to:

license: Apache-2.0

then rebuild the snap, and this should make snapd happy.

I’ll use this to try to reproduce the issue and file a bug since a snap with a bogus license should totally be detected/stopped by either snapcraft or the store.

  • Daniel
2 Likes

Thanks @roadmr, were you able to reproduce or do you need anything more from me?

Sorry for not posting back here - I did repro the problem, https://bugs.launchpad.net/snapstore/+bug/1862242 is the bug I filed.

Cheers,

  • Daniel
1 Like