Snap left in unusable state after failure to refresh

I’ve had a report over on GitHub about the GIMP snap being broken. It seems this is the result of a failed refresh:

May 03 15:00:38 wfranklin-laptop snapd[1134]: taskrunner.go:271: [change 162 "Download snap \"gnome-3-38-2004\" (39) from channel \"stable\"" task] failed: download too slow: >
May 03 15:00:39 wfranklin-laptop snapd[1134]: store_download.go:169: Cannot download or apply deltas for gimp: download too slow: 0.00 bytes/sec
May 03 15:01:35 wfranklin-laptop snapd[1134]: backend.go:575: remove late for snap gimp (347) type app

Hm the refresh should have been undone and the old revision of gimp restored. Maybe a content interface connection was not restored though? IIRC @pstolowski investigated something similar in the past.

1 Like

Hmm if the download failed (stalled / was too slow) then there is almost nothing to be undone since download is the first thing we do and we never get to switching to the new snap. It’s too bad the problematic change is no longer available in that report, maybe we would have more context :confused:

The first two errors from the log signify download problem (btw, ‘download too slow’ means the download stalled and didn’t make any progress in the last few minutes); the third message is interesting because I wouldn’t expect this to be executed for failed gimp refresh. I need to dig a bit more to understand how this could even happen.

I think the failure was due to gimp updating and attempting to pull a new content snap (the base changed from core18 to core20 in this update) but the content snap failing.

1 Like

Ah of course, the first message is about gnome snap, not gimp (facepalm). I need to dig in anyway. Thanks.

1 Like

In attempt to reproduce and understand it, I created two tests: https://github.com/snapcore/snapd/pull/10243

It turns out that install/refresh that fails on downloading of a prerequisite snap (in the above case gnome platform snap is a prerequisite for gimp snap due to content interface) doesn’t prevent the “content consuming” snap from install/refresh (even though snap install/refresh command reports an error for the entire operation). This is currently “by design”, i.e. content interface dependency is a “soft” dependency (discussed this briefly with @pedronis on IRC).

This creates the above problem for gimp+gnome, because as far as I understand this partial refresh leaves gnome with core18 base, while gimp gets refreshed with base20. I’m not sure if such combination can work until both gnome and gimp agree on their base; I don’t have an easy way to test this, but if you still have old versions of these snaps around, then it should be possible to test manually by forcing old revision of gnome snap (while having latest gimp).

Does this explanation make sense?