Refresh awareness

Snaps update automatically, and by default, the snapd daemon checks for updates 4 times a day. Each update check is called a refresh and is described in more detail in Managing updates.

A refresh can sometimes occur when a snapped application is running, and this can be problematic for desktop applications. A desktop application may stop responding, or the user may remain unaware that an application needs an update, which adds unnecessary risk if an update is triggered by a known vulnerability or stability issue.

Service management is not affected, as services are started and stopped manually as part of the refresh process, unless a specific endure value has been embedded into the snap by the snap developer. See Services and daemons for further details.

When an update occurs while an affected desktop application is running, refresh app awareness helps to mitigate any potential issues in two ways:

  1. Deferred updates
  2. Desktop notifications
Requires snapd 2.57+:

Refresh app awareness requires snapd version 2.57 or greater. It was previously available as an experimental feature.

Deferred updates

An update can be postponed for up to 14 days if an affected application is running. The update will be either applied when the next refresh occurs without the application running, or after 14 days even if the application remains active.

After closing the affected application, the refresh can be triggered manually with the snap refresh command, either globally for all snaps, or with the specific snap name:

snap refresh <snap-name>

If a manual refresh detects the application is still running, the error output will include the detected process ids of the running applications:

error: cannot refresh "firefox": snap "firefox" has running apps (firefox), pids:
       1639,1854,1912,1932,3514,3632,5814,5870

Desktop notifications

While an affected application is running, each refresh attempt will trigger a desktop notification to inform the user that the app should be closed to avoid disruption:

image

On the default Ubuntu GNOME desktop, notifications can be modified and disabled by selecting Notifications from the Settings application and selecting the Snapd User Session Agent application:

Other desktop environments have equivalent functionality.

See Refresh awareness security policy for details on how refresh updates accommodate confinement and security policy requirements.

2 Likes

This page mentions the postponement of installations for “up to 14 days”. This implies that the interval is not fixed. So it would be helpful if information on how to change / configure the interval could be added.

Is there a way to force refresh even when a running process is detected ? I have a snap which uses snapd REST api’s to perform installs of snaps, the problem is it can not update itself . Is there a work around for this?

Is it enabled by default in snapd 2.57+ on any distro, or only when running on Ubuntu 22.04 LTS and higher?

This is a really good question - thanks for bringing it up. It’s a snapd feature, so should be distro-agnostic. I’ve just tried on Mint (where the update was halted and a notification appeared) and CentOS Stream (where the update was halted). I’ll update the doc to make this clearer.