LXD errors from Craft Providers not properly presented
Metadata
Current evaluation
Fixed by #4295 (commit 511061252), which catches Craft Providers errors and shows user-friendly messages instead of tracebacks; backported for 7.5 by #4419 (commit 6b2f6d207).
Resolution: closed resolved
Reason: Snapcraft PR #4295 added CLI handling for Craft Providers errors and was merged as commit 511061252. The fix was also merged into hotfix/7.5 through PR #4419 as commit 6b2f6d207, addressing the traceback reported in #4262.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
When there's a Craft Providers error related to running LXD, as a user we get a traceback
### To Reproduce
On a fresh system:
- install snapcraft
- run a core22 snapcraft project
You will be queried to install LXD, and that works well, but we are later presented with an error not being setup.
### Environment
Fresh Ubuntu 22.04.2 LTS
### snapcraft.yaml
```shell
name: foo
version: irrelevant
summary: reproducer
description: will only trigger if LXD has not been configured to work correctly
base: core22
parts:
foo:
plugin: nil
```
### Relevant log output
```shell
sergiusens@imladris:~/projects/snaps/darktable$ snapcraft
LXD is required but not installed. Do you wish to install LXD and configure it with the defaults? [y/N]: y
[sudo] password for sergiusens:
lxd 5.15-002fa0f from Canonical✓ installed
WARNING: There is 1 new warning. See 'snap warnings'.
Traceback (most recent call last):
File "/snap/snapcraft/9362/bin/snapcraft", line 8, in <module>
sys.exit(run())
File "/snap/snapcraft/9362/lib/python3.8/site-packages/snapcraft/cli.py", line 255, in run
_run_dispatcher(dispatcher, global_args)
File "/snap/snapcraft/9362/lib/python3.8/site-packages/snapcraft/cli.py", line 228, in _run_dispatcher
dispatcher.run()
File "/snap/snapcraft/9362/lib/python3.8/site-packages/craft_cli/dispatcher.py", line 448, in run
return self._loaded_command.run(self._parsed_command_args)
File "/snap/snapcraft/9362/lib/python3.8/site-packages/snapcraft/commands/lifecycle.py", line 265, in run
super().run(parsed_args)
File "/snap/snapcraft/9362/lib/python3.8/site-packages/snapcraft/commands/lifecycle.py", line 138, in run
parts_lifecycle.run(self.name, parsed_args)
File "/snap/snapcraft/9362/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 216, in run
_run_command(
File "/snap/snapcraft/9362/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 262, in _run_command
_run_in_provider(project, command_name, parsed_args)
File "/snap/snapcraft/9362/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 487, in _run_in_provider
providers.ensure_provider_is_available(provider)
File "/snap/snapcraft/9362/lib/python3.8/site-packages/snapcraft/providers.py", line 148, in ensure_provider_is_available
LXDProvider.ensure_provider_is_available()
File "/snap/snapcraft/9362/lib/python3.8/site-packages/craft_providers/lxd/lxd_provider.py", line 69, in ensure_provider_is_available
install()
File "/snap/snapcraft/9362/lib/python3.8/site-packages/craft_providers/lxd/installer.py", line 71, in install
raise errors.LXDInstallationError(
craft_providers.lxd.errors.LXDInstallationError: Failed to install LXD: user must be manually added to 'lxd' group before using LXD.
Visit https://linuxcontainers.org/lxd/getting-started-cli/ for instructions on installing and configuring LXD for your operating system.
```
### Additional context
_No response_
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed by #4295 (commit 511061252), which catches Craft Providers errors and shows user-friendly messages instead of tracebacks; backported for 7.5 by #4419 (commit 6b2f6d207). | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed in PR #4419 via commit 6b2f6d207: Craft Providers errors now produce user-friendly CLI messages instead of Python tracebacks. | |
| stealth/space-bunny-alpha | — | closed resolved | Craft Providers errors now produce concise, user-friendly CLI messages instead of tracebacks, via merged PR #4419 (commit 6b2f6d207). | |
| stealth/space-bunny-alpha | — | closed resolved | Craft Providers exceptions now produce user-friendly CLI errors instead of tracebacks; PR #4419 merged commit 6b2f6d207 into hotfix/7.5, backporting #4295/CRAFT-2174. | |
| stealth/space-bunny-alpha | — | closed resolved | Craft Providers errors now show user-friendly messages instead of tracebacks. Fixed by #4295 (511061252) and backported via #4419 (6b2f6d207). | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed in canonical/snapcraft#4419 via commit 6b2f6d207: the CLI now catches Craft Providers errors and presents LXD failures without a Python traceback. | |
| stealth/space-bunny-alpha | — | closed resolved | LXD errors now show user-friendly messages instead of Python tracebacks, fixed in canonical/snapcraft#4419 via commit 6b2f6d207. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed. Fixed unhandled LXD installation errors that caused raw Python tracebacks. Updated Craft Providers to surface user-friendly error messages instead of stack traces. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution or comments. The report detailed raw Python tracebacks instead of user-friendly errors during LXD setup. Likely abandoned. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed. Fixed by replacing raw Python tracebacks with user-friendly LXD setup error messages when manual group configuration is required. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed. Resolved by improving Craft Providers error handling to display user-friendly messages instead of raw tracebacks when LXD setup fails. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/snapcraft#4295
(confidence 100%)
Merged fix adding CLI handling for Craft Providers errors; commit 511061252 states it resolves #4262.
-
Likely Fixed By:
canonical/snapcraft#4419
(confidence 100%)
Merged backport into hotfix/7.5 as commit 6b2f6d207.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1098 Correctly capture Craft Providers' LXDError | charmcraft | closed | Craft Providers' LXDError details were being swallowed and shown as a generic 'charmcraft internal error'. Merged PR #1264 (commit fee3074a) fixed logging to print craft-providers error details; shipped in Charmcraft 3. | |
| #504 providers: improve error handling (CRAFT-472) | charmcraft | merged | Merged PR #504 improved LXD and Multipass provider error handling, chained exceptions, and added tests for CRAFT-472. | |
| #4419 cli: catch craft-provider errors | snapcraft | merged | Merged into hotfix/7.5 as commit 6b2f6d207, adding CLI handling for craft-provider errors; it backported the #4295 fix for CRAFT-2174. | |
| #1512 Improve error message for provider not installed. | charmcraft | open | Improve uninformative 'Provider is required but not installed' prompt to clarify LXD init and what 'y' does; maintainers acknowledge quick fix after craft-providers PR 366. | |
| #4295 cli: catch craft-provider errors | snapcraft | merged | Merged #4295 as commit 511061252, adding CLI handling for craft-provider errors; the PR states it resolves #4262 (CRAFT-1898). |