← Back to issue list

Snapcraft cleanbuild doesn't work if you're not using the LXD snap

View original Launchpad issue

Metadata

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

Current evaluation

Closed after the missing hostfs behavior was fixed upstream in lxc/lxd#4183. Snapcraft PR #1912 offered a workaround but was not merged.

Resolution: closed resolved

Reason: Maintainer sergiusens closed the report on 2019-02-07 after stating that it was fixed upstream. The failure was attributed to LXD defect lxc/lxd#4183; snapcore/snapcraft#1912 provided an unmerged workaround.

Evaluated by: mr-cal-bot

No scores available.

Issue body

I have the LXD deb (v2.21 specifically), not the snap. As of edge, Snapcraft no longer cleanbuilds: $ snapcraft cleanbuild Creating snapcraft-unaffrightedly-sleekiest-tatyana Starting snapcraft-unaffrightedly-sleekiest-tatyana Waiting for a network connection... Network connection established Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB] Get:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB] Get:4 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB] Get:5 http://security.ubuntu.com/ubuntu xenial-security/main Sources [107 kB] Get:6 http://archive.ubuntu.com/ubuntu xenial/main Sources [868 kB] Get:7 http://security.ubuntu.com/ubuntu xenial-security/restricted Sources [2116 B] Get:8 http://security.ubuntu.com/ubuntu xenial-security/universe Sources [49.3 kB] Get:9 http://archive.ubuntu.com/ubuntu xenial/restricted Sources [4808 B] Get:10 http://security.ubuntu.com/ubuntu xenial-security/multiverse Sources [1520 B] Get:11 http://archive.ubuntu.com/ubuntu xenial/universe Sources [7728 kB] Get:12 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [435 kB] Get:13 http://security.ubuntu.com/ubuntu xenial-security/main Translation-en [189 kB] Get:14 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [200 kB] Get:15 http://security.ubuntu.com/ubuntu xenial-security/universe Translation-en [102 kB] Get:16 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [3208 B] Get:17 http://security.ubuntu.com/ubuntu xenial-security/multiverse Translation-en [1408 B] Get:18 http://archive.ubuntu.com/ubuntu xenial/multiverse Sources [179 kB] Get:19 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [7532 kB] Get:20 http://archive.ubuntu.com/ubuntu xenial/universe Translation-en [4354 kB] Get:21 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [144 kB] Get:22 http://archive.ubuntu.com/ubuntu xenial/multiverse Translation-en [106 kB] Get:23 http://archive.ubuntu.com/ubuntu xenial-updates/main Sources [291 kB] Get:24 http://archive.ubuntu.com/ubuntu xenial-updates/restricted Sources [2524 B] Get:25 http://archive.ubuntu.com/ubuntu xenial-updates/universe Sources [189 kB] Get:26 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse Sources [7972 B] Get:27 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [710 kB] Get:28 http://archive.ubuntu.com/ubuntu xenial-updates/main Translation-en [295 kB] Get:29 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [579 kB] Get:30 http://archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [234 kB] Get:31 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [16.2 kB] Get:32 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse Translation-en [8052 B] Get:33 http://archive.ubuntu.com/ubuntu xenial-backports/main Sources [3436 B] Get:34 http://archive.ubuntu.com/ubuntu xenial-backports/universe Sources [4904 B] Get:35 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [4840 B] Get:36 http://archive.ubuntu.com/ubuntu xenial-backports/main Translation-en [3220 B] Get:37 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [6612 B] Get:38 http://archive.ubuntu.com/ubuntu xenial-backports/universe Translation-en [3768 B] Fetched 24.7 MB in 15s (1570 kB/s) Reading package lists... Done Reading package lists... Done Building dependency tree Reading state information... Done The following package was automatically installed and is no longer required: libfreetype6 Use 'apt autoremove' to remove it. The following NEW packages will be installed: squashfuse 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Need to get 17.4 kB of archives. After this operation, 54.3 kB of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 squashfuse amd64 0.1.100-0ubuntu1~ubuntu16.04.1 [17.4 kB] Fetched 17.4 kB in 0s (23.7 kB/s) Selecting previously unselected package squashfuse. (Reading database ... 25537 files and directories currently installed.) Preparing to unpack .../squashfuse_0.1.100-0ubuntu1~ubuntu16.04.1_amd64.deb ... Unpacking squashfuse (0.1.100-0ubuntu1~ubuntu16.04.1) ... Processing triggers for man-db (2.7.5-1) ... Setting up squashfuse (0.1.100-0ubuntu1~ubuntu16.04.1) ... Looking up assertion ['account-key', 'public-key-sha3-384=BWDEoaqyr25nF5SNCvEv2v7QnM9QsfCc0PBMYD_i2NGSQ32EF2d4D0hqUel3m8ul'] Looking up assertion ['snap-declaration', 'snap-name=core'] Looking up assertion ['snap-revision', 'snap-revision=3978', 'snap-id=99T7MUlRhtI3U0QFgl5mXXESAiSwt776'] error: open /var/lib/snapd/hostfs/home/kyrofa/snap/lxd/common/snapcraft25s084xz/core_3978.assert: no such file or directory Stopping local:snapcraft-unaffrightedly-sleekiest-tatyana Traceback (most recent call last): File "/snap/snapcraft/1076/bin/snapcraft", line 11, in <module> load_entry_point('snapcraft==2.38', 'console_scripts', 'snapcraft')() File "/snap/snapcraft/1076/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 565, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/snap/snapcraft/1076/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2631, in load_entry_point return ep.load() File "/snap/snapcraft/1076/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2291, in load return self.resolve() File "/snap/snapcraft/1076/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2297, in resolve module = __import__(self.module_name, fromlist=['__name__'], level=0) File "/snap/snapcraft/1076/lib/python3.6/site-packages/snapcraft/cli/__main__.py", line 43, in <module> run(prog_name='snapcraft') File "/snap/snapcraft/1076/lib/python3.6/site-packages/click/core.py", line 722, in __call__ return self.main(*args, **kwargs) File "/snap/snapcraft/1076/lib/python3.6/site-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/snap/snapcraft/1076/lib/python3.6/site-packages/click/core.py", line 1066, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/snap/snapcraft/1076/lib/python3.6/site-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File "/snap/snapcraft/1076/lib/python3.6/site-packages/click/core.py", line 535, in invoke return callback(*args, **kwargs) File "/snap/snapcraft/1076/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 218, in cleanbuild lifecycle.cleanbuild(project_options, remote) File "/snap/snapcraft/1076/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_containers.py", line 68, in cleanbuild metadata=config.get_metadata(), remote=remote).execute() File "/snap/snapcraft/1076/lib/python3.6/site-packages/snapcraft/internal/lxd/_containerbuild.py", line 162, in execute with self._container_running(): File "/snap/snapcraft/1076/usr/lib/python3.6/contextlib.py", line 82, in __enter__ return next(self.gen) File "/snap/snapcraft/1076/lib/python3.6/site-packages/snapcraft/internal/lxd/_containerbuild.py", line 81, in _container_running with self._ensure_started(): File "/snap/snapcraft/1076/usr/lib/python3.6/contextlib.py", line 82, in __enter__ return next(self.gen) File "/snap/snapcraft/1076/lib/python3.6/site-packages/snapcraft/internal/lxd/_containerbuild.py", line 96, in _ensure_started self._ensure_container() File "/snap/snapcraft/1076/lib/python3.6/site-packages/snapcraft/internal/lxd/_cleanbuilder.py", line 50, in _ensure_container self._inject_snapcraft(new_container=True) File "/snap/snapcraft/1076/lib/python3.6/site-packages/snapcraft/internal/lxd/_containerbuild.py", line 224, in _inject_snapcraft self._inject_snap('core', tmp_dir) File "/snap/snapcraft/1076/lib/python3.6/site-packages/snapcraft/internal/lxd/_containerbuild.py", line 284, in _inject_snap ], tmp_dir) File "/snap/snapcraft/1076/lib/python3.6/site-packages/snapcraft/internal/lxd/_containerbuild.py", line 357, in _inject_assertions self._push_file(filepath, container_filename) File "/snap/snapcraft/1076/lib/python3.6/site-packages/snapcraft/internal/lxd/_containerbuild.py", line 306, in _push_file src, '{}{}'.format(self._container_name, dst)]) File "/snap/snapcraft/1076/usr/lib/python3.6/subprocess.py", line 291, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['lxc', 'file', 'push', '/home/kyrofa/snap/lxd/common/snapcraft25s084xz/core_3978.assert', 'local:snapcraft-unaffrightedly-sleekiest-tatyana/run/core_3978.assert']' returned non-zero exit status 1. Note the path: /var/lib/snapd/hostfs/home/kyrofa/snap/lxd/common/snapcraft25s084xz/core_3978.assert . Particularly the `home/kyrofa/snap/lxd` part: it's assuming I have the LXD snap installed, and dying because I don't.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Closed after the missing hostfs behavior was fixed upstream in lxc/lxd#4183. Snapcraft PR #1912 offered a workaround but was not merged.
stealth/space-bunny-alpha — closed resolved Snapcraft’s deb-installed LXD cleanbuild failure was traced to LXD #4183 and closed after the upstream defect was fixed. Snapcraft PR #1912 was only an unmerged workaround.
stealth/space-bunny-alpha — closed stale Closed without a documented fix; the Launchpad record reports no resolving PR or commit for deb-installed LXD.
qwen/qwen3.6-35b-a3b — — Closed without documented resolution. Snapcraft cleanbuild fails with deb-installed LXD due to hardcoded paths assuming the LXD snap layout. No fix was provided.
qwen/qwen3.6-35b-a3b — — Closed without resolution. Snapcraft hardcodes the LXD snap path during cleanbuild, causing failures with deb-installed LXD. The report appears abandoned or superseded by updated Snapcraft versions that dynamically detect LXD installations.
qwen/qwen3.6-35b-a3b — — Closed without resolution. Snapcraft cleanbuild fails when using LXD deb due to a hardcoded path assumption requiring the LXD snap.
qwen3.6-35b-a3b-mtp-q6 — — Closed without resolution. The bug stems from Snapcraft hardcoding the LXD snap directory path, breaking cleanbuild for deb-installed LXD. The report appears abandoned or superseded by updated container handling in later releases.

