Charmcraft pack is giving error frequently
Metadata
Current evaluation
The failure was traced to external LXD networking blocking access to archive.ubuntu.com during snapd installation; no Charmcraft fix was merged, and the reported firewall workaround did not help.
Resolution: closed not a bug
Reason: The apt output reported “Connection failed” while downloading snapd, and maintainers directed the reporter to a networking troubleshooting discussion rather than a code fix. The issue was closed without a resolving PR or commit.
Evaluated by: mr-cal-bot
No scores available.
Issue body
Hello Team,
we are facing issue frequently , with charmcraft pack , below is the error snapshot.
could you please help us here ?
```
charmcraft pack -v
```
**Error details**
```
Failed to setup snapd.
* Command that failed: 'lxc --project charmcraft exec local:charmcraft-spgwu-2075093-0-0-amd64 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin CHARMCRAFT_MANAGED_MODE=1 apt-get install -y snapd'
* Command exit code: 100
* Command output: b'Reading package lists...\nBuilding dependency tree...\nReading state information...\nSuggested packages:\n zenity | kdialog\nRecommended packages:\n gnupg\nThe following packages will be upgraded:\n snapd\n1 upgraded, 0 newly installed, 0 to remove and 84 not upgraded.\nNeed to get 30.4 MB of archives.\nAfter this operation, 106 kB disk space will be freed.\nErr:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 snapd amd64 2.51.1+20.04ubuntu2\n Connection failed [IP: 91.189.88.152 80]\n'
* Command standard error output: b'E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/s/snapd/snapd_2.51.1+20.04ubuntu2_amd64.deb Connection failed [IP: 91.189.88.152 80]\nE: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?\n' (full execution logs in /home/ubuntu/snap/charmcraft/common/charmcraft-log-cmamghf_)
Traceback (most recent call last):
File "/snap/charmcraft/603/lib/craft_providers/bases/buildd.py", line 511, in _setup_snapd
executor.execute_run(
File "/snap/charmcraft/603/lib/craft_providers/lxd/lxd_instance.py", line 206, in execute_run
return self.lxc.exec(
File "/snap/charmcraft/603/lib/craft_providers/lxd/lxc.py", line 307, in exec
return runner(final_cmd, **kwargs) # pylint: disable=subprocess-run-check
File "/snap/charmcraft/603/usr/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['lxc', '--project', 'charmcraft', 'exec', 'local:charmcraft-spgwu-2075093-0-0-amd64', '--', 'env', 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin', 'CHARMCRAFT_MANAGED_MODE=1', 'apt-get', 'install', '-y', 'snapd']' returned non-zero exit status 100.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/snap/charmcraft/603/lib/charmcraft/main.py", line 347, in main
retcode = dispatcher.run()
File "/snap/charmcraft/603/lib/charmcraft/main.py", line 332, in run
return self.command.run(self.parsed_args)
File "/snap/charmcraft/603/lib/charmcraft/commands/pack.py", line 124, in run
self._pack_charm(parsed_args)
File "/snap/charmcraft/603/lib/charmcraft/commands/pack.py", line 155, in _pack_charm
builder.run(parsed_args.bases_index, destructive_mode=build_args.destructive_mode)
File "/snap/charmcraft/603/lib/charmcraft/commands/build.py", line 357, in run
charm_name = self.pack_charm_in_instance(
File "/snap/charmcraft/603/lib/charmcraft/commands/build.py", line 412, in pack_charm_in_instance
with launched_environment(
File "/snap/charmcraft/603/usr/lib/python3.8/contextlib.py", line 113, in __enter__
return next(self.gen)
File "/snap/charmcraft/603/lib/charmcraft/providers.py", line 253, in launched_environment
instance = lxd.launch(
File "/snap/charmcraft/603/lib/craft_providers/lxd/launcher.py", line 173, in launch
base_configuration.setup(executor=instance)
File "/snap/charmcraft/603/lib/charmcraft/providers.py", line 313, in setup
super().setup(executor=executor, retry_wait=retry_wait, timeout=timeout)
File "/snap/charmcraft/603/lib/craft_providers/bases/buildd.py", line 272, in setup
self._setup_snapd(executor=executor, deadline=deadline)
File "/snap/charmcraft/603/lib/craft_providers/bases/buildd.py", line 540, in _setup_snapd
raise BaseConfigurationError(
craft_providers.bases.errors.BaseConfigurationError: Failed to setup snapd.
* Command that failed: 'lxc --project charmcraft exec local:charmcraft-spgwu-2075093-0-0-amd64 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin CHARMCRAFT_MANAGED_MODE=1 apt-get install -y snapd'
* Command exit code: 100
* Command output: b'Reading package lists...\nBuilding dependency tree...\nReading state information...\nSuggested packages:\n zenity | kdialog\nRecommended packages:\n gnupg\nThe following packages will be upgraded:\n snapd\n1 upgraded, 0 newly installed, 0 to remove and 84 not upgraded.\nNeed to get 30.4 MB of archives.\nAfter this operation, 106 kB disk space will be freed.\nErr:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 snapd amd64 2.51.1+20.04ubuntu2\n Connection failed [IP: 91.189.88.152 80]\n'
* Command standard error output: b'E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/s/snapd/snapd_2.51.1+20.04ubuntu2_amd64.deb Connection failed [IP: 91.189.88.152 80]\nE: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?\n'
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed not a bug | The failure was traced to external LXD networking blocking access to archive.ubuntu.com during snapd installation; no Charmcraft fix was merged, and the reported firewall workaround did not help. | |
| stealth/space-bunny-alpha | — | closed not a bug | Closed as an LXD networking problem: the container could not reach archive.ubuntu.com to install snapd. No Charmcraft code fix was made; maintainers pointed to external troubleshooting guidance. | |
| stealth/space-bunny-alpha | — | closed not a bug | Closed without a code fix after an external LXD networking failure blocked snapd installation; the reporter’s firewall workaround also failed. | |
| stealth/space-bunny-alpha | — | closed not a bug | Closed without a Charmcraft fix after LXD networking blocked snapd installation; the reporter's Docker firewall workaround did not restore connectivity. | |
| stealth/space-bunny-alpha | — | closed not a bug | User-reported intermittent 'Failed to setup snapd' errors during charmcraft pack. Maintainers pointed to a Charmhub Discourse thread; no code fix, closed as host/LXD networking problem. | |
| stealth/space-bunny-alpha | — | closed stale | Closed without a code fix after an external LXD networking failure blocked snapd installation; the reporter’s firewall workaround also failed. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Charmcraft pack failed due to an apt-get network error installing snapd in an LXD container. Maintainers linked it to a known networking issue. The reporter confirmed a workaround failed. Closed without a code fix, likely abandoned. | |
| qwen/qwen3.6-35b-a3b | — | — | Charmcraft pack failed due to apt-get connection errors installing snapd in an LXD container. Maintainers suggested a forum workaround, but the user reported it failed. The issue was closed without resolution, indicating it was abandoned. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Abandoned and closed without resolution. charmcraft failed to fetch snapd via apt inside an LXD container due to network errors. A suggested iptables workaround failed, and no fix was provided. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #815 charmcraft pack fails - connection timed out could not connect | charmcraft | closed | User-reported charmcraft pack failure was a local host/network problem (archive.ubuntu.com/security.ubuntu.com unreachable during apt cache update in the LXD build container). Author rebooted their machine and packing worked again, then self-closed the issue. | |
| #92 Suddenly getting charmcraft internal error with charmcraft pack | craft-providers | closed | Resolved upstream in LXD 4.23 revision 22525+, which corrected overly strict device-name validation; `snap revert lxd` was a temporary workaround. | |
| #511 `charmcraft pack` fails running `apt update` | charmcraft | closed | Closed with no Charmcraft code change: maintainers determined the `apt update` failure came from a broken host/LXD (fan bridge) networking setup, not a Charmcraft bug; guidance posted to Charmhub Discourse and the LXD forum. | |
| #823 more transparency for container build in first charmcraft pack | charmcraft | closed | Firewall-blocked LXD setup hung `charmcraft pack` indefinitely on instance network setup. No charmcraft change needed; maintainer tracked the missing timeout in craft-providers and closed the issue. | |
| #749 Charmcraft pack crashed with `cannot install all requested build packages` | charmcraft | closed | Transient Ubuntu archive outage (HTTP 404 fetching zlib1g_1.2.11) made apt fail inside the build container; retry after `charmcraft clean` succeeded. Maintainer facundobatista closed it as out of charmcraft's control, asking for recurring logs. | |
| #660 `charmcraft pack` fails with error writing to lxd unix socket | charmcraft | closed | A transient LXD socket timeout stopped packing; `charmcraft clean` restored operation, the error did not recur, and the reporter closed the report without a code fix. | |
| #646 Failed to inject host Charmcraft snap into target environment | charmcraft | closed | Report of charmcraft 1.4.0 failing to inject the host snap into the LXD build env. Closed without a code fix: a user fixed it with `charmcraft clean --verbose` and lengau closed it in Jan 2024 as not reproducible on current versions. | |
| #2816 `charmcraft pack` fails on Resolute | charmcraft | open | charmcraft pack fails on Ubuntu Resolute 26.04 hosts when using a Jammy 20.04 build base: snapd inside the LXD build instance cannot reload snap-confine AppArmor profiles; no maintainer response yet. | |
| #1594 Running `charmcraft pack` fails and returns `Instance setup failed. Check LXD logs for more details` | charmcraft | closed | Closed as an environment conflict, not a Charmcraft defect: Docker had changed networking in a way that interfered with LXD, and the reporter confirmed that uninstalling Docker and restarting fixed it. | |
| #1260 Charmcraft hangs or fails with LXD 5.18 | charmcraft | closed | LXD released a fix for the 5.18 image lookup failure; Charmcraft’s separate edge retry hang was fixed by craft-providers#415 (commit da95d03). |