Craft-providers error: Timed out waiting for networking to be ready

Hi, I’m following the tutorial for creating a snap (Python apps). I’m working on a native ubuntu desktop 22.04 machine and I make use of a proxy server with IP and port 192.168.137.254:8080. After cloning the “liquidctl” repo in my workspace I created a “snap” folder containing a “snapcraft.yaml” file, identical to the one shown in the tutorial, into the root of the package. Then I ran the command “snapcraft”, but, after around 70 sec of “creating new base instance from remote…”, it fails issuing the following error:

craft-providers error: Timed out waiting for networking to be ready.

Hereafter the log is shown:

2024-02-02 11:16:46.609 Executing on host: lxc --project snapcraft config set local:base-instance-snapcraft-buildd-base-v40--fd08e731c976fdc7c5bc user.craft_providers.timer 2024-02-02T10:16:46.609452+00:00
2024-02-02 11:16:46.696 Set instance timer to '2024-02-02T10:16:46.609452+00:00'
2024-02-02 11:16:46.797 Executing in container: lxc --project snapcraft exec local:base-instance-snapcraft-buildd-base-v40--fd08e731c976fdc7c5bc -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin SNAPCRAFT_MANAGED_MODE=1 http_proxy=http://192.168.137.254:8080/ https_proxy=http://192.168.137.254:8080/ no_proxy=localhost,127.0.0.0/8,::1 getent hosts snapcraft.io
2024-02-02 11:16:46.823 craft-providers error: Timed out waiting for networking to be ready.
2024-02-02 11:16:46.823 Full execution log: '/home/automation/.local/state/snapcraft/log/snapcraft-20240202-111539.362869.log'

It might be useful to know that I’ve already specified the proxy server within the snap environment, through the commands:

sudo snap set system proxy.https="http://192.168.137.254:8080"
sudo snap set system proxy.http="http://192.168.137.254:8080"

Does somebody know what the problem is? If the answer is yes, how can I solve this?

Thank you in advance

Just to build on this…

I’m getting the same error just going through the snap tutorial here: Create your first snap | Ubuntu

My snapcraft.yaml is

name: my-snap-name # you probably want to 'snapcraft register <name>'
base: core22 # the base snap is the execution environment for this snap
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
summary: Single-line elevator pitch for your amazing snap # 79 char long summary
description: |
  This is my-snap's description. You have a paragraph or two to tell the
  most important story about your snap. Keep it under 100 words though,
  we live in tweetspace and your description wants to look good in the snap
  store.

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

parts:
  gnu-hello:
    source: http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz
    plugin: autotools

Running snapcraft -v gives:

Starting Snapcraft 8.0.2                                                                                                      
Logging execution to '/home/dancrumb/.local/state/snapcraft/log/snapcraft-20240203-172840.342932.log'                         
Running on amd64 for amd64                                                                                                    
Launching instance...                                                                                                         
Creating new instance from remote                                                                                             
Creating new base instance from remote                                                                                        
craft-providers error: Timed out waiting for networking to be ready.                                                          
Full execution log: '/home/dancrumb/.local/state/snapcraft/log/snapcraft-20240203-172840.342932.log'               

The log shows lots of

2024-02-03 17:29:50.652 Executing in container: lxc --project snapcraft exec local:base-instance-snapcraft-buildd-base-v40--fd08e731c976fdc7c5bc -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin SNAPCRAFT_MANAGED_MODE=1 getent hosts snapcraft.io

before

2024-02-03 17:29:50.679 craft-providers error: Timed out waiting for networking to be ready.

I’m not doing any kind of special networking.

One thing I noticed was this:

getent hosts snapcraft.io
2620:2d:4000:1::28 snapcraft.io
2620:2d:4000:1::26 snapcraft.io
2620:2d:4000:1::27 snapcraft.io

I see only IPv6 addresses… not sure if that’s relevant

Hi ! @dancrumb . Try to run with the –debug option .

Perhaps your firewall blocks some incoming connections.

I tried both snapcraft --verbosity debug and snapcraft --verbosity trace and in both logs just end in repeated