Update history

Date Change
created

Related work

  • Likely Fixed By: lxd#4183 (confidence 99%)

    The upstream LXD defect caused the missing hostfs path, and maintainers confirmed it was fixed upstream.

  • Related To: snapcore/snapcraft#1912 (confidence 96%)

    This Snapcraft PR was proposed as a workaround but was not merged.

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.
81%
#1839399 snapcraft not pulling snap from lxd container snapcraft (launchpad) open Snapcraft 3.7.1 reported a successful --use-lxd build but left the generated snap absent on the host; a maintainer identified possible CWD handling, and the case remains unresolved.
77%
#1788654 snapcraft cleanbuild doesn't work with cross-compile stage-packages snapcraft (launchpad) closed Closed as an obsolete legacy cleanbuild/LXD issue after a maintainer directed users to migrate to bases; no targeted cross-architecture fix was recorded.
76%
#1703344 snapcraft cleanbuild exits with a traceback when lxd is not installed snapcraft (launchpad) closed Fixed cleanbuild’s traceback when LXD is absent by handling the missing lxc executable and reporting a clear error. Merged in snapcraft#1400.
76%
#5420 Snapcraft 7 fails to launch a LXD container based on host apt sources entries snapcraft closed Closed as a duplicate of canonical/snapcraft#4408; no separate fix was made for this report.
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%
#5 Snapcraft should be able to run in clean environment with pbuilder/cowbuilder snapcraft closed Cowbuilder/pbuilder support was abandoned in favor of clean LXC/LXD builds; --use-lxd later merged in canonical/snapcraft#2509 via 067024732.
75%
#1866300 snapcraft fails to build core20 snap snapcraft (launchpad) closed Closed without a documented fix after core20 Multipass/LXD failures; core20 build-base support was unavailable and the workaround was destructive mode.
74%
#1822372 Snapcraft cleanbuild on Arch Linux with LXD - AppArmor permission error snapcraft (launchpad) closed LP #1822372 closed as not-a-bug/stale: reporter resolved the AppArmor error with an LXD profile workaround (security.nesting/privileged, raw.lxc cgroup lines); maintainer later closed it noting cleanbuild was removed as builds are clean by default.
74%
#1570706 Snapcraft cleanbuild command doesn't work snapcraft (launchpad) closed Fixed by merged canonical/snapcraft PR #458 (f78b1e3a3), which corrected Cleanbuilder constructor arguments so snapcraft cleanbuild could initialize its container.
74%