Snap auto-refresh stuck

Hi,

I am running Ubuntu 18.04. I noticed this morning that snapd was using about 20 - 40% of my CPU. I had a look at journalctl --system -f -u snapd which gave the following:

Jun 05 10:24:39 systemd[1]: Started Snappy daemon.
Jun 05 10:24:42 snapd[5170]: storehelpers.go:438: cannot refresh snap “core”: snap has no updates available
Jun 05 14:32:22 snapd[5170]: storehelpers.go:438: cannot refresh: snap has no updates available: “core”, “core18”, “gnome-3-26-1604”, “gnome-3-28-1804”, “gnome-3-34-1804”, “gnome-calculator”, “gnome-characters”, “gnome-logs”, “gnome-system-monitor”, “gtk-common-themes”, “hugo”, “micropad”, “skype”, “spotify”
Jun 05 14:32:22 snapd[5170]: autorefresh.go:397: auto-refresh: all snaps are up-to-date
Jun 08 09:15:01 snapd[5170]: storehelpers.go:438: cannot refresh: snap has no updates available: “core”, “core18”, “gnome-3-26-1604”, “gnome-calculator”, “gnome-logs”, “gnome-system-monitor”, “gtk-common-themes”, “hugo”, “micropad”, “skype”, “spotify”
Jun 08 12:20:04 snapd[5170]: storehelpers.go:438: cannot refresh: snap has no updates available: “core”, “core18”, “gnome-3-26-1604”, “gnome-calculator”, “gnome-logs”, “gnome-system-monitor”, “gtk-common-themes”, “hugo”, “micropad”, “spotify”
Jun 09 10:02:37 snapd[5170]: 2020/06/09 10:02:37 Unsolicited response received on idle HTTP channel starting with “HTTP/1.0 408 Request Time-out\r\nCache-Control: no-cache\r\nConnection: close\r\nContent-Type: text/html\r\n\r\n<html><body><h1>408 Request Time-out</h1>\nYour browser didn't send a complete request in time.\n</body></html>\n”; err=<nil>
Jun 09 13:44:39 snapd[5170]: stateengine.go:150: state ensure error: Post https://api.snapcraft.io/v2/snaps/refresh: dial tcp: lookup api.snapcraft.io: no such host
Jun 10 13:56:48 snapd[5170]: stateengine.go:150: state ensure error: Post https://api.snapcraft.io/v2/snaps/refresh: dial tcp: lookup api.snapcraft.io: no such host
Jun 11 13:56:49 snapd[5170]: storehelpers.go:438: cannot refresh: snap has no updates available: “core”, “core18”, “gnome-3-26-1604”, “gnome-3-34-1804”, “gnome-calculator”, “gnome-characters”, “gnome-logs”, “gnome-system-monitor”, “gtk-common-themes”, “hugo”, “micropad”, “spotify”

There are a few messages in there which I didn’t understand; such as the unsolicited response and state ensure error messages.

