Randomly I get "failed to inject host's snap 'snapcraft' into target environment." errors
Metadata
Current evaluation
⚠️ This summary may be outdated — the issue content or evaluation prompts have changed since this evaluation was made.
Closed without resolution, likely abandoned due to inactivity. The failure occurs randomly when snapcraft's auto-refresh blocks LXD environment injection. Retrying the build works around the issue. No fix or merge was applied.
Suggested action: —
No scores available.
Issue body
I get errors ramdomly while trying to build core22-based snaps, maybe like 50% of the times:
$ snapcraft
Launching instance... \ (4.5s) Traceback (most recent call last):
File "/snap/snapcraft/8567/lib/python3.8/site-packages/craft_providers/actions/snap_installer.py", line 320, in inject_from_host
executor.execute_run(
File "/snap/snapcraft/8567/lib/python3.8/site-packages/craft_providers/lxd/lxd_instance.py", line 289, in execute_run
return self.lxc.exec(
File "/snap/snapcraft/8567/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/8567/usr/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['lxc', '--project', 'snapcraft', 'exec', 'local:snapcraft-network-manager-on-amd64-for-amd64-50205072', '--', 'env', 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin', 'SNAPCRAFT_MANAGED_MODE=1', 'SNAPCRAFT_BUILD_INFO=y', 'snap', 'install', '/tmp/snapcraft.snap', '--classic']' returned non-zero exit status 10.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/snap/snapcraft/8567/lib/python3.8/site-packages/craft_providers/bases/buildd.py", line 480, in _install_snaps
snap_installer.inject_from_host(
File "/snap/snapcraft/8567/lib/python3.8/site-packages/craft_providers/actions/snap_installer.py", line 328, in inject_from_host
raise SnapInstallationError(
craft_providers.actions.snap_installer.SnapInstallationError: failed to install snap 'snapcraft'
* Command that failed: 'lxc --project snapcraft exec local:snapcraft-network-manager-on-amd64-for-amd64-50205072 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin SNAPCRAFT_MANAGED_MODE=1 SNAPCRAFT_BUILD_INFO=y snap install /tmp/snapcraft.snap --classic'
* Command exit code: 10
* Command standard error output: b'error: snap "snapcraft" has "auto-refresh" change in progress\n'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/snap/snapcraft/8567/lib/python3.8/site-packages/craft_providers/lxd/lxd_provider.py", line 126, in launched_environment
instance = launch(
File "/snap/snapcraft/8567/lib/python3.8/site-packages/craft_providers/lxd/launcher.py", line 176, in launch
base_configuration.warmup(executor=instance)
File "/snap/snapcraft/8567/lib/python3.8/site-packages/craft_providers/bases/buildd.py", line 395, in warmup
self._install_snaps(executor=executor, deadline=deadline)
File "/snap/snapcraft/8567/lib/python3.8/site-packages/craft_providers/bases/buildd.py", line 486, in _install_snaps
raise BaseConfigurationError(
craft_providers.bases.errors.BaseConfigurationError: failed to inject host's snap 'snapcraft' into target environment.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/snap/snapcraft/8567/bin/snapcraft", line 8, in <module>
sys.exit(run())
File "/snap/snapcraft/8567/lib/python3.8/site-packages/snapcraft/cli.py", line 228, in run
_run_dispatcher(dispatcher)
File "/snap/snapcraft/8567/lib/python3.8/site-packages/snapcraft/cli.py", line 204, in _run_dispatcher
dispatcher.run()
File "/snap/snapcraft/8567/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/8567/lib/python3.8/site-packages/snapcraft/commands/lifecycle.py", line 259, in run
super().run(parsed_args)
File "/snap/snapcraft/8567/lib/python3.8/site-packages/snapcraft/commands/lifecycle.py", line 132, in run
parts_lifecycle.run(self.name, parsed_args)
File "/snap/snapcraft/8567/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 208, in run
_run_command(
File "/snap/snapcraft/8567/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 249, in _run_command
_run_in_provider(project, command_name, parsed_args)
File "/snap/snapcraft/8567/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 530, in _run_in_provider
with provider.launched_environment(
File "/snap/snapcraft/8567/usr/lib/python3.8/contextlib.py", line 113, in __enter__
return next(self.gen)
File "/snap/snapcraft/8567/lib/python3.8/site-packages/craft_providers/lxd/lxd_provider.py", line 140, in launched_environment
raise LXDError(str(error)) from error
craft_providers.lxd.errors.LXDError: failed to inject host's snap 'snapcraft' into target environment.
I can usually build by just retrying to run snapcraft.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution, likely abandoned due to inactivity. The failure occurs randomly when snapcraft's auto-refresh blocks LXD environment injection. Retrying the build works around the issue. No fix or merge was applied. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution. The report describes a race condition where snapcraft fails to inject the snap due to an ongoing auto-refresh change. With zero comments and no fix provided, the issue was likely abandoned due to inactivity. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed without resolution. The race condition between snap installation and auto-refresh during environment injection remains unfixed. Workaround involves retrying builds. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1697979 snapcraft fails on initial cleanbuild probe | snapcraft (launchpad) | closed | Closed without resolution. Snapcraft cleanbuild failed due to LXD connection errors when LXD was provided via a third-party snap alias. The report received no comments or fixes and was abandoned. | |
| #1746612 Snapcraft cleanbuild doesn't work if you're not using the LXD snap | snapcraft (launchpad) | closed | Closed without resolution. Snapcraft hardcodes the LXD snap path during cleanbuild, causing failures with deb-installed LXD. The report appears abandoned or superseded by updated Snapcraft versions that dynamically detect LXD installations. | |
| #4443 snapcraft on ARM 64 - stuck at lxd | snapcraft | closed | Resolved in Snapcraft 7.5.4 by implementing a network timeout instead of an infinite loop. The hang was caused by LXD container networking misconfigurations, often due to Docker or VPN conflicts. Closed as fixed. | |
| #1700703 container builds fail after creating the container | snapcraft (launchpad) | closed | Closed without comments or resolution. The LXD id mapping failure during snapcraft container builds was likely abandoned or superseded by newer container build implementations. | |
| #1666735 snapcraft cleanbuild does not work with lxd installed via snap | snapcraft (launchpad) | closed | Closed without resolution or merge. The report notes snapcraft cleanbuild fails to detect LXD installed via snap, suggesting checks via snap list or lxc list instead of apt cache. No fix was implemented or documented. | |
| #1822372 Snapcraft cleanbuild on Arch Linux with LXD - AppArmor permission error | snapcraft (launchpad) | closed | Closed without resolution due to prolonged inactivity. The report detailed an AppArmor permission error during snapcraft cleanbuild on Arch Linux with LXD. No comments or fixes were provided, indicating the issue was abandoned or marked as invalid. | |
| #1866300 snapcraft fails to build core20 snap | snapcraft (launchpad) | closed | Closed without comments or resolution after 74 days. The core20 build failure involving multipass hangs and LXD tracebacks was abandoned. | |
| #1823511 Inject host's core* and snapcraft snaps when using --use-lxd | snapcraft (launchpad) | closed | Closed without implementation. The request to inject host core and snapcraft snaps into LXD builds, matching Multipass behavior, was abandoned due to prolonged inactivity and zero comments. | |
| #1859469 snapcraft lxd + snapd transition in progress | snapcraft (launchpad) | closed | Closed as non-reproducible and abandoned. The snapcraft lxd command failed due to a snapd transition conflict, but the issue was resolved in version 3.8 and later. | |
| #1896820 Snapcraft can't be run against a local or remote LXD project | snapcraft (launchpad) | open | Feature request from the LXD maintainer for snapcraft to support LXD projects (local/remote) for isolated or cluster-based builds. ~6 years old, no labels, zero comments, no maintainer response. Overlaps with remote LXD work tracked in snapcraft#4454. |