12

While trying to upgrade Ubuntu from 16.04 to 18.04 I get the following output:

Connection to Snap Store failed

Your system does not have a connection to the Snap Store. For the best upgrade experience make sure that your system can connect to api.snapcraft.io. Do you still want to continue with the upgrade?

Continue [yN]

I would like to fix this before updating. I can find similar problems described online, but they all seem to be caused by snapcraft.io being temporarily down which is not the case right now according to status.snapcraft.io.

(edit: One of these similar problems is Problem with snap store which is mentioned in the comments below as a possible duplicate, but as that question contains very little info it is difficult to know whether the problem is the same and no answers are given that are helpful in my case.)

If I try to run

snap install hello

I get

net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

error: unable to contact snap store

There is nothing wrong with my internet connection. snap version gives me

snap 2.36.3

snapd 2.36.3

series 16

ubuntu 16.04

kernel 4.15.0-43-generic

Any ideas on what might be the problem and how to fix it?

4
  • 3
    Possible duplicate of Problem with snap store
    – N0rbert
    Jan 2, 2019 at 9:47
  • 3
    @N0bert: So this is one of the similar problems I mention where it seems that the problem was caused by snapcraft.io being down. But the error mentioned in that post is the same and the poster never accepted an answer. So what do I do when neither "That solved my problem" or "No, my question is different." really applies?
    – AstridNeu
    Jan 2, 2019 at 10:06
  • 1
    i fixed this by using an external http proxy with snapd.
    – eadmaster
    Dec 17, 2019 at 14:55
  • I keep getting error: unable to contact snap store. I don't think it's an issue with their server, so the answer on that question suggesting it was temporary isn't true.
    – apaderno
    Jan 26, 2020 at 8:45

2 Answers 2

13

For me it was a proxy problem:

I couldn't remember that I set those (its funny how many places there are to set proxies...), but anyway clearing the proxies solved my problem when I changed to an environment without a proxy:

sudo snap set system proxy.http=""
sudo snap set system proxy.https=""
2
  • Pay attention to use the full url containing http, it will fail when missing. With http://<proxy_addr>:<proxy_port>: error: cannot install "core": Post https://api.snapcraft.io/v2/snaps/refresh: dial tcp: lookup api.snapcraft.io on 10.48.220.7:53: no such host , but it works with http://<proxy_addr>:<proxy_port>: 2021-12-02T13:15:57+01:00 INFO Waiting for automatic snapd restart... core 16-2.52.1 from Canonical✓ installed
    – Cadoiz
    Dec 2, 2021 at 12:43
  • This answer worked for me when upgrading from 20.04 lts to v22.04 lts. I had to set my proxy settings directly for snap. My proxy environment variables weren't enough. Oddly enough, (after setting the proxy settings for snap) if I did a snap refresh snapd it reported that snapd wasn't installed, when it actually was. However, the upgrade worked and it connected properly to api.snapcraft.io. I later found this is a known bug that has been out there for a few years.
    – G_Style
    Sep 22, 2022 at 13:48
6

I also got the similar error while updating from 18.04.4 LTS to 20.04 LTS yesterday.

Following worked for me:

snap refresh snapd
systemctl restart snapd

Note: If you get the error snap snapd is not installed, then first install snapd and then try executing above mentioned commands.

Hope this helps.

1
  • 3
    Same problem, same solution (thank you). I got the error snap snapd is not installed and tried to apt get snapd, which said it was already installed. So I ignored, typed systemctl restart snapd and tried again to upgrade. It worked.
    – neclepsio
    Apr 25, 2020 at 8:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .