Ubuntu Server should have refresh.retain=3 set by default

Bug #1948995 reported by Haw Loeung
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd (Ubuntu)
Confirmed
Low
Unassigned

Bug Description

Hi,

Is there a way to list the previous revisions of a snap in a specific channel and then allow the snap client to revert or install specific revisions?

I understand `snap revert` exists, but it only allows to revert to the last installed and that's it.

My use case is this, on an application unit using the ruby snap, it was automatically updated around 7 days ago. It wasn't until recently when we wanted to update the application where the latest ruby snap broke gem collection, see upstream bug[1]. But it wasn't known at the time so we thought to try the latest ruby from the latest channel (from 2.7/stable). So:

| snap refresh ruby --channel latest/stable

So now we want to revert:

| $ sudo snap revert ruby
| ruby reverted to 2.7.4
| $ sudo snap revert ruby
| error: cannot revert "ruby": no revision to revert to

What we actually want is to revert from 2.7.4 (231) in 2.7/stable to 2.7.4 (219) also in 2.7/stable.

The only way seems to be to find the correct URLs for both assertion file and snap itself, download both, and to use `snap ack <assertion file>` plus `snap install RjAgguCDAawLSJ3IByPe0R92xlNtrfGt_219.snap`.

[1]https://github.com/ruby/snap.ruby/issues/28

Revision history for this message
Ian Johnson (anonymouse67) wrote :

It is by design that you cannot revert to a snap that you do not already have installed on a system.

You can try using `snap list ruby --all` to get all currently installed revisions on your system (but note that only one revision can be "active" at a time), the revisions listed by this command are all the revisions that you can revert to.

You can increase the number of revisions that are kept around on a system to ensure that you are more likely to have the previous revision available by setting the refresh.retain system setting. I believe on Desktop/Server this setting defaults to 2, but on Ubuntu Core for example this setting defaults to 3.

Changed in snapd (Ubuntu):
status: New → Invalid
Revision history for this message
Junien F (axino) wrote :

@anonymouse67 hello ! so how do you suggest we fix our production system now ?

Changed in snapd (Ubuntu):
status: Invalid → New
Revision history for this message
Ian Johnson (anonymouse67) wrote :

Hi @axino, unfortunately I'm not aware of all the details of your system, but if you do not have the desired snap revision available on your system, then I can't advise on how you could get access to a revision which works for your system. You could try reaching out to the publisher to see if they can re-publish the working revision to the stable channel (since it seems like a regression), or maybe they could put the old revision onto a branch for you to temporarily switch to.

Finally, you could try rebuilding the snap yourself with the right assets to effectively revert, and then install this revision locally with --dangerous flag.

Changed in snapd (Ubuntu):
status: New → Incomplete
Revision history for this message
Junien F (axino) wrote :

OK thanks. I must say that this is not a great user experience. How would we "increase the number of revisions that are kept around on a system" ? It seems that the default of 2 is pretty low for servers.

Changed in snapd (Ubuntu):
status: Incomplete → New
Revision history for this message
Ian Johnson (anonymouse67) wrote :

You can set the number of revisions to keep with `snap set system refresh.retain=<n>`. The choice for Server is probably unfortunately a victim of inheriting the default choice for Ubuntu Desktop, which is 2. We originally had 3 for Desktop too (which is also still the default on Ubuntu Core), but that was deemed to be too storage intensive for most users so for "non-Ubuntu Core" we changed it to 2 instead, and it seems that Server has gotten bundled into the definition of "non-Ubuntu Core". I think there's a strong case to be made for having a different default on Server vs Desktop, so if you want to open a new bug about changing that (or we could re-use this one I suppose), I think that's a reasonable thing to request be changed.

Changed in snapd (Ubuntu):
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for snapd (Ubuntu) because there has been no activity for 60 days.]

Changed in snapd (Ubuntu):
status: Incomplete → Expired
Revision history for this message
Benjamin Allot (ballot) wrote :

I think this bug should be followed up with a change to retain=3 on Ubuntu servers.

Changed in snapd (Ubuntu):
status: Expired → New
summary: - Allow reverting to older revisions of a snap
+ Ubuntu Server should have refresh.retain=3 set by default
Changed in snapd (Ubuntu):
status: New → Confirmed
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.