I sort of expected that the app would be updated when I restart the application or my laptop. Yesterday, I restarted my laptop to apply a kernel upgrade, but the apps didn’t get upgraded, and these notifications appeared.
Are there plans on implementing an update method where the update will be downloaded, but not applied until next launch (whether application closes, or system is restarted)?
sudo snap set system experimental.refresh-app-awareness=true
if you click a notification, it will/should open the snap store and allow you to click the update button (indeed after you have closed the app) …
i agree it should be better integrated (you should probably also file a wishlist bug on launchpad) but it is a first step towards more update control for desktop apps at least …
It’s a bit of a double-edged sword, people don’t want us to apply/perform refreshes immediately on boot because then they are delayed from using their applications when they first turn on their machine, but then we also have cases like yours where you want the update to be performed at some point after “shutting down” but also before “starting up”.
I think eventually we wanted to have some integration in those notifications where you had a button you could click to ask the application to gracefully close itself so the update can be performed (like what you see in browsers natively), but there wasn’t uniform implementation on behalf of applications about how to 1) receive such a signal and 2) how to “gracefully” close itself since some applications just ignore it entirely.
From the user perspective I’ve had assumed the goal was to wait until the application closed and then update it ASAP, imagine spamming snap refresh in the background every 10 seconds or so until it’s done.
I was already under the impression updates are done on boot to be honest, I do most my snap development in a VM that I rewind to a checkpoint that’s usually a few weeks old. It manages to update all the snaps on my system before the graphical session is even available!
Usually the delay happens because of the download from the snap repo, not the update itself, right? What if the snap launches normally unless snapd sees that there’s an update already downloaded & waiting to be installed? And when an update is being applied, there’d be a notification popup saying something like “An update for this application is being applied, please wait for few seconds” (loading bar would be good, too).
Also, some software like Discord don’t launch unless the app itself is up-to-date (that’s the only one I know). Maybe a collaboration with devs, like the Discord devs, would be a good one, too. That way that specific app is refreshed at launch.
To be clear, all my responses below are about when you have refresh app awareness enabled (which it will be by default soon…)
Unfortunately this is not very efficient especially when you consider that many folks will leave the applications in question open for days or weeks.
Unfortunately that’s not quite how the implementation works, the download only begins after the snap has been fully stopped. Essentially if we can’t complete the auto-refresh due to running apps, we abort the whole thing and try again later at the next refresh window. This is arguably not the best implementation, but implementing it such that the snap is downloaded would require the auto-refresh change to stay active for a really long time which is not great for other reasons that are mostly internal to snapd’s implementation. That’s not to say we couldn’t rewrite things to do this (download in a separate change from the actual auto-refresh), but there are warts to handle, such as what do you do if there was revision 2 available when we first noticed there was a refresh available, and then a week later when the user closes the app and we go to perform the update there actually is now revision 3 available? If we pre-downloaded you would now have to download revision 2 and then either go download revision 3 again immediately which defeats the time saving and wastes bandwidth, whereas our current implementation will just download revision 3 when the user closes the app and they don’t have to have extra revisions lying around waiting and then never be used.
We actually have just landed a rough implementation (to be cleaned up in active PR’s we are reviewing now) of one of the last features for refresh-app-awareness which is very similar to this. It effectively will prevent the user from starting a new instance of the snap application while it is being refreshed and displays a pop-up message with a progress bar while the snap is being refreshed and it closes itself after the refresh is done.
This is also something we are working on, to give snaps the ability to refresh themselves and query if there are pending refreshes available (for themselves, not for other snaps). Parts of this feature have landed but we haven’t totally finished it and we are working on the documentation for this, but this sort of feature is definitely something we want to provide to snap authors as it provides a good user experience when the app can be kept in the loop about available refreshes and display information to the user in an app-specific way.
Sure, you’ve commented later on the post about how seperating the download phase from the installation phase isn’t trivial either, it’d be nice if things just worked but you’re the experts after all, I can only speak as a user about what’d be ideal, not what might actually work :).
Also very nice <3
This is all amazing progress, keeping in mind perfect is the enemy of good enough, so I’m very glad to see this work landing as it’s going to solve a lot of real world problems.
So thanks to all of you who’ve been working on it (and in the ecosystem in general )
As far as I can tell, the situation remains the same as of writing (Oct 2023). Snap does not download updates in the background if the app is running (edit: this feature was actually released in snapd 2.59, but there’s a bug). Furthermore, snap refresh will display “All snaps up to date.” when they are running apps with pending updates. I thought I had heard that Snap has this feature now, but it doesn’t. I’m posting this for anyone else who was confused, like me.