Refreshing snapd while running snapcraft fails with empty response from server

Bug #1951910 reported by Sarmad Abdullah
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Fix Released
Undecided
Unassigned

Bug Description

Running `snapcraft --use-lxd` results in the following error:

```
Launching a container.
Waiting for container to be ready
Waiting for network to be ready...
error: cannot refresh "snapd": unexpectedly empty response from the server (try again later)
```

This error is happening from inside the lxd container. The container has internet connectivity as shown from these commands executed manually from within the container:

```
snapcraft-alusus # snap list
Name Version Rev Tracking Publisher Notes
core18 20211028 2253 latest/stable canonical✓ base
core20 20211115 1242 latest/stable canonical✓ base
snapcraft 5.0 6751 latest/stable canonical✓ classic
snapd 2.52.1 13640 latest/stable canonical✓ snapd
snapcraft-alusus # snap refresh snapd
error: cannot refresh "snapd": unexpectedly empty response from the server (try again later)
snapcraft-alusus # snap refresh
All snaps up to date.
snapcraft-alusus # snap refresh core18
snap "core18" has no updates available
snapcraft-alusus # snap refresh core20
snap "core20" has no updates available
snapcraft-alusus # snap refresh snapcraft
snap "snapcraft" has no updates available
snapcraft-alusus # snap refresh snapd
error: cannot refresh "snapd": unexpectedly empty response from the server (try again later)
snapcraft-alusus # apt update
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [876 kB]
Fetched 1103 kB in 2s (579 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
snapcraft-alusus #
```

As you see, only the snapd package is having the issue; other packages can be refreshed successfully. Also, the `apt update` command is running successfully, so there is no connectivity issue.
This issue has been going for hours. I thought the servers could be down, but the issue is only happening with snapd package, and the snapcraft status page is all green.

Is there a way to tell snapcraft to skip refreshing so at least I can unblock myself for now?

description: updated
description: updated
Revision history for this message
Sarmad Abdullah (sarmadka-f) wrote :

Some updates:

* Deleted the container and restarted the snapcraft build, which created a new container. Creating the container was successful and the build was successful.

* Tried the snapcraft command again. This time the container already existed from the previous build. The build failed with the same error.

* Logged in to the container (using `lxc exec <container_name> bash`) and ran `snap list`. It was showing the old version (2.52.1). Apparently, when you run snapcraft on a fresh system it creates the container but doesn’t bother updating it to the latest version, but if it finds an existing container it tries updating it.

* Tried running `snap refresh snapd` few more times, and it finally successfully updated snapd to 2.53.2.

The behavior seems to indicate an issue on the backend, but the confusing part is that other packages could be updated successfully, so it could be an issue specifically with the snapd package. Anyway, it is finally working, but I'll keep an eye on it for the coming few days and report back here if the issue came up again.

Other related questions/issues:
* `snap refresh` (without specifying the package name). Showed that everything is up to date despite snapd not being up to date.
* Running snapcraft on a fresh system creates the container and uses it as is without trying to update snapd. Re-running snapcraft with the existing container results in snapcraft trying to update snapd. Shouldn't snapcraft behavior be the same regardless of whether the container pre-exists?

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

This is fixed as of the latest snapcraft 6.0.2

Changed in snapcraft:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.