Channel switching (track new channel) does not work if the two channels happen to have identical snap packages
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
snapd |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
It's not possible today to redirect a snap's channel without there being an actual update available. If I run the following command on a UC16 system that I'd installed network-manager on from candidate or edge, if there's not a newer revision available in the stable channel, the following command will output an error, and not update the network-manager snap so that the next refresh would be done from stable. Perhaps a --force argument would suffice?
$ snap refresh --stable network-manager
We have a use case for this in commercial engineering where a system image was built using candidate, and we were able to partially update it to point stable for all the snaps with available updates. For the few snaps that didn't, we resorted to in-place rebuilds with a version bump.
I'm running the latest core snap, containing snap 2.18.1.
It's a bug. Let's see more.
$ snap info network-manager
name: network-manager
summary: "Network management based on NeworkManager"
publisher: canonical
description: |
Network management of wired ethernet, WiFi and mobile data connection based on
NetworkManager and ModemManager
channels:
stable: 1.2.2-10 (73) 5MB -
candidate: 1.2.2-10 (73) 5MB -
beta: 1.2.2-10 (73) 5MB -
edge: 1.2.2-10 (112) 5MB -
Let's say you install the "beta":
$ snap install network-manager --channel=beta
network-manager (beta) 1.2.2 from 'canonical' installed
Let's try to switch from 'beta' to 'stable':
$ snap refresh network-manager --channel=stable
snap "network-manager" has no updates available
Because 'stable' and 'beta' are currently identical, the channel switching code refuses to make the switch, and start tracking the new channel.
A nasty workaround in this case would be to switch first to 'edge', then switch to 'stable'. Because these are different, the switching will work.
WHAT SHOULD HAPPEN:
If two channels have identical snaps, then 'snap refresh' should be able to change the tracking and track the new channel.