LXD errors from Craft Providers not properly presented
Metadata
Current evaluation
Closed. Fixed unhandled LXD installation errors that caused raw Python tracebacks. Updated Craft Providers to surface user-friendly error messages instead of stack traces.
Suggested action: —
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 |
|---|---|---|---|---|
| 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. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed. Fixed by updating Craft Providers to handle LXD installation failures gracefully, replacing Python tracebacks with clear user-facing error messages. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #504 providers: improve error handling (CRAFT-472) | charmcraft | merged | Improved error handling for provider-generated exceptions by adding try/except blocks for LXD and Multipass, chaining exceptions, and adding test coverage. Merged after approval and passing CI checks. | |
| #1098 Correctly capture Craft Providers' LXDError | charmcraft | closed | Craft Providers' LXDError handling was corrected. The issue is closed and resolved in charmcraft 3. |