Experimental feature: snap refresh awareness and update inhibition

by Igor Ljubuncic on 27 February 2020

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.

Newsletter Signup

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 snapd service will apply it, keeping your software patched and up to date. Most of the time, this works great. In some scenarios, though, this may not be […]

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 useful and convenient, especially for applications that have online access. On the other hand, automatic updates can potentially disrupt users’ workflows if they happen to coincide. B […]

Creating Snaps on Ubuntu Touch

This article was written in collaboration with Alfred E. Neumayer of the UBports Project. Tablets, phones and current technology’s capabilities are phenomenal. Who would have thought a thin, light, barely 10 inch device would provide all the power necessary to run Virtual Machines, wherever one desires while powered on battery? That a sma […]