Snap revert CLI UX discussion

No way to list reverted snaps

If one has reverted a snap there is no way to list which snaps are being held at a particular revision.

Eg snap refresh --list states All snaps up to date., I was expecting this to list snaps that are being held. Or for there to be another command to list held snaps. Currently the only place I can find out if a snap is being held in the CLI is to run snap info <snap> and compare the version numbers.

Suggestion: in the output of snap refresh --list have a section listing the snaps that are being held.

No documentation of how to revert a reverted snap

If one has reverted a snap to a previous version, but then wants to revert their revert it is not obvious how this can be done. snap revert --help does not provide any information on how to reverse the command. If one runs snap refresh you get All snaps up to date. (as stated above) which doesn’t help. One currently has to guess that running snap refresh <snap> or snap refresh --revision=N <snap> will override the revert.

Suggestion: in the output of snap revert --help document how one can revert performing a revert on a snap (and potentially add this to snap refresh --help)

cc @Wimpress

1 Like

Having refresh --list mention reverted snaps doesn’t make sense to me: it’s a list of things that are going to be refreshed, and those snaps are not going to be refreshed.

An explicit snap refresh of a package is the easiest way to “undo” a reversion:

~$ snap list --all word-salad
Name        Version  Rev  Tracking  Publisher  Notes
word-salad  0.1      7    edge      popey      disabled
word-salad  0.1      20   edge      popey      -
~$ snap revert word-salad
word-salad reverted to 0.1
Channel edge for word-salad is closed; temporarily forwarding to stable.
~$ snap list --all word-salad
Name        Version  Rev  Tracking  Publisher  Notes
word-salad  0.1      7    edge      popey      -
word-salad  0.1      20   edge      popey      disabled
~$ snap refresh word-salad
word-salad (edge) 0.1 from Alan Pope 🐧 (popey) refreshed
~$ snap list --all word-salad
Name        Version  Rev  Tracking  Publisher  Notes
word-salad  0.1      7    edge      popey      disabled
word-salad  0.1      20   edge      popey      -

the snap revert help should mention this, yes.

OK, I agree that the list in refresh --list is for ones that are going to be refreshed. So what about elsewhere ? Such as a snap held command or snap list --held or snap revert --held or something ? As at the moment it really isn’t obvious what is being held. (something like apt-mark showhold could be useful :slight_smile: )

maybe we can add it to the Notes column of the regular list, if there’s a sane way of exposing it in the API. The problem is that when you revert a snap all we do is write down that you’ve blacklisted a revision; we don’t know that there isn’t something newer (already installed, even).

@pedronis, WDYT?

Thanks for posting this @ahayzen. For context, this was a question raised during the recent Snapcraft live stream.

@degville Any chance you can add some documentation around reverting and refreshing from a reversion?

Good idea, yes. I’ll try to prioritise this as I agree it absolutely needs some clarification. Thanks for letting me know.

There’s a related/unrelated issue to this:

  • so far we don’t mark as blocked kernel/core revisions for which the rollback mechanism triggered. Given they are not really installed in the end, the blocked list mechanism we have wouldn’t work.

If we implement that then I think it would be clearer how the API should expose “blocked” revisions, then both snap info --verbose and snap list could do something with that.