Does Core20 Refresh Cause App Restart?

If my snap’s base is core20, will a refresh of core20 cause my snap (running as a daemon or otherwise) to restart as well ?

Yes, AFAIK any snaps that are dependent upon another snap will have its daemons, if there are any, restarted when the other snap is updated.

Hmm, need to find a way to block that then. Imagine having a critical system running and while a specific “event” is about to happen, core20 gets refreshed.

Note: I only care about core20 because, I have a custom store implementation, so I “control” how apps can get updated. I am also working on a system API using which Apps could “tell” the system that they are in a “critical” state and hence should not be updated.

There are two cases:

  • If you’re running Ubuntu Core 20 and the core20 snap is refreshed (or in general your snap is using base coreXX and you are running Ubuntu Core XX), then the whole system will be rebooted, so your daemon will also be restarted
  • If you’re not running on Ubuntu Core series matching the core20 snap or you are running on classic, etc. then your daemon will not be started and stopped but instead the freezer cgroup will be used to “freeze” the processes started from your snap while we update the mount namespace, then the processes will be unthawed and resume execution. You can read more about the freezer cgroup here:

Independent of all of this, we are working on a refresh gating hook, where snaps can inform/delay about their refresh when their dependencies are going to be refreshed, for example your snap could have this hook and tell snapd to not refresh the core20 snap for 1 hour and then snapd will wait an hour (though the max number of times your snap can do this is limited) and come back and try to do the core20 refresh again. This will be documented better when the feature is complete, it is under very active development.