Snapd "error: 1 servers unreachable" with no proxy

Hi there,

I have privately set up an Ubuntu server and wanted to use it as storage. With the installation was immediately installed nextcloud (as snap). So I thought why not. During the configuration I made a mistake and wanted to reinstall nextcloud via snap. From then on the fun began.
With snap install nextcloud I got the error error: 1 servers unreachable and found thanks to Google this forum entry (Unable to contact snap store). I don’t use proxy, so this doesn’t help me.
After further searching I found this forum entry (Too early for operations [SOLVED]) that files are broken (tl:dr; purge snap and reinstall).
STILL NOTHING!!! well almost nothing:
When installing nextcloud, it always installs snapd and core18 first. snapd first, which goes smoothly to get the data, but when installing the second package it always starts to hang. Manually installing core18 only works now and then with God’s help.

To my dismay that the API of snapcraft is down, I also tried to install nextcloud on another server… without any problems. So it must be something local.

user@server:~$ snap version 
snap    2.49
snapd   2.49
series  16
ubuntu  20.04
kernel  5.4.0-67-generic
user@server:~$ journalctl -u snapd.service
systemd[1]: Starting Snap Daemon...
snapd[13350]: AppArmor status: apparmor is enabled and all features are available
snapd[13350]: AppArmor status: apparmor is enabled and all features are available
snapd[13350]: patch.go:64: Patching system state level 6 to sublevel 1...
snapd[13350]: patch.go:64: Patching system state level 6 to sublevel 2...
snapd[13350]: patch.go:64: Patching system state level 6 to sublevel 3...
snapd[13350]: daemon.go:347: started snapd/2.49 (series 16; classic) ubuntu/20.04 (amd64) linux/5.4.0-67-generic.
snapd[13350]: daemon.go:440: adjusting startup timeout by 35s (pessimistic estimate of 30s plus 5s per snap)
systemd[1]: Started Snap Daemon.
snapd[13350]: taskrunner.go:271: [change 2 "Fetch and check assertions for snap \"core18\" (1988)" task] failed: Get https://api.snapcraft.io/api/v1/s>
snapd[13350]: handlers.go:496: Reported install problem for "core18" as Crash report successfully submitted.
snapd[13350]: 2021/03/21 20:42:15 Unsolicited response received on idle HTTP channel starting with "HTTP/1.0 408 Request Time-out\r\nCache-Control: no>
snapd[13350]: 2021/03/21 20:43:14 Unsolicited response received on idle HTTP channel starting with "HTTP/1.0 408 Request Time-out\r\nCache-Control: no>
snapd[13350]: 2021/03/21 20:43:57 Unsolicited response received on idle HTTP channel starting with "HTTP/1.0 408 Request Time-out\r\nCache-Control: no>
snapd[13350]: 2021/03/21 20:45:58 Unsolicited response received on idle HTTP channel starting with "HTTP/1.0 408 Request Time-out\r\nCache-Control: no>

...

systemd[1]: Starting Snap Daemon...
snapd[2511]: AppArmor status: apparmor is enabled and all features are available
snapd[2511]: AppArmor status: apparmor is enabled and all features are available
snapd[2511]: patch.go:64: Patching system state level 6 to sublevel 1...
snapd[2511]: patch.go:64: Patching system state level 6 to sublevel 2...
snapd[2511]: patch.go:64: Patching system state level 6 to sublevel 3...
snapd[2511]: daemon.go:347: started snapd/2.49 (series 16; classic) ubuntu/20.04 (amd64) linux/5.4.0-67-generic.
snapd[2511]: daemon.go:440: adjusting startup timeout by 35s (pessimistic estimate of 30s plus 5s per snap)
systemd[1]: Started Snap Daemon.
snapd[2511]: taskrunner.go:271: [change 2 "Fetch and check assertions for snap \"core18\" (1988)" task] failed: Get https://api.snapcraft.io/api/v1/sn>
snapd[2511]: handlers.go:496: Reported install problem for "core18" as Crash report successfully submitted.
snapd[2511]: daemon.go:215: polkit error: Authorization requires interaction
snapd[2511]: api.go:383: Installing snap "core18" revision unset
snapd[2511]: 2021/03/22 17:04:54 Unsolicited response received on idle HTTP channel starting with "HTTP/1.0 408 Request Time-out\r\nCache-Control: no->
user@server:~$ sudo snap debug connectivity
Connectivity status:
 * api.snapcraft.io: unreachable
error: 1 servers unreachable
user@server:~$ curl -v api.snapcraft.io
*   Trying 64:ff9b::5bbd:5c28:80...
* TCP_NODELAY set
*   Trying 91.189.92.20:80...
* TCP_NODELAY set
* Connected to api.snapcraft.io (91.189.92.20) port 80 (#0)
> GET / HTTP/1.1
> Host: api.snapcraft.io
> User-Agent: curl/7.68.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Server: gunicorn/19.7.1
< Date: Mon, 22 Mar 2021 18:05:56 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 64
< Snap-Store-Version: 34
< X-View-Name: snapdevicegw.webapi.root
< X-VCS-Revision: e5079f8
< X-Request-Id: 59F52621B3460A325C3900506058DC841291FD23
< 
snapcraft.io store API service - Copyright 2018-2019 Canonical.
* Connection #0 to host api.snapcraft.io left intact

Thanks for the help in advance

I was having problems with building a snap application. The command: snapcraft --debug was failing with the error:

Consider re-refresh of "snapd" (cannot query the store for updates: got unexpected HTTP status code 503 via POST ...

The /var/log/syslog showed the following:

Aug 7 07:49:34 nadir-X551MA snapd[779]: 2021/08/07 07:49:34 Unsolicited response received on idle HTTP channel starting with "HTTP/1.1 408 Re
quest Time-out\r\ncontent-length: 110\r\ncache-control: no-cache\r\ncontent-type: text/html\r\nconnection: close\r\n\r\n<html><body><h1>408 Re
quest Time-out</h1>\nYour browser didn't send a complete request in time.\n</body></html>\n"; err=<nil>

Also apparmor was showing errors related to multipass.

I think the problem I had was related to multipass. multipass is used by snapcraft to build snaps. The log messages in /var/log/syslog showed that multipass is not able to reserve an ip address via DHCP. My local wireless router was configured to allow 6 devices to get an ip address via DHCP. All ip addresses were allocated and new devices could not be assigned an ip address. I increased the range of DHCP addresses and rebooted the router. I also rebooted my local computer. After that the command: snapcraft --debug worked without problems.