Your submission was sent successfully! Close

You have successfully unsubscribed! Close

Thank you for signing up for our newsletter!
In these regular emails you will find the latest updates about Ubuntu and upcoming events where you can meet our team.Close

Experimental feature: snap refresh awareness and update inhibition

Igor Ljubuncic

on 27 February 2020

This article is more than 4 years old.


We’d like to follow up on last week’s article about parallel installs for classic snaps with another bleeding-edge topic. Today, we will discuss snap refreshes. By design, snaps come with automatic updates, and by default, the update (refresh) frequency check is four times a day. Whenever new application versions are published, they soon become available and propagate to all end-user systems.

Normally, the process is transparent and seamless, but there could be exceptions. For instance, if you have an app open and running, an update could be disruptive in the middle of your work. Some developers have asked for an option to inhibit refreshes of snaps while they are running, and this is now a new, experimental feature that you can enable and test on your system.

Opt-in for refresh app awareness

As with many early access capabilities, you need to toggle an experimental flag on. Your system needs to be running snapd 2.39 or newer (you can run snap version in a terminal window to determine which version of snapd your system is running), and you need to execute this command:

snap set core experimental.refresh-app-awareness=true

For consistency purposes, you should restart all your running snaps, or reboot the machine.

Testing, testing

Once the feature has been enabled, you can try to refresh a running snap. If an application is busy (either running or has hooks), the refresh will be inhibited. For example, you can try this with the Okular PDF viewer. The stable version is currently 19.04.2, whereas the candidate version is 19.12.1.

channels:
  stable:    19.04.2        2019-07-05 (63) 20MB -
  candidate: 19.12.1        2020-01-08 (79) 21MB -
  beta:      ↑                                 
  edge:      master+c1afa35 2020-02-12 (82) 18MB -

If you try to refresh to candidate while you have the application open, you will see the following output on the command line:

snap refresh okular --candidate
error: cannot refresh "okular": snap "okular" has running apps (okular)

On the other hand, once you close the application, the update will be applied:

okular (candidate) 19.12.2 from KDE✓ refreshed

This feature allows you to gracefully time the updates of your applications, and thus ensure the least amount of disruption to your work. The refresh timeout is not indefinite, though. After a certain period (current default is 7 days), the update will be triggered. However, as with any preview technology, things can change. Moreover, at the moment, the refresh inhibition is mostly manual. In the future, snapd will likely include the option to update snaps once the user completes their work and closes the application(s).

Summary

The app refresh capability offers snaps users another level of control in the overall user experience. Automatic updates are geared toward security, but users can defer updates for up to 60 days, and now, they also have the ability to gracefully update applications with minimal disruption to their normal usage patterns and workflows.

We very much welcome your feedback and suggestions, especially with new and upcoming features. The refresh awareness option is a good example of where the developer feedback has been valuable and useful in making the snap ecosystem even friendlier and more robust. If you have any ideas on this topic – or any other, please join our forum for a discussion.

Photo by Mario Caruso on Unsplash.

Ubuntu desktop

Learn how the Ubuntu desktop operating system powers millions of PCs and laptops around the world.

Newsletter signup

Get the latest Ubuntu news and updates in your inbox.

By submitting this form, I confirm that I have read and agree to Canonical's Privacy Policy.

Related posts

Hold your horses, I mean snaps! New feature lets you stop snap updates, for as long as you need

One of the core aspects of the snap ecosystem is the built-in, robust auto-update mechanism. Whenever there is a snap update available in the Snap Store, the...

Snaps & better refresh notifications

Automatic updates grant snap users an ability to receive timely patches to their software, both in aspects of security and functionality. This can be rather...

Managing software in complex network environments: the Snap Store Proxy

As enterprises grapple with the evolving landscape of security threats, the need to safeguard internal networks from the broader internet is increasingly...