Snap refresh failing


#1

Hi,
On the first time (with an out-of-the-box) Ubuntu Core device I try to do snap refresh and get the following result:

Error: cannot refresh: cannot refresh snap-declaration for “tpm2”: Get
https://api.snapcraft.io/api/v1/snaps/assertions/snap-declaration/16/gpXp4JZnUWzybzeOgDEHkHfMUKvCJL7u?max-format=2:
dial tcp: lookup api.snapcraft.io on [::1]:53: read udp [::1]:45649->[::1]:53: read:
connection refused

However if I leave the device powered up and connected to the internet over night it the automatic overnight update works and in the morning when I try snap refresh, I get the result "All snaps up to-date). Nothing else had changed on the device/network environment in the meantime.


#2

I found a suggestion on another forum which seems to partly solve the problem:

So now if I run :
sudo systemctl restart snapd.servcice
And then
snap refresh

The snap refresh works ok.

However it is not a permanent fix as if I wanted to install a new snap I need to run
sudo systemctl restart snapd.servcice
again before each new install/update.

Again if I leave my unit overnight the automatic update seems to fix the issue.


#3

@jenny.murphy the error message dial tcp: lookup api.snapcraft.io on [::1]:53: read udp [::1]:41276->[::1]:53: read: connection refused means that the DNS lookup of api.snapcraft.io failed because the DNS request was sent to a local DNS resolver, and there’s none running on Ubuntu Core 16 (whereas Ubuntu 16.04 Desktop runs dnsmasq as a local DNS cache), hence the “connection refused”. The only condition I’ve found that triggers this is when the device doesn’t have any nameservers configured. Can you please report the output of the following commands when you see a system failing to refresh like this again?

  • cat /etc/resolv.conf

  • nmcli d

If any of the devices are shown are connected, please then run:

  • nmcli c show <connection name> | grep "IP"

Ex. nmcli c show "Wired connection 2"


#4

@awe Thanks for the reply. Unfortunately I don not have access to any “out-of-the-box” units this week. I will check it again next time and get back to you.