Hey All,
I’m just starting out with Snapcraft and am unfortunately encountering a seemingly simple issue that I’m having problems resolving. To get started, I’ve begun experimenting with some tutorials laid out in the documentation. In particular, I’m starting with the ROS2 example (https://snapcraft.io/docs/ros2-applications). Every time I try to build the snap, I get this error:
File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_providers/bases/buildd.py", line 617, in _setup_apt
_execute_run(executor, ["apt-get", "update"], verify_network=True)
File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_providers/bases/buildd.py", line 135, in _execute_run
raise NetworkError() from exc
Now an important note is I’m only encountering this error with Core22 variation of this snap. I tested the core20 release and that seems to work fine (ignoring the gpg keyserver error I see but that is a separate problem). I also tested the DOSbox example which uses Core18 and that was able to successfully generate a snap.
Curious to know if anyone has any idea what is causing this or if anyone has a solution? I am on snapcraft 7.3.1 for reference. Also, here is the full stack trace:
xps:~/ros2-talker-listener-core22$ snapcraft
Launching instance... | (48.3s) Traceback (most recent call last):
File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_providers/bases/buildd.py", line 130, in _execute_run
proc = executor.execute_run(
File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_providers/lxd/lxd_instance.py", line 289, in execute_run
return self.lxc.exec(
File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_providers/lxd/lxc.py", line 410, in exec
return runner(final_cmd, **kwargs) # pylint: disable=subprocess-run-check
File "/snap/snapcraft/8931/usr/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['lxc', '--project', 'snapcraft', 'exec', 'local:snapcraft-ros2-talker-listener-on-amd64-for-amd64-28385441', '--', 'env', 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin', 'SNAPCRAFT_MANAGED_MODE=1', 'apt-get', 'update']' returned non-zero exit status 100.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/snap/snapcraft/8931/bin/snapcraft", line 8, in <module>
sys.exit(run())
File "/snap/snapcraft/8931/lib/python3.8/site-packages/snapcraft/cli.py", line 243, in run
_run_dispatcher(dispatcher)
File "/snap/snapcraft/8931/lib/python3.8/site-packages/snapcraft/cli.py", line 219, in _run_dispatcher
dispatcher.run()
File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_cli/dispatcher.py", line 448, in run
return self._loaded_command.run(self._parsed_command_args)
File "/snap/snapcraft/8931/lib/python3.8/site-packages/snapcraft/commands/lifecycle.py", line 259, in run
super().run(parsed_args)
File "/snap/snapcraft/8931/lib/python3.8/site-packages/snapcraft/commands/lifecycle.py", line 132, in run
parts_lifecycle.run(self.name, parsed_args)
File "/snap/snapcraft/8931/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 215, in run
_run_command(
File "/snap/snapcraft/8931/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 256, in _run_command
_run_in_provider(project, command_name, parsed_args)
File "/snap/snapcraft/8931/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 540, in _run_in_provider
with provider.launched_environment(
File "/snap/snapcraft/8931/usr/lib/python3.8/contextlib.py", line 113, in __enter__
return next(self.gen)
File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_providers/lxd/lxd_provider.py", line 126, in launched_environment
instance = launch(
File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_providers/lxd/launcher.py", line 524, in launch
_create_instance(
File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_providers/lxd/launcher.py", line 74, in _create_instance
base_configuration.setup(executor=instance)
File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_providers/bases/buildd.py", line 410, in setup
self._setup_apt(executor=executor, deadline=deadline)
File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_providers/bases/buildd.py", line 617, in _setup_apt
_execute_run(executor, ["apt-get", "update"], verify_network=True)
File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_providers/bases/buildd.py", line 135, in _execute_run
raise NetworkError() from exc
craft_providers.bases.errors.NetworkError: A network related operation failed in a context of no network access.
Verify that the environment has internet connectivity; see https://craft-providers.readthedocs.io/ for further reference.