charmcraft pack errors with LXDError - Name can only contain alphanumeric and hyphen characters
Metadata
Current evaluation
Packing failures came from an upstream LXD 4.23 device-name validation regression, fixed in revision 22525 or later; no Charmcraft code change was needed.
Resolution: closed not a bug
Reason: Maintainer facundobatista confirmed that affected LXD revisions were overly strict and that automatic updates fixed the problem in LXD 4.23 revision 22525 or later. Downgrading LXD or using `charmcraft pack --destructive` were temporary workarounds.
Evaluated by: mr-cal-bot
No scores available.
Issue body
Getting this LXD error on every attempt to pack the charm.
Let me know if you need any other info.
Thanks
```bash
15:44 $ charmcraft pack
charmcraft internal error: LXDError(brief="Failed to add disk to instance 'charmcraft-slurmd-216838-0-0-amd64'.", details='* Command that failed: \'lxc --project charmcraft config device add local:charmcraft-slurmd-216838-0-0-amd64 disk-/root/project disk source=/home/bdx/allcode/github/omnivector/slurm-charms/charm-slurmd path=/root/project\'\n* Command exit code: 1\n* Command standard error output: b\'Error: Invalid devices: Device validation failed for "disk-/root/project": Name can only contain alphanumeric and hyphen characters\\n\'', resolution=None)
Full execution log: '/home/bdx/snap/charmcraft/common/cache/charmcraft/log/charmcraft-20220223-154449.556573.log'
✘-1 ~/allcode/github/omnivector/slurm-charms [gpu|✔]
15:45 $ charmcraft version
1.4.0
✔ ~/allcode/github/omnivector/slurm-charms [gpu|✔]
15:45 $ lxc --version
4.23
✔ ~/allcode/github/omnivector/slurm-charms [gpu|✔]
15:45 $ lxd --version
4.23
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed not a bug | Packing failures came from an upstream LXD 4.23 device-name validation regression, fixed in revision 22525 or later; no Charmcraft code change was needed. | |
| stealth/space-bunny-alpha | — | closed resolved | LXD’s overly strict device-name validation broke charmcraft pack; the upstream fix is available in LXD 4.23 revision 22525 or newer. | |
| stealth/space-bunny-alpha | — | closed resolved | Resolved upstream in LXD 4.23 revision 22525, restoring Charmcraft packing after overly strict device-name validation rejected Charmcraft-generated names. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | 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. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed upstream in LXD 4.23 revision 22525+. The error resulted from overly strict device name validation in certain LXD revisions. Users were advised to update LXD or use the --destructive mode workaround. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Fixed in LXD revision 22525+. A temporary device name validation bug in recent LXD snaps caused the LXDError. The LXD project patched the strict validation, resolving the charmcraft pack failure upon updating LXD. |
Update history
No update history recorded yet.
Related work
-
Related To:
canonical/charmcraft#686
(confidence 100%)
The snap-free installation discussion was split into this separate issue.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #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. | |
| #1258 LXDError on `pack` in 2.2 | charmcraft | closed | LXDError from Charmcraft 2.2.0 was reported fixed in 2.4.1+; the reporter confirmed 2.4.1 worked, and the maintainer closed the report in July 2024. | |
| #676 charmcraft build fails with LXD version | charmcraft | closed | User support request: charmcraft build/pack failed with "LXD '3.0.3' does not meet the minimum required version '4.0'". facundobatista confirmed LXD 4.0+ is required by design and suggested --destructive-mode; no code change. | |
| #497 charmcraft Pack is not Working | charmcraft | closed | Packaging succeeded after using the project owner with LXD permissions and cleaning stale state; the reporter confirmed the .charm file was created. | |
| #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. | |
| #1640 Incompatibility with latest LXD LTS | charmcraft | closed | Fixed in Charmcraft 2.6.0 by merged PR #1641 (commit 2248543f), shipping the craft-providers 1.23.1 fix for LXD versions with the LTS suffix; released to stable. | |
| #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. | |
| #560 Charmcraft pack is giving error frequently | charmcraft | closed | 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. |