← Back to issue list

snapcraft fails to run if it is installed as a try snap

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1892551
Type
issue
State
open
Author
~anonymouse67
Labels
—
Created
Updated
Closed
—

Current evaluation

Snapcraft 4.1.5 failed in LXD builds when launched via snap try because snapd cannot export a try-snap file; the affected legacy provider is absent from the current codebase.

Suggested action: close stale

Reason: The report provides an exact snap try command and a traceback ending in a 400 from /v2/snaps/snapcraft/file; Sergiusens acknowledged it as a known bug requiring snapd work that affected few developers. The current tree has no push_host_snap or snap_injector path and its lifecycle code now uses Craft Application, so the historical LXD self-injection implementation has been removed; this is obsolete, not verified as fixed.

Evaluated by: mr-cal-bot

Impact: 28 Quick Win: 4 Complexity: 75 Confidence: 87 Actionability: 64

Issue body

if you install a version of snapcraft via try mode, i.e. `snap try --classic squashfs-root` for an unpacked snapcraft snap, it fails to run because it can't download the snapcraft snap file: ``` 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Waiting for network to be ready... 2020-08-21T16:56:10Z INFO Waiting for automatic snapd restart... core 16-2.45.3.1 from Canonical✓ installed "core" switched to the "latest/stable" channel core18 20200807 from Canonical✓ installed "core18" switched to the "latest/edge" channel Sorry, an error occurred in Snapcraft: 400 Client Error: Bad Request for url: http+unix://%2Frun%2Fsnapd.socket/v2/snaps/snapcraft/file We would appreciate it if you anonymously reported this issue. No other data than the traceback and the version of snapcraft in use will be sent. Would you like to send this error data? (Yes/No/Always/View) [no]: yes Thank you, sent. You can find the traceback in file '/tmp/tmpn2l6zob_/trace.txt'. ``` Traceback (most recent call last): File "/snap/snapcraft/x1/bin/snapcraft", line 33, in <module> sys.exit(load_entry_point('snapcraft==4.1.5.post12+gitfbd93aaa', 'console_scripts', 'snapcraft')()) File "/snap/snapcraft/x1/lib/python3.6/site-packages/click/core.py", line 829, in __call__ return self.main(*args, **kwargs) File "/snap/snapcraft/x1/lib/python3.6/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/snap/snapcraft/x1/lib/python3.6/site-packages/click/core.py", line 1236, in invoke return Command.invoke(self, ctx) File "/snap/snapcraft/x1/lib/python3.6/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "/snap/snapcraft/x1/lib/python3.6/site-packages/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "/snap/snapcraft/x1/lib/python3.6/site-packages/click/decorators.py", line 21, in new_func return f(get_current_context(), *args, **kwargs) File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/cli/_runner.py", line 132, in run snap_command.invoke(ctx) File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/cli/_command.py", line 88, in invoke return super().invoke(ctx) File "/snap/snapcraft/x1/lib/python3.6/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "/snap/snapcraft/x1/lib/python3.6/site-packages/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 354, in snap _execute(steps.PRIME, parts=tuple(), pack_project=True, output=output, **kwargs) File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 116, in _execute project=project, echoer=echo, build_provider_flags=build_provider_flags File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/internal/build_providers/_base_provider.py", line 87, in __enter__ self.create() File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/internal/build_providers/_lxd/_lxd.py", line 284, in create self.launch_instance() File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/internal/build_providers/_base_provider.py", line 259, in launch_instance self._setup_snapcraft() File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/internal/build_providers/_lxd/_lxd.py", line 470, in _setup_snapcraft super()._setup_snapcraft() File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/internal/build_providers/_base_provider.py", line 470, in _setup_snapcraft snap_injector.apply() File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/internal/build_providers/_snap.py", line 394, in apply snap.push_host_snap(file_pusher=self._file_pusher) File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/internal/build_providers/_snap.py", line 141, in push_host_snap snap_path=snap_file_path, assertion_path=assertion_file_path File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/internal/repo/snaps.py", line 198, in local_download snap_file_iter = _get_local_snap_file_iter(self.name, chunk_size=1024) File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/internal/repo/snaps.py", line 373, in _get_local_snap_file_iter snap_file.raise_for_status() File "/snap/snapcraft/x1/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http+unix://%2Frun%2Fsnapd.socket/v2/snaps/snapcraft/file This is expected as you cannot download the snap file for a try mode snap: https://github.com/snapcore/snapd/blob/f964a2817cbc0a61aface6104768b6a80c00a2ca/daemon/api_snap_file.go#L63-L65

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 28
Quick Win: 4
Complexity: 75
Confidence: 87
Actionability: 64
close stale Snapcraft 4.1.5 failed in LXD builds when launched via snap try because snapd cannot export a try-snap file; the affected legacy provider is absent from the current codebase.
stealth/space-bunny-alpha
Impact: 35
Quick Win: 7
Complexity: 72
Confidence: 92
Actionability: 68
keep open Snapcraft installed with snap try crashes while LXD setup requests its own snap file through snapd. Maintainers acknowledge it as known and unresolved; a later matching report remains open.
stealth/space-bunny-alpha
Impact: 35
Quick Win: 7
Complexity: 72
Confidence: 90
Actionability: 70
keep open Snapcraft cannot run when installed with `snap try` because snapd cannot export the try-mode snap for build-instance injection; maintainer-confirmed but limited to Snapcraft developers.
stealth/space-bunny-alpha
Impact: 30
Quick Win: 7
Complexity: 68
Confidence: 88
Actionability: 78
keep open Snapcraft installed with snap try cannot start a container build because host-snap injection requests the unavailable /v2/snaps/snapcraft/file endpoint; the bug is acknowledged and unresolved.
qwen/qwen3.6-35b-a3b
Impact: 20
Quick Win: 14
Complexity: 10
Confidence: 90
Actionability: 80
close not a bug snapcraft fails when run from a snap try environment because snapd blocks fetching the snap file for try-mode snaps, preventing self-injection into build providers.
qwen/qwen3.8-27b
Impact: 25
Quick Win: 14
Staleness: 95
Complexity: 45
Confidence: 55
Support Request: 10
needs triage Snapcraft 4.x fails when installed via 'snap try': the LXD build provider tries to download the host snapcraft snap file from snapd, which returns 400 for try snaps. Unlabelled, 0 comments, ~6 years old, never triaged.
qwen/qwen3.6-35b-a3b
Staleness: 98
Complexity: 10
Confidence: 90
Support Request: 80
close not a bug Running snapcraft via 'snap try' fails because snapd does not support fetching snap files for try-mode snaps. The issue is ~6 years old with no maintainer response.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 15
Confidence: 90
Support Request: 75
close not a bug Reports snapcraft failing when installed via snap try due to an expected 400 error fetching the snap file. Author acknowledges this is a known snap try limitation. No maintainer response in ~6 years.
qwen3.6-35b-a3b-mtp-q6
Staleness: 98
Complexity: 15
Confidence: 90
Support Request: 75
close not a bug Snapcraft fails when run from a snap try installation because it attempts to fetch its own snap file via snapd, which is blocked for try mode snaps. Unlabelled and inactive for nearly six years.

