Users of Ubuntu-family Linux distributions and, increasingly, others are encountering more and more software components packaged as “Snap” distributions. This is a system, developed by Canonical, the perpetrators of Ubuntu, which packages an application along with all of its dependencies into a compressed filesystem which, when the application is launched, is uncompressed on the fly, mounted, and the application run in a sandbox implemented under AppArmor which restricts its access to system resources and services. This is intended to allow applications to be installed without installing a large number of dependencies on the host system which permanently clutter up that system’s storage and must be updated independently by the system’s administrator. It also avoids problems where two applications need different, incompatible versions of a library, which is a nightmare for administrators.
Another “feature” of snaps is “automatic updates”. By default, several times a day, the snap daemon checks with the master snap repository at snapcraft.io and, if an update newer than the one installed on a user’s system is available, automatically and “atomically” installs it. While by this adjective they mean an indivisible operation that does not leave the system in an undefined state while the update is in progress, it is also appropriate in the sense that, if the application is running, it nukes it, potentially causing the user to lose work in progress. Even if that doesn’t happen, automatic updates are pure poison to administrators of high-availability systems, who may discover their systems have broken in the middle of the night on a long week-end because the Snap daemon up and installed an update to some component on a server that was incompatible with the applications running on it.
Well, in the fifty-year tradition of Unix systems empowering their users and administrators to configure them as they wish, the answer to this would seem simple: just turn off the automatic updates. But in the more recent tradition of Linux developers trying to make their systems as opaque, authoritarian, fragile, and irritating as those from Microsoft, with Snap, you can’t turn off automatic updates. That is, without going into the source code and ripping it out. There is no configuration option to suppress automatic updates!
By default, Snap checks for updates every four hours, every single Goddam day. If it finds an update available and the application is running, it displays a pop-up on the user’s desktop (illustrated at the top of this post) which displays a countdown to when the application will be nuked by an automatic update you cannot suppress. There is no way to even turn off these pop-ups: turning off notifications from “io.snapcraft.SessionAgent” in the Settings/Notifications/Applications panel does nothing to shut them up—you have to dismiss them one by one, and there’s always another coming at you in four hours.
So why not just close the application, let it update, and get on with your work? Well, if the application is a Web browser, like the Chromium browser I use most of the time, it is a royal pain in the fundament to kill a dozen or so windows on four desktop workspaces, restart the browser, and then put everything back to where it was before you were interrupted. And after you do that, odds are tomorrow you’re going to get another popup because Chromium has been updated again. Progress, you know.
This is not just an aesthetic issue. I was recording a video segment from my desktop screen for a YouTube demonstration video when one of these popped up in the middle of the frame. People who use Linux to drive kiosk screens and interactive devices are infuriated when one of these pops up on one of their machines and stays there until somebody notices and updates the device.
Well, if you can’t turn it off, can you at least make it happen less frequently? It turns out you can, here’s how.
First of all, you can query when Snap is checking for updates with the command:
snap refresh --time
This will show you the current schedule and the times for last and next scheduled updates. You’ll probably see the default, “00:00~24:00/4
”, which is every four hours every day. You can change this, as described in the Snapcraft document “Managing updates”. To do this, while running as super-user, use the command:
snap set system refresh.timer="timer string"
where timer string is a time specification in the arcane syntax described in Snapcraft’s “Timer string format” document. For example, on my system I have set this to:
snap set system refresh.timer=sun1,05:00
which performs the update check at 05:00 local time on the first Sunday of each month. After doing this, I see:
$ snap refresh --time
timer: sun1,05:00
last: today at 14:01 CEST
next: in 21 days, at 05:00 CET
If you wish a longer respite from update pop-ups, you can use the “refresh.hold
” feature, which suppresses update checks until a time specified by an RFC 3339 date string. You cannot specify a hold date more than 90 days in the future, however: serfs must be reminded that their computers are not their own. Here is a command I developed to hold updates for the next 89 days:
snap set system refresh.hold="$(date --date='89 days' +%Y-%m-%dT%H:%M:%S%:z)"
You can remove an update hold with:
snap unset system refresh.hold
These commands must be run as super-user. Here is what the status looks like with a hold in effect.
$ snap refresh --time
timer: 14:00
last: today at 14:01 CEST
hold: 2023-01-13
next: tomorrow at 14:00 CEST (but held)
Enjoy a less-irritating Ubuntu experience.