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

Complex problems, clever solutions – unique containers and virtualization snaps

Snaps come in many shapes and forms: security tools, productivity apps, games, handy utilities, video editing software, and more. Often, most snap package a single application. But snaps can also include services, databases, as well as multiple binaries. How far can this concept scale, you ask? Quite far. There are also some rather unique […]

How to manage snap updates

Updates are an integral part of the software lifecycle. Quite often, they bring improvements, vital security patches – and sometimes, unfortunately, bugs, too. In mission-critical environments, it is important to assert a high degree of oversight and precision over updates. Snaps come with a built-in automatic update mechanism, whereby sn […]

Canonical enables Linux desktop app support with Flutter

By Chris Sells (Google) & Ken VanDine (Canonical) Google’s goal for Flutter has always been to provide a portable framework for building beautiful UIs that run at native speeds no matter what platform you target. To validate this capability, we started by focusing on the mobile platforms, Android and iOS, where we’ve seen more than […]