Snaps installed via model assertion have 'channel' empty until after refresh


This is to validate if the observed behavior is correct and if not highlight an issue.

Using the snapd API, it has been noticed that a snap installed via model assertion has the channel field empty while at the same time having the trackingChannel set correctly.

      "name": "foo",
      "channel": "",
      "status": "active",
      "version": "1.0.0",
      "revision": "30",
      "devmode": false,
      "confinement": "strict",
      "trackingChannel": "candidate"

On a snap that has been refreshed or has had it’s channel changed the channel field in not empty.

      "name": "foo",
      "channel": "candidate",
      "status": "active",
      "version": "1.0.2",
      "revision": "11",
      "devmode": false,
      "confinement": "strict",
      "trackingChannel": "candidate"

In general a state where channel is "" can happen even for a snap coming from the store.

For example a developer installing her own snap using snap install ---channel=TRACKING --revision=# foo will provoke such a state, a revision can be in many channels so there is no clear value for channel in this case.

So a consumer of the API needs to be prepared for that kind of state. tracking-channel indicates what channel will be used by refreshes, channel just traces where the snap revision came from if applicable.

In the case of seeding though we could set the value to be the same as tracking-channel, if channel is set in seed.yaml.

Thanks for answer, I still have questions, comments though:

I understand this that I can install a snap choosing an explicit revision rather than a tip of a particular channel. Then you write:

This is whee I have doubts. The revision selected to install surely must have came from one of the channels. After the installation this should be a known value which leads me to believe that this field shall be filled in. Is there anything that prevents it at the post installation step?


a revision can be in many channels at the same time, or in no channel atm, there’s no unique value to set channel to in general in this case.

Okey, sounds reasonable. Could you though explain what do you mean by “no channel”?

a developer can install a revision with --revision even before is released to a channel.

This makes sense now, thanks. I have not been aware that it is possible to install a snap that is not released to any channel.

Is that applicable for revisions that have been overwritten by newer uploads only or I could install a snap that has been uploaded but not yet released to any channel at all?

It works only for somebody with developer (upload) access to the snap, but for them they can specify any revision. If that doesn’t work it’s a bug.

Got it, thanks for all of the explanations.

I might have knots in my brain here, but how would you install a store snap that isnt at least in the edge channel ? (i do understand that using --revision and --dangerous for installing a local snap will not have any channel, but as soon as you upload to the store there is at least an “edge” version, isnt there ?)

no, although build, LP and some snapcraft mode of operation combine the two, uploading and releasing are distinct steps (also because of review potentially blocking things)

1 Like

ah, thanks, that unties the knot :slight_smile: