Error: cannot communicate with server: timeout exceeded while waiting for response

Tried to snap refresh today and it fails.

alan@KinkPad-K450:~$ snap refresh
error: cannot communicate with server: timeout exceeded while waiting for response

Here’s the snap version output.

$ snap version
snap    2.44~pre1+20.04
snapd   2.44~pre1+20.04
series  16
ubuntu  20.04
kernel  5.4.0-14-generic

snapd is running.

$ systemctl status snapd
● snapd.service - Snappy daemon
     Loaded: loaded (/lib/systemd/system/snapd.service; enabled; vendor preset:>
    Drop-In: /etc/systemd/system/snapd.service.d
             └─prio.conf
     Active: active (running) since Thu 2020-02-27 19:32:57 GMT; 16h ago
TriggeredBy: ● snapd.socket
   Main PID: 9183 (snapd)
      Tasks: 18 (limit: 38286)
     Memory: 1.7G
     CGroup: /system.slice/snapd.service
             └─9183 /usr/lib/snapd/snapd

Feb 28 11:49:45 KinkPad-K450 snapd[9183]: snapstate.go:1001: cannot update "coo>
Feb 28 11:49:45 KinkPad-K450 snapd[9183]: snapstate.go:1001: cannot update "vlc>
Feb 28 11:50:44 KinkPad-K450 snapd[9183]: storehelpers.go:438: cannot refresh, >
Feb 28 11:50:44 KinkPad-K450 snapd[9183]: snap has no updates available: "alacr>
Feb 28 11:50:44 KinkPad-K450 snapd[9183]: snap not found: "app-outlet", "cavest>
Feb 28 11:50:44 KinkPad-K450 snapd[9183]: no snap revision available as specifi>
Feb 28 11:50:44 KinkPad-K450 snapd[9183]: Failed to authenticate user.
Feb 28 11:50:44 KinkPad-K450 snapd[9183]: snapstate.go:1001: cannot update "eas>
Feb 28 11:50:44 KinkPad-K450 snapd[9183]: snapstate.go:1001: cannot update "coo>
Feb 28 11:50:44 KinkPad-K450 snapd[9183]: snapstate.go:1001: cannot update "vlc>

Restarting doesn’t work.

$ systemctl restart snapd
$ snap refresh
error: cannot communicate with server: timeout exceeded while waiting for response

What now?

Here’s the requested further output

https://paste.ubuntu.com/p/nxzYHNNK7b/

It was suggested on irc that this is due to me having over 300 snaps installed.

I may have found a workaround. I have a script which purges all old revisions of snaps. I ran that, it purged all those old versions (352 snaps), and now snap refresh works.

$ cat purge_old_snap_revisions.sh 
#!/bin/bash
# Removes old revisions of snaps
# CLOSE ALL SNAPS BEFORE RUNNING THIS
set -eu

snap list --all | awk '/disabled/{print $1, $3}' |
    while read snapname revision; do
        sudo snap remove "$snapname" --revision="$revision"
    done
 snap refresh
All snaps up to date.

That workaround makes me feel dirty. Dirty dirty dirty. The dirt won’t come out!

1 Like

I seem to hit similar issue, and it’s definitely because of too many installed snaps, 12.
I’m trying to start simple one shot service which is just shell script.
Service takes ages to start and there is same error
: error: cannot communicate with server: timeout exceeded while waiting for response
Easy one to test:

$ snap install openhab-ondra
$ sudo systemctl start snap.openhab-ondra.influx-setup
$ sudo systemctl status snap.openhab-ondra.influx-setup

Sorry for reviving this old post, but I am getting this error a lot lately while trying to upgrade (snap refresh).
I guess I have many snap installed, but not a crazy number and I haven’t installed many more lately. It used to work fine…

Any ideas?

Here too. My build system is unable to communicate to the snap store too:

Unable to reach the snap store

Some services are having issues: https://status.snapcraft.io/

1 Like

The weird thing is that I have two PCs in the same network and it works on one and not in the other. And the PC in which snap refresh doesn’t work doesn’t seem to have any internet-related problem.

I still can’t refresh. Any ideas for troubleshooting?

i guess it will take a bit until everything has recovered …

2 Likes

It is working again as of this morning, so it seems to be solved.
Sorry for the noise!

Just had a similar issue whereby snap commands would work. Turned out the system had run out of disk space. Freed some up, rebooted and everything started working again. Not sure if this will help anyone else.

1 Like