Categories
DailyOps

How to keep custom number of snap revisions

Define a custom number of snap revisions.

Since snap 2.34 you can use refresh.retain option to define a number of kept revisions (between 2 and 20). By default it is 3 on Ubuntu Core and 2 on other Ubuntu systems.

Inspect initial refresh configuration – noting is defined, so defaults apply.

$ sudo snap get -d system refresh
{
	"refresh": {}
}

Define custom retain number.

$ sudo snap set system refresh.retain=3

Inspect stored configuration.

$ sudo snap get system refresh.retain
3
$ sudo snap get -d system refresh
{
	"refresh": {
		"retain": 3
	}
}

By default it snap will be refreshed four times per day, modify refresh.timer option (00:00~24:00/4) option to change this behaviour.

$ snap refresh --time
timer: 00:00~24:00/4
last: today at 15:10 CET
next: today at 23:50 CET