Core22 is not working?

My snapcraft.yaml is like this:

name: gaphorin
base: core22
version: '0.1'
summary: Simple 
description: |
  gaphorin is a simple
grade: devel
confinement: devmode

apps:
  gaphorin:
    command: bin/gaphorin
    extensions: [gnome]
    plugs: [home, wayland, desktop]

parts:
  gaphorin:
    plugin: python
    python-packages: [poetry]
    source: .
    override-build: poetry install

And when I try to run it I get this error:

File "/snap/snapcraft/8187/usr/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['lxc', '--project', 'snapcraft', 'exec', 'local:snapcraft-gaphorin-on-amd64-for-amd64-16385051', '--', 'env', 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin', 'SNAPCRAFT_MANAGED_MODE=1', 'apt-get', 'install', '-y', 'gnupg', 'dirmngr', 'git']' returned non-zero exit status 100.

so not sure how to fix this error? Is something missing on my yaml file?? I tried to follow the official documentation for python and GT3 (it’s very outdated by the way!)

I don’t see anything wrong with your snapcraft.yaml. apt-get returning 100 could be a package caching, network, or proxy issue.

What happens if you run snapcraft clean and then try building your snap again?

We need more of the error message from earlier in the output. You’ve cut it off too close to the end of the output. All we can tell from your message is that snapcraft failed to execute an apt-get inside the LXC container, but cannot see why.

1 Like

I did the snapcraft clean and run it again and I still get the same error:

Traceback (most recent call last):
  File "/snap/snapcraft/8187/bin/snapcraft", line 8, in <module>
    sys.exit(run())
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft/cli.py", line 208, in run
    _run_dispatcher(dispatcher)
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft/cli.py", line 197, in _run_dispatcher
    dispatcher.run()
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/craft_cli/dispatcher.py", line 419, in run
    return self._loaded_command.run(self._parsed_command_args)
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft/commands/lifecycle.py", line 247, in run
    super().run(parsed_args)
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft/commands/lifecycle.py", line 120, in run
    parts_lifecycle.run(self.name, parsed_args)
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 202, in run
    _run_command(
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 248, in _run_command
    _run_in_provider(project, command_name, parsed_args)
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 438, in _run_in_provider
    with provider.launched_environment(
  File "/snap/snapcraft/8187/usr/lib/python3.8/contextlib.py", line 113, in __enter__
    return next(self.gen)
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft/providers/_lxd.py", line 151, in launched_environment
    instance = lxd.launch(
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/craft_providers/lxd/launcher.py", line 176, in launch
    base_configuration.warmup(executor=instance)
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft/providers/_buildd.py", line 143, in warmup
    self._setup_snapcraft(executor=executor)
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft/providers/_buildd.py", line 66, in _setup_snapcraft
    executor.execute_run(
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/craft_providers/lxd/lxd_instance.py", line 289, in execute_run
    return self.lxc.exec(
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/craft_providers/lxd/lxc.py", line 329, in exec
    return runner(final_cmd, **kwargs)  # pylint: disable=subprocess-run-check
  File "/snap/snapcraft/8187/usr/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['lxc', '--project', 'snapcraft', 'exec', 'local:snapcraft-gaphorin-on-amd64-for-amd64-16385051', '--', 'env', 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin', 'SNAPCRAFT_MANAGED_MODE=1', 'apt-get', 'install', '-y', 'gnupg', 'dirmngr', 'git']' returned non-zero exit status 100.

Is it possible that you have docker installed?

This can happen due to docker’s networking policies (see a similar problem in charmcraft and a solution from lxd’s documentation)

1 Like

Yes I do have docker, I’ll try to decrypt the command at the end, thanks!

That’s still not enough of the error output. The output from the apt-get call initiated by snapcraft is what we need. You’ve only included the python report that the command failed but not the output from the command that did the failing.