← Back to issue list

snapcraft cleanbuild exits with a traceback when lxd is not installed

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1703344
Type
issue
State
closed
Author
~frankban
Labels
—
Created
Updated
Closed

Current evaluation

Fixed cleanbuild’s traceback when LXD is absent by handling the missing lxc executable and reporting a clear error. Merged in snapcraft#1400.

Resolution: closed resolved

Reason: Merged canonical/snapcraft#1400 as commit 2a5affc17 added distinct FileNotFoundError handling when lxc is unavailable, resolving the reported cleanbuild crash.

Evaluated by: mr-cal-bot

No scores available.

Issue body

I am using a snapcraft 2.31 on a fresh xenial installation. Here is the traceback: Traceback (most recent call last): File "/usr/bin/snapcraft", line 32, in <module> obj=dict(project=snapcraft.ProjectOptions())) File "/usr/lib/python3/dist-packages/click/core.py", line 716, in __call__ return self.main(*args, **kwargs) File "/usr/lib/python3/dist-packages/click/core.py", line 696, in main rv = self.invoke(ctx) File "/usr/lib/python3/dist-packages/click/core.py", line 1060, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python3/dist-packages/click/core.py", line 889, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/lib/python3/dist-packages/click/core.py", line 534, in invoke return callback(*args, **kwargs) File "/usr/lib/python3/dist-packages/snapcraft/cli/lifecycle.py", line 206, in cleanbuild lifecycle.cleanbuild(project_options, remote) File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle.py", line 353, in cleanbuild metadata=config.get_metadata(), remote=remote).execute() File "/usr/lib/python3/dist-packages/snapcraft/internal/lxd.py", line 170, in __init__ container_name=container_name, remote=remote) File "/usr/lib/python3/dist-packages/snapcraft/internal/lxd.py", line 54, in __init__ remote = _get_default_remote() File "/usr/lib/python3/dist-packages/snapcraft/internal/lxd.py", line 239, in _get_default_remote default_remote = check_output(['lxc', 'remote', 'get-default']) File "/usr/lib/python3.5/subprocess.py", line 626, in check_output **kwargs).stdout File "/usr/lib/python3.5/subprocess.py", line 693, in run with Popen(*popenargs, **kwargs) as process: File "/usr/lib/python3.5/subprocess.py", line 947, in __init__ restore_signals, start_new_session) File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child raise child_exception_type(errno_num, err_msg) FileNotFoundError: [Errno 2] No such file or directory: 'lxc'

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed cleanbuild’s traceback when LXD is absent by handling the missing lxc executable and reporting a clear error. Merged in snapcraft#1400.
stealth/space-bunny-alpha — closed resolved Fixed by merged PR #1400 (commit 2a5affc17), which handles missing LXD/lxc cleanly instead of exposing an uncaught FileNotFoundError traceback.
stealth/space-bunny-alpha — closed stale Launchpad bug #1703344 was closed without a documented fix; no resolving PR or commit was identified for the cleanbuild traceback when lxc is missing.
stealth/space-bunny-alpha — closed resolved Missing LXD now produces a clear error instead of a traceback, fixed by merged PR #1400 (commit 2a5affc17).
qwen/qwen3.6-35b-a3b — — Closed without resolution. Missing LXD caused a FileNotFoundError during snapcraft cleanbuild. No comments, fixes, or status updates were provided.
qwen/qwen3.6-35b-a3b — — Fixed. Added dependency validation for the lxc command to prevent the unhandled FileNotFoundError, replacing the traceback with a clear error message when LXD is missing.
qwen/qwen3.6-35b-a3b — — Abandoned without resolution. The report details a FileNotFoundError crash when running snapcraft cleanbuild without LXD, pointing to missing dependency validation.
qwen3.6-35b-a3b-mtp-q6 — — Closed without comments or resolution. The report was abandoned due to inactivity, though later snapcraft versions added proper LXD dependency checks to prevent this crash.

Update history

Date Change
created

Related work

  • Likely Fixed By: canonical/snapcraft#1400 (confidence 100%)

    PR #1400 directly fixes the missing-LXD failure in commit 2a5affc17.

Related issues

Issue Project State Summary Similarity
#1666735 snapcraft cleanbuild does not work with lxd installed via snap snapcraft (launchpad) closed Fixed by merged canonical/snapcraft#1199 (commit 417989880), making cleanbuild LXD detection packaging-independent instead of relying on apt package metadata.
84%
#1746612 Snapcraft cleanbuild doesn't work if you're not using the LXD snap snapcraft (launchpad) closed Closed after the missing hostfs behavior was fixed upstream in lxc/lxd#4183. Snapcraft PR #1912 offered a workaround but was not merged.
76%
#1752498 cleanbuild fails with lxd snap snapcraft (launchpad) closed Closed as obsolete: the cleanbuild command was removed; Snapcraft builds now perform clean builds by default.
75%
#1689712 snapcraft cleanbuild fails in xenial with the lxd deb: KeyError: 'kernel_architecture' snapcraft (launchpad) closed Fixed Xenial cleanbuild compatibility with older LXD metadata in snapcore/snapcraft PR #1305, merged as commit 8f15f697f.
75%
#1689695 Make the error message when LXC is not found a bit better snapcraft (launchpad) closed Fixed by merged PR canonical/snapcraft#1400 (commit 2a5affc17), adding distinct handling when the lxc executable is unavailable.
74%
#1995877 Python stack trace running snapcraft if lxd is not installed snapcraft (launchpad) closed Fixed by snapcore/snapcraft#3982 (commit 002fa389b), which removed a double emit.pause() call and prevented missing-LDX handling from raising a RuntimeError.
74%
#1655 lxd: distinguish argless clean from clean -s pull snapcraft merged Merged in snapcraft#1655 (ed32603c7), fixing LXD cleanup so bare clean removes build containers while clean -s pull preserves or recreates them.
72%
#1647 lxd: better surfacing of errors snapcraft merged Merged in snapcraft#1647 as commit 71f48bdc9, improving LXD error handling so callers return silent, correctly coded errors without printing messages twice.
72%
#1717413 snapcraft snap with an unexisting dir shows a traceback snapcraft (launchpad) closed Missing-directory handling was fixed to return a clear SnapcraftEnvironmentError instead of a traceback; Launchpad bug #1717413 is closed as Fixed.
71%
#1859469 snapcraft lxd + snapd transition in progress snapcraft (launchpad) closed Fixed in newer Snapcraft releases; Snapcraft 3.9.4's LXD bootstrap could conflict with an in-progress snapd/core transition. Affected 3.9 systems could clear it with `snapcraft clean --use-lxd`.
71%