2024-02-04 07:58:30.102 Executing on host: lxc --project snapcraft config set local:base-instance-snapcraft-buildd-base-v40--fd08e731c976fdc7c5bc user.craft_providers.timer 2024-02-04T13:58:30.102621+00:00                                                                                                        
2024-02-04 07:58:30.245 Set instance timer to '2024-02-04T13:58:30.102621+00:00'                                                                          
2024-02-04 07:58:30.475 Executing in container: lxc --project snapcraft exec local:base-instance-snapcraft-buildd-base-v40--fd08e731c976fdc7c5bc -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin SNAPCRAFT_MANAGED_MODE=1 getent hosts snapcraft.io                               
2024-02-04 07:58:30.845 Executing in container: lxc --project snapcraft exec local:base-instance-snapcraft-buildd-base-v40--fd08e731c976fdc7c5bc -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin SNAPCRAFT_MANAGED_MODE=1 getent hosts snapcraft.io                               
2024-02-04 07:58:31.200 Executing in container: lxc --project snapcraft exec local:base-instance-snapcraft-buildd-base-v40--fd08e731c976fdc7c5bc -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin SNAPCRAFT_MANAGED_MODE=1 getent hosts snapcraft.io                               
2024-02-04 07:58:31.573 Executing in container: lxc --project snapcraft exec local:base-instance-snapcraft-buildd-base-v40--fd08e731c976fdc7c5bc -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin SNAPCRAFT_MANAGED_MODE=1 getent hosts snapcraft.io                               
2024-02-04 07:58:31.939 Executing in container: lxc --project snapcraft exec local:base-instance-snapcraft-buildd-base-v40--fd08e731c976fdc7c5bc -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin SNAPCRAFT_MANAGED_MODE=1 getent hosts snapcraft.io                               
2024-02-04 07:58:32.300 Executing in container: lxc --project snapcraft exec local:base-instance-snapcraft-buildd-base-v40--fd08e731c976fdc7c5bc -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin SNAPCRAFT_MANAGED_MODE=1 getent hosts snapcraft.io \ (2.1s)                      
2024-02-04 07:58:32.669 Executing in container: lxc --project snapcraft exec local:base-instance-snapcraft-buildd-base-v40--fd08e731c976fdc7c5bc -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin SNAPCRAFT_MANAGED_MODE=1 getent hosts snapcraft.io \ (2.5s)                      
2024-02-04 07:58:33.021 Executing in container: lxc --project snapcraft exec local:base-instance-snapcraft-buildd-base-v40--fd08e731c976fdc7c5bc -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin SNAPCRAFT_MANAGED_MODE=1 getent hosts snapcraft.io             

before timing out

I did find a StackOverflow answer that pointed me to https://documentation.ubuntu.com/lxd/en/latest/howto/network_bridge_firewalld/#prevent-connectivity-issues-with-lxd-and-docker which led me to remove Docker.

but again, it gets stuck waiting for the network to be ready.

I dug into the logs some more and saw this:

* Command that failed: 'lxc --project snapcraft info local:base-instance-snapcraft-buildd-base-v40--fd08e731c976fdc7c5bc'
* Command output: b'Name: base-instance-snapcraft-buildd-base-v40--fd08e731c976fdc7c5bc\nLocation: none\nRemote: unix://\nArchitecture: x86_64\nCreated: 2024/02/04 08:14 CST\nStatus: Running\nType: container\nProfiles: default\nPid: 3888\nIps:\n  eth0:\tinet6\tfe80::216:3eff:fe8b:5276\tvethde7d6c84\n  lo:\tinet\t127.0.0.1\n  lo:\tinet6\t::1\nResources:\n  Processes: 5\n  CPU usage:\n    CPU usage (in seconds): 1\n  Memory usage:\n    Memory (current): 16.88MB\n  Network usage:\n    eth0:\n      Bytes received: 948B\n      Bytes sent: 2.92kB\n      Packets received: 8\n      Packets sent: 18\n    lo:\n      Bytes received: 183.17kB\n      Bytes sent: 183.17kB\n      Packets received: 2544\n      Packets sent: 2544\n'             

More clearly:

Name: base-instance-snapcraft-buildd-base-v40--fd08e731c976fdc7c5bc
Location: none
Remote: unix://
Architecture: x86_64
Created: 2024/02/04 08:15 CST
Status: Running
Type: container
Profiles: default
Pid: 13202
Ips:
  eth0: inet6   fe80::216:3eff:feb0:304d        vethfb5fa132
  lo:   inet    127.0.0.1
  lo:   inet6   ::1
Resources:
  Processes: 5
  CPU usage:
    CPU usage (in seconds): 1
  Memory usage:
    Memory (current): 16.88MB
  Network usage:
    eth0:
      Bytes received: 1.05kB
      Bytes sent: 3.30kB
      Packets received: 9
      Packets sent: 19
    lo:
      Bytes received: 78.34kB
      Bytes sent: 78.34kB
      Packets received: 1088
      Packets sent: 1088

Perhaps this is an LXC/snap version mismatch?

I switched to multipass and that seems to have done the trick

@dancrumb okay .

So, is it okay ?

I see snapcraft is passing http_proxy, https_proxy, and no_proxy to the LXD container (3rd line of your log file).

Where did you execute the sudo snap set system proxy.http... commands? On your host or inside the LXD instance? Snapcraft sets those inside the LXD instance automatically.

And @dancrumb is correct about Docker interfering with iptables and causing network issues for LXD. Do you happen to have Docker installed?

Hi @dancrumb,

I haven’t seen snapcraft fail on the lxc --project snapcraft info command before. If you happen to have full logs, will you please provide them? Thanks

Hello, thank you for the feedback everybody, I kind of solved the problem by changing workstation. The pc I currently work on doesn’t have any proxy server (or firewall) configured and now everything is working fine