Update history

Date Change
created

Related work

  • Related To: snapcraft (launchpad)#2014963 (confidence 94%)

    Later open report describes the same snap try failure and targets the removed legacy LXD self-injection path.

Related issues

Issue Project State Summary Similarity
#2014963 Snapcraft fails to build snap if Snapcraft itself is installed using `snap try` snapcraft (launchpad) open `snap try` Snapcraft could not self-inject into legacy LXD builds because snapd cannot download a try snap; the affected provider is removed, but current behavior needs retesting.
89%
#1795827 Snapcraft doesn't install snapcraft inside the lxd container snapcraft (launchpad) open Historical LXD builds failed because Snapcraft was not injected into the container; the modern Craft Providers LXD path injects Snapcraft and resolves the legacy failure.
76%
#2524 Snapcraft try snapcraft merged Merged snapcraft try via PR #2524 (commit ec579eaa1); LXD tests were split out because they require Snapcraft installed from the store.
76%
#1996508 snapcraft try with core22 doesn't support lxd snapcraft (launchpad) closed Core22 support for snapcraft try --use-lxd was added by merged PR snapcore/snapcraft#3981 (commit 2691262b8) and released on edge.
74%
#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.
72%
#1729069 snapcraft container builds with snap try snapcraft (launchpad) closed Closed without a documented fix; snap try failing when container builds are enabled remained unresolved and was abandoned after years of inactivity.
71%
#1878513 using lxd provider on s390 fails snapcraft (launchpad) closed LXD builds on s390 required Snapcraft 4.0 from the candidate channel; the report was later expired after 60 days without activity.
70%