You just need to refresh back to the revision that’s specified in the validation set. If the channel your device is tracking still has the newer revision published, then you can use --revision to refresh to the older (valid) revision. Ex.
And actually, you don’t really need the --revision, if you re-run snap refresh $SNAP_NAME, then snapd will trigger a refresh to the revision specified in the validation-set.
Note – this currently only works for required snaps in validation sets. There’s a bug with optional snaps which is currently being worked on.
I had tried to do a “general snap refresh” but not one for a specific snap. Indeed, this reverts the snap to the one listed in the validation-set. Thanks a lot!
But this is not so pretty. Would be awesome to just have a single command that would throw away all dangerously/sideloaded snaps in one go and “reset” the device to being clean.
~$ sudo snap install ssi-outdoor_29.snap --dangerous
ssi-outdoor 5a94585 installed
~$ sudo snap refresh ssi-outdoor
error: local snap "ssi-outdoor" is unknown to the store, use --amend to proceed anyway
~$ sudo snap refresh --amend ssi-outdoor
error: snap "ssi-outdoor" not found
It seems like the dangerous install is breaking the link between the store. Maybe that’s expected? But how do I get it back?
I thought it worked to manually “properly” install the snap with acking it first:
~$ snap ack ssi-outdoor_35.assert
~$ snap install ssi-outdoor_35.snap
ssi-outdoor f5d161c from Clay Owner (clay-owner-saltosystems) installed
~$ snap refresh ssi-outdoor
error: snap "ssi-outdoor" not found
You might need to tell it explicitly what store to use (IIRC there is an environment var you can set in the command to force the correct store), perhaps --amend uses a separate code path here…
Sure, uninstall the side-loaded snap and re-install from the Snap Store. You can’t refresh dangerous side-loaded snaps because they have no provenance, being effectively unasserted (i.e. they have no associated snap-revision). This is why the flag used to install unsigned snaps is named --dangerous. This was a purposeful design decision, and is not likely to change.
You can refresh dangerously side loaded snaps just fine using the --amend switch, like discussed above, but apparently you have to force the store via env variable for this (I assume snapd simply defaults to the global store for --amend) …
But I don’t think there’s any way to use the REST API like this since you can’t hand the env var to it…
Might be worth filling a feature request for that, but I’m not sure if the defaulting to the the global store isn’t actually on purpose by design…