Never-the-less, I had a look at
sudo snap info --verbose /var/lib/snapd/seed/snaps/*.snap | grep base:
which returned nothing.

Then I looked at snap changes (which to be honest, I probably should have done straight away):

ID Status Spawn Ready Summary
116 Doing 4 days ago, at 12:20 BST - Auto-refresh 4 snaps

You can see that the auto-refreshing of four snaps was spawned four days ago but has apparently got stuck somewhere. I’m not sure if the reason it is stuck is given in the info above.

I then tried to remove one of my installed snaps - micropad (this is largely because I don’t use it and didn’t realise it was still there). Using sudo snap remove micropad gave the following:

INFO Waiting for conflicting change in progress…

I left it for a few moments but this message just kept repeating. So in the end I aborted the auto-refresh using sudo snap abort 116, removed micropad sudo snap remove micropad and did a manual refresh sudo snap refresh which said

All snaps are up to date.

Finally, I re-ran snap changes which produced

ID Status Spawn Ready Summary
116 Abort 4 days ago, at 12:20 BST - Auto-refresh 4 snaps
117 Undone today at 09:33 BST today at 09:35 BST Remove “micropad” snap
118 Done today at 09:37 BST today at 09:37 BST Remove “micropad” snap
119 Done today at 09:37 BST today at 09:37 BST Refresh all snaps: no updates

Checking journalctl --system -f -u snapd again gave the following new entries:

Jun 12 09:37:47 snapd[5170]: storehelpers.go:438: cannot refresh: snap has no updates available: “core”, “core18”, “gnome-3-26-1604”, “gnome-calculator”, “gnome-logs”, “gnome-system-monitor”, “gtk-common-themes”, “hugo”, “spotify”
Jun 12 09:37:47 snapd[5170]: snapstate.go:1042: cannot refresh snap “skype”: snap “skype” has “auto-refresh” change in progress
Jun 12 09:37:47 snapd[5170]: snapstate.go:1042: cannot refresh snap “gnome-3-34-1804”: snap “gnome-3-34-1804” has “auto-refresh” change in progress
Jun 12 09:37:47 snapd[5170]: snapstate.go:1042: cannot refresh snap “gnome-3-28-1804”: snap “gnome-3-28-1804” has “auto-refresh” change in progress
Jun 12 09:37:47 snapd[5170]: snapstate.go:1042: cannot refresh snap “gnome-characters”: snap “gnome-characters” has “auto-refresh” change in progress

So it appears that even though snap refresh said all snaps were up to date, it actually couldn’t refresh some of the snaps as the auto-refresh is still in progress, even though the auto-refresh was aborted?

Thanks in advance for any help given.

Can you post the output of snap tasks 116 ?

I restarted my machine a short while ago as there were other updates to my machine which needed to be installed. On restart the machine hung for a bit and then restarted successfully. Running snap changes now gives

ID Status Spawn Ready Summary
116 Undone 4 days ago, at 12:20 BST today at 10:36 BST Auto-refresh 4 snaps
117 Undone today at 09:33 BST today at 09:35 BST Remove “micropad” snap
118 Done today at 09:37 BST today at 09:37 BST Remove “micropad” snap
119 Done today at 09:37 BST today at 09:37 BST Refresh all snaps: no updates

The auto-refresh is now set to Undone due to the restart. As requested, running snap tasks 116 gives

Status Spawn Ready Summary
Done 4 days ago, at 12:20 BST today at 10:36 BST Ensure prerequisites for “skype” are available
Undone 4 days ago, at 12:20 BST today at 10:36 BST Download snap “skype” (131) from channel “latest/stable”
Hold 4 days ago, at 12:20 BST today at 09:36 BST Fetch and check assertions for snap “skype” (131)
Hold 4 days ago, at 12:20 BST today at 09:36 BST Mount snap “skype” (131)
Hold 4 days ago, at 12:20 BST today at 09:36 BST Run pre-refresh hook of “skype” snap if present
Hold 4 days ago, at 12:20 BST today at 09:36 BST Stop snap “skype” services
Hold 4 days ago, at 12:20 BST today at 09:36 BST Remove aliases for snap “skype”
Hold 4 days ago, at 12:20 BST today at 09:36 BST Make current revision for snap “skype” unavailable
Hold 4 days ago, at 12:20 BST today at 09:36 BST Copy snap “skype” data
Hold 4 days ago, at 12:20 BST today at 09:36 BST Setup snap “skype” (131) security profiles
Hold 4 days ago, at 12:20 BST today at 09:36 BST Make snap “skype” (131) available to the system
Hold 4 days ago, at 12:20 BST today at 09:36 BST Automatically connect eligible plugs and slots of snap “skype”
Hold 4 days ago, at 12:20 BST today at 09:36 BST Set automatic aliases for snap “skype”
Hold 4 days ago, at 12:20 BST today at 09:36 BST Setup snap “skype” aliases
Hold 4 days ago, at 12:20 BST today at 09:36 BST Run post-refresh hook of “skype” snap if present
Hold 4 days ago, at 12:20 BST today at 09:36 BST Start snap “skype” (131) services
Hold 4 days ago, at 12:20 BST today at 09:36 BST Remove data for snap “skype” (123)
Hold 4 days ago, at 12:20 BST today at 09:36 BST Remove snap “skype” (123) from the system
Hold 4 days ago, at 12:20 BST today at 09:36 BST Clean up “skype” (131) install
Hold 4 days ago, at 12:20 BST today at 09:36 BST Run configure hook of “skype” snap if present
Hold 4 days ago, at 12:20 BST today at 09:36 BST Run health check of “skype” snap
Done 4 days ago, at 12:20 BST today at 09:36 BST Ensure prerequisites for “gnome-3-34-1804” are available
Undone 4 days ago, at 12:20 BST today at 09:36 BST Download snap “gnome-3-34-1804” (36) from channel “latest/stable”
Done 4 days ago, at 12:20 BST today at 09:36 BST Fetch and check assertions for snap “gnome-3-34-1804” (36)
Undone 4 days ago, at 12:20 BST today at 09:36 BST Mount snap “gnome-3-34-1804” (36)
Undone 4 days ago, at 12:20 BST today at 09:36 BST Run pre-refresh hook of “gnome-3-34-1804” snap if present
Undone 4 days ago, at 12:20 BST today at 09:36 BST Stop snap “gnome-3-34-1804” services
Undone 4 days ago, at 12:20 BST today at 09:36 BST Remove aliases for snap “gnome-3-34-1804”
Undone 4 days ago, at 12:20 BST today at 09:36 BST Make current revision for snap “gnome-3-34-1804” unavailable
Undone 4 days ago, at 12:20 BST today at 09:36 BST Copy snap “gnome-3-34-1804” data
Undone 4 days ago, at 12:20 BST today at 09:36 BST Setup snap “gnome-3-34-1804” (36) security profiles
Undone 4 days ago, at 12:20 BST today at 09:36 BST Make snap “gnome-3-34-1804” (36) available to the system
Undone 4 days ago, at 12:20 BST today at 09:36 BST Automatically connect eligible plugs and slots of snap “gnome-3-34-1804”
Undone 4 days ago, at 12:20 BST today at 09:36 BST Set automatic aliases for snap “gnome-3-34-1804”
Undone 4 days ago, at 12:20 BST today at 09:36 BST Setup snap “gnome-3-34-1804” aliases
Undone 4 days ago, at 12:20 BST today at 09:36 BST Run post-refresh hook of “gnome-3-34-1804” snap if present
Undone 4 days ago, at 12:20 BST today at 09:36 BST Start snap “gnome-3-34-1804” (36) services
Done 4 days ago, at 12:20 BST today at 09:36 BST Remove data for snap “gnome-3-34-1804” (27)
Done 4 days ago, at 12:20 BST today at 09:36 BST Remove snap “gnome-3-34-1804” (27) from the system
Done 4 days ago, at 12:20 BST today at 09:36 BST Clean up “gnome-3-34-1804” (36) install
Undone 4 days ago, at 12:20 BST today at 09:36 BST Run configure hook of “gnome-3-34-1804” snap if present
Undone 4 days ago, at 12:20 BST today at 09:36 BST Run health check of “gnome-3-34-1804” snap
Done 4 days ago, at 12:20 BST today at 10:36 BST Ensure prerequisites for “gnome-3-28-1804” are available
Undone 4 days ago, at 12:20 BST today at 10:36 BST Download snap “gnome-3-28-1804” (128) from channel “latest/stable”
Hold 4 days ago, at 12:20 BST today at 09:36 BST Fetch and check assertions for snap “gnome-3-28-1804” (128)
Hold 4 days ago, at 12:20 BST today at 09:36 BST Mount snap “gnome-3-28-1804” (128)
Hold 4 days ago, at 12:20 BST today at 09:36 BST Run pre-refresh hook of “gnome-3-28-1804” snap if present
Hold 4 days ago, at 12:20 BST today at 09:36 BST Stop snap “gnome-3-28-1804” services
Hold 4 days ago, at 12:20 BST today at 09:36 BST Remove aliases for snap “gnome-3-28-1804”
Hold 4 days ago, at 12:20 BST today at 09:36 BST Make current revision for snap “gnome-3-28-1804” unavailable
Hold 4 days ago, at 12:20 BST today at 09:36 BST Copy snap “gnome-3-28-1804” data
Hold 4 days ago, at 12:20 BST today at 09:36 BST Setup snap “gnome-3-28-1804” (128) security profiles
Hold 4 days ago, at 12:20 BST today at 09:36 BST Make snap “gnome-3-28-1804” (128) available to the system
Hold 4 days ago, at 12:20 BST today at 09:36 BST Automatically connect eligible plugs and slots of snap “gnome-3-28-1804”
Hold 4 days ago, at 12:20 BST today at 09:36 BST Set automatic aliases for snap “gnome-3-28-1804”
Hold 4 days ago, at 12:20 BST today at 09:36 BST Setup snap “gnome-3-28-1804” aliases
Hold 4 days ago, at 12:20 BST today at 09:36 BST Run post-refresh hook of “gnome-3-28-1804” snap if present
Hold 4 days ago, at 12:20 BST today at 09:36 BST Start snap “gnome-3-28-1804” (128) services
Hold 4 days ago, at 12:20 BST today at 09:36 BST Remove data for snap “gnome-3-28-1804” (110)
Hold 4 days ago, at 12:20 BST today at 09:36 BST Remove snap “gnome-3-28-1804” (110) from the system
Hold 4 days ago, at 12:20 BST today at 09:36 BST Clean up “gnome-3-28-1804” (128) install
Hold 4 days ago, at 12:20 BST today at 09:36 BST Run configure hook of “gnome-3-28-1804” snap if present
Hold 4 days ago, at 12:20 BST today at 09:36 BST Run health check of “gnome-3-28-1804” snap
Done 4 days ago, at 12:20 BST today at 09:36 BST Ensure prerequisites for “gnome-characters” are available
Undone 4 days ago, at 12:20 BST today at 09:36 BST Download snap “gnome-characters” (550) from channel “latest/stable/ubuntu-18.04”
Done 4 days ago, at 12:20 BST today at 09:36 BST Fetch and check assertions for snap “gnome-characters” (550)
Undone 4 days ago, at 12:20 BST today at 09:36 BST Mount snap “gnome-characters” (550)
Undone 4 days ago, at 12:20 BST today at 09:36 BST Run pre-refresh hook of “gnome-characters” snap if present
Undone 4 days ago, at 12:20 BST today at 09:36 BST Stop snap “gnome-characters” services
Undone 4 days ago, at 12:20 BST today at 09:36 BST Remove aliases for snap “gnome-characters”
Undone 4 days ago, at 12:20 BST today at 09:36 BST Make current revision for snap “gnome-characters” unavailable
Undone 4 days ago, at 12:20 BST today at 09:36 BST Copy snap “gnome-characters” data
Undone 4 days ago, at 12:20 BST today at 09:36 BST Setup snap “gnome-characters” (550) security profiles
Undone 4 days ago, at 12:20 BST today at 09:36 BST Make snap “gnome-characters” (550) available to the system
Undone 4 days ago, at 12:20 BST today at 09:36 BST Automatically connect eligible plugs and slots of snap “gnome-characters”
Undone 4 days ago, at 12:20 BST today at 09:36 BST Set automatic aliases for snap “gnome-characters”
Undone 4 days ago, at 12:20 BST today at 09:36 BST Setup snap “gnome-characters” aliases
Undone 4 days ago, at 12:20 BST today at 09:36 BST Run post-refresh hook of “gnome-characters” snap if present
Undone 4 days ago, at 12:20 BST today at 09:36 BST Start snap “gnome-characters” (550) services
Done 4 days ago, at 12:20 BST today at 09:36 BST Remove data for snap “gnome-characters” (495)
Done 4 days ago, at 12:20 BST today at 09:36 BST Remove snap “gnome-characters” (495) from the system
Done 4 days ago, at 12:20 BST today at 09:36 BST Clean up “gnome-characters” (550) install
Undone 4 days ago, at 12:20 BST today at 09:36 BST Run configure hook of “gnome-characters” snap if present
Undone 4 days ago, at 12:20 BST today at 09:36 BST Run health check of “gnome-characters” snap
Hold 4 days ago, at 12:20 BST today at 09:36 BST Consider re-refresh of “skype”, “gnome-3-34-1804”, “gnome-3-28-1804”, “gnome-characters”

There are quite a few tasks whose operation is on hold. Not sure if they are what caused the issue?

Here, Hold just means that the task has dependencies which never finished before being aborted so the task will never be run.

I don’t see any tasks with Error, so it’s unclear to me what might be the issue here. Can you show the output of snap changes again please?

The snap changes command returns the same information as before:

ID Status Spawn Ready Summary
116 Undone 4 days ago, at 12:20 BST today at 10:36 BST Auto-refresh 4 snaps
117 Undone today at 09:33 BST today at 09:35 BST Remove “micropad” snap
118 Done today at 09:37 BST today at 09:37 BST Remove “micropad” snap
119 Done today at 09:37 BST today at 09:37 BST Refresh all snaps: no updates

Running snap refresh --time says there is a scheduled auto-refresh in an hour or so. I’ll therefore, wait and see what happens in an hour, and post an update.