Snaps update automatically, and by default, the snapd daemon checks for updates 4 times a day. Each update check is called a refresh.
But when, and how often, these updates occur can be modified with the snap command. Updates can be set to occur on Friday at midnight, for example, or for specific days of the month, such as only the third Monday, or even the last Friday of the month, between 23:00 to 01:00 the next day.
Snaps running in devmode, or installed locally, are typically intended for testing and do not update automatically until they’ve been published and downloaded from the store.
Regardless of when a refresh is scheduled, an update refresh can be initiated with the
snap refresh command:
$ snap refresh gnome-system-monitor 3.28.2 from 'canonical' refreshed gnome-calculator 3.28.2 from 'canonical' refreshed
The refresh command can also be used to see when the last refresh occurred and when the next is scheduled:
$ snap refresh --time timer: 00:00~24:00/4 last: today at 09:16 GMT next: today at 17:39 GMT
The first line in the above output shows the value of the timer system option. This defines how and when a refresh should be scheduled.
To see which snaps are going to be updated with the next refresh, use the additional
$ snap refresh --list Name Version Rev Publisher Notes core 16-2.45.1+git2022.b6b3c25 9584 canonical✓ core get-iplayer 3.26 250 snapcrafters - qt551 5.5 30 keshavnrj -
There are four system-wide options that manage how updates are handed:
Use refresh.timer to modify when, and how frequently, your snaps are refreshed.
The following example asks the system to only refresh snaps between 4.00am and 7.00am, and 7.00pm and 10:10pm:
$ sudo snap set system refresh.timer=4:00-7:00,19:00-22:10
Other examples for the time and frequency option include:
||Mondays at 10:00, Fridays at 15:00|
||Mondays at 10:00 and 15:00, Fridays at 10:00 and 15:00|
||Monday to Wednesday and on Friday, twice between 9:00 and 11:10|
||Mondays, some time between 9:00 and 11:00, and on Wednesdays, some time between 22:00 and 23:00|
||Monday and on Wednesday, at 0:00|
||2nd Monday of the month, through the following Wednesday, between 23:00 and 24:00|
||Last Friday of the month, from 23:00 to 1:00 the next day|
See Timer string format for a comprehensive breakdown of the syntax used to define times and frequencies.
You can check the update frequency for your environment with the
$ snap refresh --time timer: 00:00~24:00/4 last: today at 07:47 BST next: today at 12:13 BST
By default, the snap system is scheduled to refresh four times per day, as shown in the above output.
Use refresh.hold to delay snap refreshes until a defined time and date. The time and date format needs to conform to RFC 3339.
For example, 5:22pm (BST), Tuesday 23rd April 2019, would look like the following:
The correct format can be generated with the date command:
$ date --date="BST 2019-04-23 17:22:54" +%Y-%m-%dT%H:%M:%S%:z 2019-04-23T17:22:54+01:00 $ sudo snap set system refresh.hold="$(date --date=tomorrow +%Y-%m-%dT%H:%M:%S%:z)" $ sudo snap get system refresh.hold 2019-04-24T17:22:54+01:00
After a refresh, the next refresh can be delayed by up to 60 days, after which a refresh will be performed regardless of the refresh.hold value.
We explicitly format the date command output because the version of date provided by GNU core utilities breaks RFC3339 compatibility when passing the
--rfc-3339argument. See the bug report for further details.
Use refresh.metered to pause and re-enable the refresh process when NetworkManager detects a metered connection, such as an LTE link with a limited data plan.
To hold refreshing snaps when on a metered connection:
$ sudo snap set system refresh.metered=hold
To allow refreshing:
$ sudo snap set system refresh.metered=null
By default, refresh is enabled when a metered connection is detected.
Use refresh.retain to set the maximum number of a snap’s revisions stored by the system after the next refresh:
$ sudo snap set system refresh.retain=3
The refresh.retain value can be a number between 2 and 20. The default is
refresh.retain=3 on Ubuntu Core systems and
refresh.retain=2 on classic Ubuntu systems, such as those running Ubuntu 18.04 LTS (Bionic Beaver) and Ubuntu 16.04 LTS (Xenial Xerus).
snap changes and
snap change <num> commands are used to see details about what changed during the last refresh:
$ snap changes ID Status Spawn Ready Summary 2052 Done today at 09:34 BST today at 09:35 BST Auto-refresh 7 snaps 2053 Done today at 15:16 BST today at 15:17 BST Refresh snaps "gnome-calculator", "flock-chat", "gnome-characters", "gnome-system-monitor"
And to see
$ snap change 2053 Status Spawn Ready Summary Done today at 15:16 BST today at 15:16 BST Ensure prerequisites for "gnome-calculator" are available Done today at 15:16 BST today at 15:16 BST Download snap "gnome-calculator" (199) from channel "stable" Done today at 15:16 BST today at 15:16 BST Fetch and check assertions for snap "gnome-calculator" (199) ⋮ Done today at 15:16 BST today at 15:16 BST Start snap "gnome-system-monitor" (54) services Done today at 15:16 BST today at 15:16 BST Clean up "gnome-system-monitor" (54) install Done today at 15:16 BST today at 15:16 BST Run configure hook of "gnome-system-monitor" snap if present
Last updated 13 days ago. Help improve this document in the forum.