← 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 mishandled bare-base projects without build-base, producing architecture/platform errors; current models require build-base and fail early during validation.

Suggested action: close resolved

Reason: The reporter's YAML omits build-base, and maintainer @lengau explicitly identified the needed fix as checking that field earlier for base: bare. Current BareCore22Project and BareCore24Project variants require build_base, and snapcraft#5846 (commit 3249bed8e) implements the corrected model selection, preventing the reported core22 get_build_for fallback.

Evaluated by: mr-cal-bot

Impact: 45 Quick Win: 23 Complexity: 42 Confidence: 87 Actionability: 90

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
stealth/space-bunny-alpha
Impact: 45
Quick Win: 23
Complexity: 42
Confidence: 87
Actionability: 90
close resolved Snapcraft 8.3.2 mishandled bare-base projects without build-base, producing architecture/platform errors; current models require build-base and fail early during validation.
qwen/qwen3.6-35b-a3b
Impact: 40
Quick Win: 26
Complexity: 20
Confidence: 85
Actionability: 80
keep open Valid bug where base: bare without build-base causes a confusing RuntimeError instead of a clear validation message. Triaged, with a maintainer suggesting an earlier check for build-base.
qwen/qwen3.8-27b
Impact: 50
Quick Win: 30
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.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: snapcraft#5846 (confidence 84%)

    The model-selection change adds bare project variants keyed by a required build-base, avoiding the invalid core22 architecture path.

Related issues

Issue Project State Summary Similarity
#1839604 build-base seems broken snapcraft (launchpad) open Closed as implemented: current Snapcraft supports `base: bare` with a required `build-base`, including core22/core24/core26, and documents the configuration.
75%
#2728 Base bare snapcraft merged Merged support for the bare Snap base in commit 7aa576658 ("project: support for base bare"), enabling projects to use base: bare.
71%
#1833409 core20: cannot specify a sensible base snapcraft (launchpad) closed Build-base support for building base snaps without a runtime base was implemented in snapcraft PRs #2623 and #2619; LP bug #1835532 tracked the follow-up.
71%
#1857019 cannot build snapd snap with build-base: core w/o base: core snapcraft (launchpad) closed Resolved in Snapcraft 3.10 by skipping ELF dependency checks when no runtime base is set, allowing snapd to use build-base: core.
70%
#4562 Validity of `base` is not checked when using `--destructive-mode` snapcraft closed Base validation in destructive mode was fixed in Snapcraft 8.1 via craft-application 2.0 and canonical/craft-application PR #263.
70%