← Back to issue list

Cannot create a snap with base:bare in destructive mode

View original Github issue

Metadata

Project
snapcraft
Number
#4972
Type
issue
State
open
Author
nhathaway
Labels
Status: Triaged Type: Bug
Created
Updated
Closed

Current evaluation

Snapcraft 8.3.2 fails with 'cannot determine build-for architecture' when building a base:bare snap in destructive mode without build-base. Maintainer confirmed build-base is required for bare and plans an earlier, clearer validation error.

Suggested action: keep open

Reason: Labelled Status: Triaged with maintainer @lengau acknowledging the report and stating 'we need to do here is ensure the existence of build-base gets checked earlier for base: bare so we can provide proper errors.' The reporter confirmed adding build-base: core20 works around it, but the confusing RuntimeError remains unfixed. Docs now state build-base is required for bare, yet no early validation exists in the current code.

Impact: 50 Quick Win: 30.0 Staleness: 55 Complexity: 40 Confidence: 70 Support Request: 20

Issue body

### Bug Description RuntimeError: cannot determine build-for architecture in snapcraft.yaml, if you put in: ``` ... base: bare type: app ... architectures: - build-on: [amd64, arm64] build-for: [arm64] ... ``` It complains that you should use 'platforms' for the 'bare' base and not 'architectures'. ``` Bad snapcraft.yaml content: - 'architectures' keyword is not supported for base 'bare'. Use 'platforms' keyword instead. ``` If you substitute in 'platforms' for 'architectures': ``` platforms: arm64: build-on: [amd64, arm64] build-for: arm64 ``` you get the above runtime error. Looking at /snap/snapcraft/12379/lib/python3.10/site-packages/snapcraft/models/project.py, this error message is produced under core22 which is the base for snapcraft itself. But 'platforms' is for core24 and by implication, also for base:bare. ### To Reproduce snapcraft --destructive-mode ### Environment Building in a docker environment with just everything required to run the snapcraft executable. ``` SNAP=/snap/snapcraft/current SNAP_VERSION=8.3.2 SNAP_NAME=snapcraft SNAP_ARCH=arm64 PATH=$SNAP/usr/bin:$PATH ``` ### snapcraft.yaml ```shell name: my-name base: bare type: app version: '1.0' summary: My summary description: | My description. grade: devel # must be 'stable' to release into candidate/stable channels confinement: devmode # use 'strict' once you have the right plugs and slots platforms: arm64: build-on: [amd64, arm64] build-for: arm64 #architectures: # - build-on: [amd64, arm64] # build-for: [arm64] apps: my-app: command: bin/bash parts: snapcore: # See 'snapcraft plugins' plugin: dump source: mayapp.tar.gz source-type: tar ``` ### Relevant log output ```shell Traceback (most recent call last): File "/snap/snapcraft/12379/lib/python3.10/site-packages/snapcraft/application.py", line 351, in main return app.run() File "/snap/snapcraft/12379/lib/python3.10/site-packages/snapcraft/application.py", line 179, in run return_code = super().run() File "/snap/snapcraft/12379/lib/python3.10/site-packages/craft_application/application.py", line 492, in run dispatcher = self._get_dispatcher() File "/snap/snapcraft/12379/lib/python3.10/site-packages/snapcraft/application.py", line 298, in _get_dispatcher raise errors.ClassicFallback() snapcraft.errors.ClassicFallback During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/snap/snapcraft/current/bin/snapcraft", line 8, in <module> sys.exit(main()) File "/snap/snapcraft/12379/lib/python3.10/site-packages/snapcraft/application.py", line 354, in main return cli.run() File "/snap/snapcraft/12379/lib/python3.10/site-packages/snapcraft/cli.py", line 260, in run _run_dispatcher(dispatcher, global_args) File "/snap/snapcraft/12379/lib/python3.10/site-packages/snapcraft/cli.py", line 233, in _run_dispatcher dispatcher.run() File "/snap/snapcraft/12379/lib/python3.10/site-packages/craft_cli/dispatcher.py", line 487, in run return self._loaded_command.run(self._parsed_command_args) File "/snap/snapcraft/12379/lib/python3.10/site-packages/snapcraft/commands/core22/lifecycle.py", line 266, in run super().run(parsed_args) File "/snap/snapcraft/12379/lib/python3.10/site-packages/snapcraft/commands/core22/lifecycle.py", line 139, in run parts_lifecycle.run(self.name, parsed_args) File "/snap/snapcraft/12379/lib/python3.10/site-packages/snapcraft/parts/lifecycle.py", line 108, in run _run_command( File "/snap/snapcraft/12379/lib/python3.10/site-packages/snapcraft/parts/lifecycle.py", line 181, in _run_command target_arch=project.get_build_for(), File "/snap/snapcraft/12379/lib/python3.10/site-packages/snapcraft/models/project.py", line 971, in get_build_for raise RuntimeError("cannot determine build-for architecture") RuntimeError: cannot determine build-for architecture ``` ### Additional context $ ls /snap/ bin/ core22/ snapcraft/

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 50
Quick Win: 30.0
Staleness: 55
Complexity: 40
Confidence: 70
Support Request: 20
keep open Snapcraft 8.3.2 fails with 'cannot determine build-for architecture' when building a base:bare snap in destructive mode without build-base. Maintainer confirmed build-base is required for bare and plans an earlier, clearer validation error.
qwen/qwen3.6-35b-a3b
Staleness: 85
Complexity: 20
Confidence: 85
Support Request: 10
keep open Bug where base:bare snaps fail in destructive mode due to architecture keyword conflicts and missing build-base validation. Currently triaged, with maintainer suggesting earlier validation checks.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 20
Confidence: 80
Support Request: 10
keep open Snapcraft fails to build snaps with base:bare due to missing build-base validation, causing a runtime error. Maintainer identified the need for earlier validation to provide better error messages. Issue is triaged but inactive.
qwen3.6-35b-a3b-mtp-q6
Staleness: 80
Complexity: 40
Confidence: 75
Support Request: 10
keep open Base:bare snaps fail to build in destructive mode due to missing build-base validation and architecture resolution errors. Status: Triaged. Maintainers plan to add earlier build-base checks to surface clearer error messages.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1839604 build-base seems broken snapcraft (launchpad) open Seven-year-old question about snapcraft rejecting 'base: bare' with 'build-base: core18' via a confusing validation error. No maintainer response; validation was rewritten in snapcraft 8.x, where build-base is now required for bare bases, so the reported combination is now valid.
85%
#1857019 cannot build snapd snap with build-base: core w/o base: core snapcraft (launchpad) closed Closed without resolution or comments. The snapcraft TypeError when using build-base: core without base: core remains unresolved.
73%
#4562 Validity of `base` is not checked when using `--destructive-mode` snapcraft closed Resolved in snapcraft 8.1 via craft-application 2.0 and canonical/craft-application#263. Base validity is now enforced during destructive-mode builds, blocking invalid or unreleased bases.
73%
#4737 Specifying nonstandard base results in strange error message snapcraft open Snapcraft 8.x reports a misleading 'architectures keyword not supported for base foo' error when snapcraft.yaml declares an invalid base, instead of an invalid-base error. No maintainer response; only a Jira sync bot comment.
72%
#1752538 Building snap using base-18 is broken with 2.39 snapcraft (launchpad) closed snapcraft 2.39 broke base-18 builds on bionic due to shebang expansion and missing LD_LIBRARY_PATH. The report was closed without resolution, likely abandoned or superseded by newer base versions.
72%
#1860550 Defining base snap breaks snapping Subiquity snapcraft (launchpad) open Subiquity snap build with base: core18 leaves /snap/bin empty and snapd stuck seeding in ISO; works without base keyword. Reported ~6.5 years ago with zero comments; core18 is EOL and snapcraft 8.x rewrote base handling, so it is no longer applicable.
71%