Error refreshing snapd: unexpectedly empty response from the server


I’m getting a strange error with snap where I can refresh snaps, but not the snapd snap! This is needed by snapcraft (running it usign --use-lxd). This is what I’m getting from inside the lxd 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 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 # snap refresh core20
snap "core20" has no updates available
snapcraft-alusus # snap refresh core18
snap "core18" has no updates available

Refreshing snapd is part of the snapcraft operation, so basically I cannot build snaps now. It was working yesterday so I thought their server is down, but the snapcraft status page is not showing any disruptions.


Hello, welcome to the forums!

I’ve just tried this from a newly created ubuntu:20.04 container and had no issue (snapd refreshed from 2.52.1 to 2.53.2). Perhaps this was a temporary problem, can you re-try and report back?

If the problem persists, could please run snapd manually inside the container like this:

$ sudo systemctl stop snapd.{service,socket} $ sudo SNAPD_DEBUG_HTTP=1 /usr/lib/snapd/snapd then initiate snapd refresh from another terminal and attach the log output of snapd?


Thanks @pstolowski for the reply. Eventually it got updated, but was still broken after you reported it working on your side. Here are the steps I did:

  • Retried few times after you reported it working on your side, was still failing.
  • 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.
  • I followed your steps of stopping the snapd service and starting it again with SNAPD_DEBUG_HTTP=1 then running the refresh from another terminal. Initially it failed, with the same error and nothing logged by snapd. Here is all the logs that was there:
snapcraft-alusus # sudo SNAPD_DEBUG_HTTP=1 /usr/lib/snapd/snapd
AppArmor status: apparmor is enabled and all features are available
AppArmor status: apparmor is enabled and all features are available
2021/11/23 21:26:29.756921 daemon.go:242: started snapd/2.52.1 (series 16; classic; devmode) ubuntu/20.04 (amd64) linux/5.13.0-21-generic.
2021/11/23 21:26:29.765057 daemon.go:335: adjusting startup timeout by 50s (pessimistic estimate of 30s plus 5s per snap)
  • Tried running the refresh one more time, and this time it successfully updated snapd to 2.53.2.

I wonder if it is something related to geographical location or something. I did initially suspect that it could be my router or service provider, so tried switching to my mobile network but got the same error. This was all on Ubuntu 21.10.

Another issue I forgot to mention is that running snap refresh (i.e. without specifying a package) showed All snaps up to date. despite snapd not being up-to-date.

This is due to some throttling applied by the snap store to deal with excess load. See more details here.

Nothing to fix on your side, it’s safe to retry, and as soon as load decreases things should go back to normal if they haven’t already.

  • Daniel
1 Like

Thanks @roadmr, that explains it. Would’ve been good if this was reflected either in snap’s error message or in

Funny enough, I couldn’t reproduce it yesterday and today as I’m trying to iterate with snapcraft over a test snap for something I’m hitting it all the time :face_with_monocle: