← Back to issue list

library linter fails on foreign archs and can't be disabled for core20

View original Github issue

Metadata

Project
snapcraft
Number
#4373
Type
issue
State
open
Author
alexclewontin
Labels
Status: Triaged Type: Bug
Created
Updated
Closed
—

Current evaluation

Cross-arch core20 builds still lint foreign ELF files, causing missing-loader failures or QEMU segfaults and potentially 20+ GB core dumps; open PR #6249 proposes the fix.

Suggested action: keep open

Reason: The report provides an exact snapcraft.yaml, command, environment, and failure logs, while the current linter uses the host architecture triplet without first checking each ELF's target machine. PR #6249 implements that architecture check and is open and approved, so the valid, triaged bug remains unresolved pending merge.

Evaluated by: mr-cal-bot

Impact: 62 Quick Win: 38 Complexity: 35 Confidence: 96 Actionability: 95

Issue body

### Bug Description When building a snap that includes ELF files that target a foreign arch (i.e. not the build machine's arch), snapcraft still attempts to lint the library deps and fails. The way in which it fails differs depending on whether the lib is ubuntu archive built, or self-built. I haven't been able to pin down what the exact difference is, but in the self-built case, the failures present as SEGFAULTS in qemu-static, which generate core dumps which can take up 20+ gigabytes of disk space in a real-world use case. Not a RCA, but to mitigate the issue, on base: core22, this can be worked around by disabling linting (since even in the best case the linting isn't working). On base: core20, there is no real mitigation because linting cannot be disabled. ### To Reproduce Build the attached snapcraft.yaml using --use-lxd ### Environment Ubuntu 22.04 snapcraft 7.5.2 Built with --use-lxd ### snapcraft.yaml ```shell name: my-snap-name # you probably want to 'snapcraft register <name>' base: core20 # the base snap is the execution environment for this snap version: '0.1' # just for humans, typically '1.2+git' or '1.3.2' summary: Single-line elevator pitch for your amazing snap # 79 char long summary description: | This is my-snap's description. You have a paragraph or two to tell the most important story about your snap. Keep it under 100 words though, we live in tweetspace and your description wants to look good in the snap store. grade: devel # must be 'stable' to release into candidate/stable channels confinement: devmode # use 'strict' once you have the right plugs and slots architectures: - build-on: [ amd64 ] run-on: arm64 package-repositories: - type: apt architectures: [ arm64 ] components: [ main, universe ] suites: [ focal, focal-security, focal-updates, focal-backports ] key-id: F6ECB3762474EDA9D21B7022871920D1991BC93C url: http://ports.ubuntu.com/ubuntu-ports parts: a-part: plugin: nil stage-packages: - jq:arm64 my-part: plugin: dump source: ./my-compiled-elfs ``` ### Relevant log output ```shell # When the files come from the ubuntu archive ... Priming jq + snapcraftctl prime not a dynamic executable not a dynamic executable Unable to determine library dependencies for '/root/prime/usr/lib/aarch64-linux-gnu/libjq.so.1.0.4' not a dynamic executable not a dynamic executable aarch64-binfmt-P: Could not open '/lib/ld-linux-aarch64.so.1': No such file or directory Unable to determine library dependencies for '/root/prime/usr/bin/jq' ... # When it is self-built Priming my-part + snapcraftctl prime not a dynamic executable not a dynamic executable aarch64-binfmt-P: Could not open '/lib/ld-linux-aarch64.so.1': No such file or directory Unable to determine library dependencies for '/root/prime/usr/bin/my-bin' not a dynamic executable not a dynamic executable qemu: uncaught target signal 11 (Segmentation fault) - core dumped Unable to determine library dependencies for '/root/prime/usr/lib/my-lib.so' ``` ### Additional context _No response_

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 62
Quick Win: 38
Complexity: 35
Confidence: 96
Actionability: 95
keep open Cross-arch core20 builds still lint foreign ELF files, causing missing-loader failures or QEMU segfaults and potentially 20+ GB core dumps; open PR #6249 proposes the fix.
qwen/qwen3.6-35b-a3b
Impact: 75
Quick Win: 33
Complexity: 45
Confidence: 85
Actionability: 80
keep open Library linter fails on foreign arch ELF files and cannot be disabled for core20 base. Maintainer suggested checking target arch via readelf.
qwen/qwen3.8-27b
Impact: 50
Quick Win: 22
Staleness: 45
Complexity: 55
Confidence: 70
Support Request: 5
keep open Snapcraft's library linter fails on foreign-arch ELF files (cross-compile) and cannot be disabled on core20, causing build failures and multi-GB core dumps. Triaged with a maintainer note to check ELF target arch; no fix landed yet.
qwen/qwen3.6-35b-a3b
Staleness: 60
Complexity: 45
Confidence: 95
Support Request: 5
keep open Cross-architecture ELF library linting fails with segfaults in qemu-static. Issue is triaged, has a maintainer-suggested fix, and an internal Jira ticket, but remains open awaiting implementation.
qwen3.6-35b-a3b-mtp-q6
Staleness: 80
Complexity: 35
Confidence: 85
Support Request: 0
keep open Library linter fails on foreign architectures and cannot be disabled for core20 bases. Triaged bug with a maintainer-suggested fix, but inactive for over a year.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/snapcraft#6249 (confidence 98%)

    Open maintainer PR adds host ELF-machine detection and skips foreign-architecture files in the library linter.

Related issues

Issue Project State Summary Similarity
#6249 fix(linter): skip foreign-arch ELF files in library linter snapcraft open Maintainer PR adding elf_machine to _ArchConfig and get_host_elf_machine() so the library linter skips foreign-arch ELF files, avoiding QEMU/binfmt crashes on cross-arch builds. Approved, core CI green; only CLA and OSV-scanner fail.
78%
#1996206 Linter is checking against host libs when using --build-for argument snapcraft (launchpad) open Cross-architecture builds may lint arm64 libraries against x86_64 core22 paths; the report remains open, unlabelled, and untriaged without a confirmed fix.
72%
#3151 cli: disable --target-arch support on core20 snapcraft merged Merged PR #3151 as commit 8942d89d2, disabling --target-arch for core20 because cross-compilation had limitations; architecture targeting was deferred pending better --build-on support.
71%