LXDError on `pack` in 2.2
Metadata
Current evaluation
Fixed in v2.4.1+. The v2.2.0 LXDError during charmcraft pack resulted from a pydantic validation failure when parsing the LXD instance configuration. Upgrading resolved the issue.
Suggested action: —
No scores available.
Issue body
### Bug Description

### To Reproduce
charmcraft pack
### Environment
installed: 2.2.0 (1171) 59MB classic
```
juju info v0.1
┌──────────────┬────────────────────────────────┐
│ jhack │ 0.3.19.1.2 │
│ python │ 3.10.12 (/bin/python3) │
│ juju-* snaps │ │
│ microk8s │ MicroK8s v1.27.5 revision 5892 │
│ lxd │ 5.17 │
│ multipass │ 1.12.2 │
│ multipassd │ 1.12.2 │
│ os │ Ubuntu 22.04.3 LTS │
│ kernel │ Linux 6.2.0-32-generic x86_64 │
└──────────────┴────────────────────────────────┘
```
### charmcraft.yaml
```shell
# Copyright 2021 Canonical Ltd.
# See LICENSE file for licensing details.
type: charm
bases:
- build-on:
- name: "ubuntu"
channel: "20.04"
run-on:
- name: "ubuntu"
channel: "20.04"
parts:
charm:
charm-binary-python-packages: [ops, PyYAML, cryptography, jsonschema]
```
### Relevant log output
```shell
2023-09-15 09:20:17.192 Executing on host: lxc project list local: --format=yaml
2023-09-15 09:20:17.279 Set LXD instance name to 'charmcraft-alertmanager-k8s-12222867-0-0-amd64'
2023-09-15 09:20:17.279 Executing on host: lxc --project charmcraft list local: --format=yaml
2023-09-15 09:20:17.392 Executing on host: lxc --project charmcraft list local: --format=yaml
2023-09-15 09:20:17.509 Executing in container: lxc --project charmcraft exec local:charmcraft-alertmanager-k8s-12222867-0-0-amd64 -- env PATH=/usr/lo
cal/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin CHARMCRAFT_MANAGED_MODE=1 cat /etc/os-release
2023-09-15 09:20:17.656 Executing in container: lxc --project charmcraft exec local:charmcraft-alertmanager-k8s-12222867-0-0-amd64 -- env PATH=/usr/lo
cal/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin CHARMCRAFT_MANAGED_MODE=1 test -f /etc/craft-instance.conf
2023-09-15 09:20:17.780 Executing on host: lxc --project charmcraft file pull local:charmcraft-alertmanager-k8s-12222867-0-0-amd64/etc/craft-instance.
conf /home/pietro/tmpij8if00t.tmp-craft/tmpfebx9jgv
2023-09-15 09:20:17.862 charmcraft internal error: LXDError(brief='Failed to parse instance configuration file.', details=None, resolution=None)
2023-09-15 09:20:17.863 Traceback (most recent call last):
2023-09-15 09:20:17.863 File "/snap/charmcraft/1171/lib/craft_providers/bases/buildd.py", line 217, in _ensure_instance_config_compatible
2023-09-15 09:20:17.863 config = InstanceConfiguration.load(
2023-09-15 09:20:17.863 File "/snap/charmcraft/1171/lib/craft_providers/bases/instance_config.py", line 126, in load
2023-09-15 09:20:17.863 return cls.unmarshal(data)
2023-09-15 09:20:17.863 File "/snap/charmcraft/1171/lib/craft_providers/bases/instance_config.py", line 82, in unmarshal
2023-09-15 09:20:17.863 return InstanceConfiguration(**data)
2023-09-15 09:20:17.863 File "pydantic/main.py", line 331, in pydantic.main.BaseModel.__init__
2023-09-15 09:20:17.863 pydantic.error_wrappers.ValidationError: 1 validation error for InstanceConfiguration
2023-09-15 09:20:17.863 setup
2023-09-15 09:20:17.863 extra fields not permitted (type=value_error.extra)
2023-09-15 09:20:17.863
2023-09-15 09:20:17.863 The above exception was the direct cause of the following exception:
2023-09-15 09:20:17.863 Traceback (most recent call last):
2023-09-15 09:20:17.863 File "/snap/charmcraft/1171/lib/craft_providers/lxd/lxd_provider.py", line 126, in launched_environment
2023-09-15 09:20:17.863 instance = launch(
2023-09-15 09:20:17.863 File "/snap/charmcraft/1171/lib/craft_providers/lxd/launcher.py", line 176, in launch
2023-09-15 09:20:17.863 base_configuration.warmup(executor=instance)
2023-09-15 09:20:17.863 File "/snap/charmcraft/1171/lib/craft_providers/bases/buildd.py", line 389, in warmup
2023-09-15 09:20:17.863 self._ensure_instance_config_compatible(executor=executor, deadline=deadline)
2023-09-15 09:20:17.863 File "/snap/charmcraft/1171/lib/craft_providers/bases/buildd.py", line 222, in _ensure_instance_config_compatible
2023-09-15 09:20:17.863 raise BaseConfigurationError(
2023-09-15 09:20:17.863 craft_providers.bases.errors.BaseConfigurationError: Failed to parse instance configuration file.
2023-09-15 09:20:17.863
2023-09-15 09:20:17.863 The above exception was the direct cause of the following exception:
2023-09-15 09:20:17.863 Traceback (most recent call last):
2023-09-15 09:20:17.863 File "/snap/charmcraft/1171/lib/charmcraft/main.py", line 184, in main
2023-09-15 09:20:17.863 retcode = dispatcher.run()
2023-09-15 09:20:17.863 File "/snap/charmcraft/1171/lib/craft_cli/dispatcher.py", line 448, in run
2023-09-15 09:20:17.863 return self._loaded_command.run(self._parsed_command_args)
2023-09-15 09:20:17.863 File "/snap/charmcraft/1171/lib/charmcraft/commands/pack.py", line 133, in run
2023-09-15 09:20:17.863 pack_method(parsed_args)
2023-09-15 09:20:17.863 File "/snap/charmcraft/1171/lib/charmcraft/commands/pack.py", line 165, in _pack_charm
2023-09-15 09:20:17.863 charms = builder.run(
2023-09-15 09:20:17.863 File "/snap/charmcraft/1171/lib/charmcraft/instrum.py", line 152, in _f
2023-09-15 09:20:17.863 return func(*args, **kwargs)
2023-09-15 09:20:17.863 File "/snap/charmcraft/1171/lib/charmcraft/commands/build.py", line 292, in run
2023-09-15 09:20:17.863 charm_name = self.pack_charm_in_instance(
2023-09-15 09:20:17.863 File "/snap/charmcraft/1171/lib/charmcraft/commands/build.py", line 357, in pack_charm_in_instance
2023-09-15 09:20:17.863 with self.provider.launched_environment(
2023-09-15 09:20:17.863 File "/snap/charmcraft/1171/usr/lib/python3.8/contextlib.py", line 113, in __enter__
2023-09-15 09:20:17.863 return next(self.gen)
2023-09-15 09:20:17.863 File "/snap/charmcraft/1171/lib/craft_providers/lxd/lxd_provider.py", line 140, in launched_environment
2023-09-15 09:20:17.863 raise LXDError(str(error)) from error
2023-09-15 09:20:17.863 craft_providers.lxd.errors.LXDError: Failed to parse instance configuration file.
2023-09-15 09:20:17.863 Full execution log: '/home/pietro/.local/state/charmcraft/log/charmcraft-20230915-092016.906566.log'
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen3.6-35b-a3b-mtp-q6 | — | — | Fixed in v2.4.1+. The v2.2.0 LXDError during charmcraft pack resulted from a pydantic validation failure when parsing the LXD instance configuration. Upgrading resolved the issue. | |
| qwen/qwen3.6-35b-a3b | — | — | Resolved in version 2.4.1+. The LXDError during charmcraft pack caused by instance configuration parsing failures was fixed. The author confirmed the upgrade eliminated the error, prompting closure. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed in version 2.4.1+. The LXDError during charmcraft pack in v2.2 resulted from an instance configuration parsing failure. The issue was closed after the maintainer confirmed resolution in the newer release. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | charmcraft pack triggers an LXDError in v2.2.0 due to instance configuration parsing. The report was closed after the author verified that upgrading to v2.4.1 resolved the error. The bug is fixed in v2.4.1 and later. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Fixed in version 2.4.1+. The LXDError during charmcraft pack in v2.2 stemmed from an instance configuration parsing failure. The bug was resolved in a later release, and the report was closed after the author confirmed the fix. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #685 charmcraft pack errors with LXDError - Name can only contain alphanumeric and hyphen characters | charmcraft | closed | Resolved as an upstream LXD bug. The error originated from overly strict device name validation in certain LXD revisions. Fixed in LXD 4.23 revision 22525; users should update LXD to restore charmcraft pack functionality. |