About "holding" automatic refreshes

Hi,

I am using the snap refresh --hold command so that all updates are held forever, since one of the snaps I’m using is active all the time and I don’t want it to get updated while it’s running. I am using snap refresh in order to update all the snaps manually whenever I close the aforementioned snap.

Is the --hold parameter maintained after a snap refresh command is issued or is it cancelled and a new snap refresh --hold command has to be given after every manual update so that the automatic updates are held again?

Thank you.

The hold setting is persistent in the state. You can confirm that with:

sudo cat /var/lib/snapd/state.json| jq .data.config.core

@mborzecki1

I had accepted your response as the solution but it seems snapd does not actually hold the refreshes with the snap refresh --hold command.

This is what the system returned when I issued the cat command as root:

TurboX:~ # cat /var/lib/snapd/state.json| jq .data.config.core
{
  "refresh": {
    "hold": "forever"
  },
  "seed": {
    "loaded": true
  }
}
TurboX:~ #

This is what appeared in the journal log the same day without me issuing the snap refresh command:

May 18 20:44:53 TurboX snapd[1278]: storehelpers.go:916: cannot refresh: snap has no updates available: "bare", "core18", "core20", "gnome-3-28-1804", "gtk-common-themes", "snapd", "surfshark"

Obviously snapd did check for updates automatically.

Is there any other way to actually disable the automatic refreshes?

Thank you.

P.S. The system is openSUSE Tumbleweed if this helps.

I’m not quite sure what evidence you are basing that conclusion on. Yes, the code will hold refreshes, see for yourself snapd/overlord/snapstate/autorefresh.go at 72c072d29ea524ac0c94be3fc10c7a4d2486673a · canonical/snapd · GitHub

The log you mention shows up if you run snap refresh manually.

@mborzecki1

The log entry appeared by itself. I hadn’t run snap refresh manually.

On another system that’s running Xubuntu 22.04, I see those log entries appearing regularly automatically. I haven’t used snap refresh --hold on that one though. I think the same log entry is used for both the automatic and the manual updates.