Snaps don't refresh automatically

I’ve noticed this at least a week ago: new versions aren’t installed for days, even if I know that it is available, even after a reboot.

$ snap changes
error: no changes found
$ sudo snap refresh
telegram-desktop 2.1.2 from Telegram FZ-LLC (telegram.desktop) refreshed
beekeeper-studio 1.2.0 from Beekeeper Studio (matthew-rathbone) refreshed
node (14/stable) 14.2.0 from NodeSource, Inc. (nodesource✓) refreshed

System logs show many AppArmor messages like this:

AVC apparmor="DENIED" operation="create" profile="snap.telegram-desktop.telegram-desktop" pid=9297 comm=5174206 family="netlink" sock_type="dgram" protocol=0 requested_mask="create" denied_mask="create"
$ snap version
snap    2.44.3
snapd   2.44.3
series  16
ubuntu  19.10
kernel  5.3.0-51-generic

Does the command snap changes show any attempts to perform an auto-refresh?

No, it doesn’t. I haven’t done any tweaks to snap configuration, but enabled refresh awareness (long before I’ve started to notice missing updates).

After some time I’ve noticed that some snaps do update, but at least snaps with AppArmor errors in logs (like Telegram) don’t. I’ve tried to remove/install them again, but it had no impact on auto-refresh.

anything new in snap changes about the ones with apparmor errors ?

also … might make sense to post the apparmor errors …(typically snaps do not cause apparmor errors)

This is today after 15 min after turning on the PC in the morning:

$ snap changes
ID   Status  Spawn                   Ready                   Summary
387  Done    yesterday at 18:05 +03  yesterday at 18:05 +03  Auto-refresh snap "beekeeper-studio"
$ sudo snap refresh
chromium (beta) 83.0.4103.56 from Canonical✓ refreshed
$ snap changes
ID   Status  Spawn                   Ready                   Summary
387  Done    yesterday at 18:05 +03  yesterday at 18:05 +03  Auto-refresh snap "beekeeper-studio"
388  Done    today at 09:38 +03      today at 09:38 +03      Refresh snap "chromium"

Maybe I didn’t get i right, but I think it did check updates on boot before. That’s why I was using just snap changes as my morning routine instead of refresh + changes.

Anyway, with Telegram I knew there is a newer version on Stapcraft and waited a 24h+, but it haven’t been updated. My understanding it should check for updates at least every 6 hours by default (which also implies checking on boot in the morning).

I’ve posted an example of AppArmor log in the first message. The log it spammed with those:

audit: type=1400 audit(1589524770.005:115): apparmor="DENIED" operation="file_lock" profile="snap.opera.opera" name="/snap/opera/75/usr/lib/x86_64-linux-gnu/opera/opera_autoupdate" pid=7523 comm="opera" requested_mask="w" denied_mask="w" fsuid=1000 ouid=0
audit: type=1400 audit(1589524770.005:115): apparmor="DENIED" operation="file_lock" profile="snap.opera.opera" name="/snap/opera/75/usr/lib/x86_64-linux-gnu/opera/opera_autoupdate" pid=7523 comm="opera" requested_mask="w" denied_mask="w" fsuid=1000 ouid=0
apparmor="DENIED" operation="dbus_method_call"  bus="session" path="/org/freedesktop/ScreenSaver" interface="org.freedesktop.ScreenSaver" member="GetSessionIdleTime" mask="send" name="org.freedesktop.ScreenSaver" pid=6438 label="snap.telegram-desktop.telegram-desktop" peer_pid=2511 peer_label="unconfined"
USER_AVC pid=1344 uid=105 auid=4294967295 ses=4294967295 msg='apparmor="DENIED" operation="dbus_method_call"  bus="system" path="/org/freedesktop/NetworkManager/Settings" interface="org.freedesktop.NetworkManager.Settings" member="ListConnections" mask="send" name="org.freedesktop.NetworkManager" pid=6438 label="snap.telegram-desktop.telegram-desktop" peer_pid=1346 peer_label="unconfined"
 exe="/usr/bin/dbus-daemon" sauid=105 hostname=? addr=? terminal=?'
USER_AVC pid=1344 uid=105 auid=4294967295 ses=4294967295 msg='apparmor="DENIED" operation="dbus_method_call"  bus="system" path="/org/freedesktop/NetworkManager/Settings" interface="org.freedesktop.NetworkManager.Settings" member="ListConnections" mask="send" name="org.freedesktop.NetworkManager" pid=6438 label="snap.telegram-desktop.telegram-desktop" peer_pid=1346 peer_label="unconfined"
 exe="/usr/bin/dbus-daemon" sauid=105 hostname=? addr=? terminal=?'

I missed earlier that you’d turned on the experimental refresh awareness feature flag. By any chance, is telegram-desktop running in the background when the automatic refreshes took place?

Could that be the case for the other snaps you’ve seen this with?

No, Telegram isn’t in autostarted (I disabled it because of Ubuntu/GNOME issues with desktop expanding animation on 4K and app starting as small windows). So, nothing is running from snaps on boot.

BTW, I’m now on freshly installed 20.04 and will look for refresh issues in the coming days (haven’t enabled refresh-awareness yet).

Nope, same thing again in the morning (refresh-awareness isn’t enabled):

$ uptime
 11:41:33 up 40 min,  1 user,  load average: 2.16, 1.18, 0.48
$ snap changes
28   Done    yesterday at 22:39 +03  yesterday at 22:39 +03  Connect remmina:password-manager-service to snapd:password-manager-service
$ sudo snap refresh
core18 20200427 from Canonical✓ refreshed
gnome-3-34-1804 0+git.3009fc7 from Canonical✓ refreshed

40 min after start, no snaps are running, and still no automatic updates for the core and gnome.

Reinstalling didn’t help, so it is something in snapd 2.44

$ snap --version
snap    2.44.3+20.04
snapd   2.44.3+20.04
series  16
ubuntu  20.04
kernel  5.4.0-29-generic