I am the developer of Super Productivity which is an open source app mainly distributed as snap. The app is based on electron and uses IndexedDB as a data-source. Unfortunately there is an issue: Whenever snapd automatically tries update the app the database connection is lost and there is no way to recover from it (apart from restarting the app). Is there anyway to prevent this updates when the app is running (from the app itself, as most of my users probably just run snap as it is configured out of the box)?
Alright! Thank you very much for the quick and extensive help! Much appreciated (didn’t expect this tbh :))! I’ll stick with informing my users about this then.
I recognized that the auto update is not the only thing causing this error. I haven’t been able to put my finger on it, but this is definitely snap specific and occurs every once in a while, especially if I leave the app running for longer periods of time. snap set system experimental.refresh-app-awareness=true is set, so the auto refresh should not be the (only) problem here.
I suspect that some sort of file access might be responsible for this. Is it theoretically possible for the snap container or snapd to access, copy, move files in the projects config folder (e.g. /home/user/snap/superproductivity/1446/.config) in such a manner even when automated updates are disabled?
only when updating /home/user/snap/superproductivity/1446 will be touched (content is copied to the dir of the next version) and the current/ symlink gets updated … during normal operation nothing of the snap ecosystem should touch it, only your app would …
if you want to avoid copying the config files/dirs, you should use $SNAP_USER_COMMON, i.e. /home/user/snap/superproductivity/common
to store such files. this dir is persistent and gets never touched …
Thank you very much for your answer! Using the common dir seems to work well as far I’ve tested this. Is there any reason, why this might NOT be a good idea (as it is not configured to be like this)?
snaps use the versioned config dirs by default so that a “snap revert myapp” will get you the matching config file for the matching binary, so API, ABI and configuration options are always the matching version for the running version of the app …
if you use the /common dir you have to take care for this yourself … but if your config options do typically not change their naming in incompatible ways there should be no issues with that