Charmcraft pack is giving error frequently
Metadata
Current evaluation
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.
Suggested action: —
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 |
|---|---|---|---|---|
| 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 |
|---|---|---|---|---|
| #511 `charmcraft pack` fails running `apt update` | charmcraft | closed | Closed as out of scope. The failure stemmed from an LXD container networking bug, not charmcraft. No code changes were implemented; users were directed to external LXD and Discourse discussions for troubleshooting. | |
| #660 `charmcraft pack` fails with error writing to lxd unix socket | charmcraft | closed | charmcraft pack failed due to an LXD socket I/O timeout. The author closed the issue as the error did not recur after a clean rebuild. No code changes were applied. | |
| #1987 Charmcraft snap fails to install due to a timeout on the configure hook | charmcraft | closed | Fixed in PR #1984 and released. The charmcraft snap configure hook timeout was resolved. Flaky failures occurred when LXD was absent, triggering a transient store download. The issue is closed. | |
| #1594 Running `charmcraft pack` fails and returns `Instance setup failed. Check LXD logs for more details` | charmcraft | closed | Closed after the author confirmed uninstalling Docker resolved the conflict. Docker network settings interfered with LXD, causing charmcraft pack instance setup failures. Restarting the system after removal fixed the environment. | |
| #815 charmcraft pack fails - connection timed out could not connect | charmcraft | closed | charmcraft pack failed due to network timeouts connecting to Ubuntu repositories. Rebooting the host restored connectivity and resolved the error. The author closed the report as self-resolved. | |
| #1104 charmcraft pack on Ubuntu 23.04 (Lunar) fails. | charmcraft | closed | Charmcraft pack failed on Ubuntu 23.04 due to unavailable build environments. PR #1130 addressed the issue but was blocked by an external cloud-images bug. The issue was closed pending upstream resolution. | |
| #1047 Charmcraft stuck on "launching environment" | charmcraft | closed | Resolved by craft-providers 1.8, which now enforces timeouts and verifies network connectivity during LXD environment setup. This prevents indefinite hangs from networking or iptables conflicts, replacing silent failures with actionable error messages. | |
| #646 Failed to inject host Charmcraft snap into target environment | charmcraft | closed | Closed. Maintainer confirmed the issue is resolved in recent Charmcraft versions and cannot be reproduced. A user workaround suggested running charmcraft clean --verbose prior to building. |