Avoiding snap refresh in live sessions (i.e. installers)

As has been discussed informally a few times, it would be desirable to prevent snapd from automatically refreshing snaps in a live session, such as an installer environment. Given the ephemeral nature of live sessions a refresh isn’t very useful and in the case of subiquity at least they are quite disruptive.

@niemeyer said “What I’d like to achieve is being able to detect this situation, probably by verifying that the data directories are in RAM” which seems reasonable although I don’t precisely know how to do it.

I am willing to work on implementing this feature :slight_smile:

1 Like

bug 1723094 has been reported in Launchpad to track this.

@mwhudson We can check that we are on an overlayfs, look at the upperdir and check if it is a tmpfs. This should be sufficient to detect the installer environment.

1 Like

So there is code in this direction here: https://github.com/snapcore/snapd/blob/master/osutil/overlay.go#L44

Which probably needs to be adapted a bit and called from around here: https://github.com/snapcore/snapd/blob/master/overlord/snapstate/autorefresh.go#L134

@pedronis do you have thoughts about this?

For the record, the plan for the live server installer is to run “snap set core refresh.hold=$(date --date=now+60days --iso-8601=seconds)” fairly early on. If people leave their live sessions going for 60 days, so be it…