charmcraft pack errors with LXDError - Name can only contain alphanumeric and hyphen characters
Metadata
Current evaluation
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.
Suggested action: —
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 |
|---|---|---|---|---|
| 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. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Resolved via upstream LXD fix. LXD revisions were overly strict on device naming, causing charmcraft pack failures. Fixed in LXD 4.23 revision 22525+, resolved automatically through snap updates. Temporary workaround was using --destructive mode. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1258 LXDError on `pack` in 2.2 | charmcraft | closed | 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. | |
| #497 charmcraft Pack is not Working | charmcraft | closed | Resolved via user environment fix. The permission error stemmed from running charmcraft as root with root-owned files. Switching to a regular user, adding them to the lxd group, and correcting ownership allowed pack to succeed. No code changes required. | |
| #1640 Incompatibility with latest LXD LTS | charmcraft | closed | charmcraft failed parsing LXD 5.21 LTS version strings due to the appended LTS suffix. The issue was resolved by upgrading craft-providers to 1.23.1 and releasing the fix in charmcraft 2.6.0, now available on stable. | |
| #629 Cannot pack charms with long names | charmcraft | closed | Charm packing failed for long names due to LXC's 63-character limit. The issue was fixed by truncating instance names and appending a hash suffix to prevent collisions. The maintainer confirmed the implementation and closed the issue. |