Refreshing snaps in --devmode

Hey,

There is a little bit of confusion how refreshing a snap into devmode works and some clarifications are needed to validate if the observed behavior is correct or not.

I have a snap that has same revisions being promoted to same but not all channels. Like for example bluez at the moment:

 bluez | stable    | 5.44-3     | 124 | armhf
 bluez | candidate | 5.44-3     | 124 | armhf
 bluez | beta      | 5.44-3     | 124 | armhf
 bluez | edge      | 5.47-1-dev | 146 | armhf

Now, bluez from stable is installed and somebody would like to refresh it into the --devmode. This is not possible because snapd says:

$ snap install bluez
bluez 5.44-3 from 'canonical' installed
$ snap refresh bluez --devmode
snap "bluez" has no updates available

The expectation was that it will be refreshed.

Switching to another channel, that hosts the exact same revision, does not work either as the snapd just acknowledges the channel change but nothing more than that.

$ snap refresh bluez --beta --devmode
bluez (beta) 5.44-3 from 'canonical' refreshed
$ snap info bluez
(...)
tracking:  beta
refreshed: 2017-09-13T18:27:54Z
installed:   5.44-3     (124) 3MB -

The desired change is possible to achieve only when refreshing to a channel that hosts other revision than currently installed. For bluez this would be --edge.

$ snap refresh bluez --devmode --edge
bluez (edge) 5.47-1-dev from 'canonical' refreshed
$ snap info bluez
(...)
tracking:  edge
refreshed: 2017-09-21T20:11:46Z
installed:   5.47-1-dev (146) 4MB devmode

Could you clarify if this is a desired behavior?

Thanks

1 Like

I’m guessing this is related to this topic (also with no replies)? :slight_smile:

Hey @koza,

I believe there are two things that may be the source of your confusion here. I hope I did not misunderstand your original question.

One is how channels work: if the channel is not explicitly changed, snapd will always refresh in the same channel that the snap was installed from. So if you installed from stable, refreshing will only get updates from stable unless you specify a different channel with --channel.

Then, there is the devmode flag. The switch “–devmode”, for when installing or refreshing a snap, puts the snap in development mode and disables security confinement, but the revision is the exact one released to the channel being installed from. In your case, the stable channel, so it will always be revision 124.

In summary, if you need a bluez revision other than the one you have just installed, you either need to change to the channel that has it, or install it by revision with --revision (this will only work if you are the publisher or a collaborator of that snap, though).

I hope this answers your question.
Natalia.

I don’t think you’ve answered the question being asked, but I may be wrong.

As I understand it the issue (which I also have) is summarised as “You cannot refresh a snap from non-devmode to devmode without changing revision or removing the snap”.

i.e. if you have revision 1 of your snap in stable,candidate,beta and edge, and you only want to switch from strict to devmode for testing, it’s not possible to do that with just a refresh. You have to remove the snap (losing data) or upload a new revision and switch to that.

It looks like OP was trying to work around this odd behviour by trying to “force refresh (and switch to devmode)” by switching channel. This doesn’t work because the two channels hold the same revision.

Hey @natalia, thank you for your answer. Although there is a bit of misunderstanding and in fact I’m asking for how @popey understood it in his note below yours. Let me quote him:

As I understand it the issue (which I also have) is summarised as “You cannot refresh a snap from non-devmode to devmode without changing revision or removing the snap”.

i.e. if you have revision 1 of your snap in stable,candidate,beta and edge, and you only want to switch from strict to devmode for testing, it’s not possible to do that with just a refresh. You have to remove the snap (losing data) or upload a new revision and switch to that.

Hope this is clear now, Thanks.

I don’t recall, offhand, why switch doesn’t have a --devmode (nor other confinement-related flags). It seems like the natural place to add this.

I’ll ask around :slight_smile: