← Back to issue list

patchelf warning / binary segfaults

View original Launchpad issue

Metadata

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

Current evaluation

PatchELF corrupted Go-built Telegraf classic snaps into runtime segfaults; no-patchelf avoided the crash, but a 2019 Snapcraft 3.8 reproduction remains unverified on current code.

Suggested action: keep open

Reason: A maintainer explicitly acknowledged the PatchELF problem, disabling it made Telegraf run, and a later commenter supplied a yaml and logs reproducing the failure on Snapcraft 3.8. PatchELF handling still exists in the current codebase, so this valid ELF-corruption report should remain open, but the old 2.40/3.8 evidence needs validation against current code before a fix can be scoped.

Evaluated by: mr-cal-bot

Impact: 52 Quick Win: 12 Complexity: 58 Confidence: 84 Actionability: 57

Issue body

Hi, I'm trying to snap telegraf (https://github.com/influxdata/telegraf), which is written in go. At the prime step, I get the following messages: [...] Priming telegraf patchelf: cannot find section '' Failed to update '/home/ubuntu/git/dev/telegraf/prime/bin/telegraf'. Retrying after stripping the .note.go.buildid from the elf file. Snapping 'telegraf' - Snapped telegraf_1.5.2_amd64.snap After installing and running the snap, it quickly enters Failed state (inactive (dead) (Result: core-dump)). syslog messages: https://pastebin.canonical.com/p/vzy6Pk9m5z/ dmesg: https://pastebin.canonical.com/p/PQJXM7n8Cv/ systemd service configuration (automatically generated): https://pastebin.canonical.com/p/qDp7ZbSwGN/ snapcraft file: https://pastebin.canonical.com/p/FQYWBWy25N/ This is using the stable snapcraft snap, 2.39.2 rev 1177 at the moment. The same problem does not happen with snapcraft 2.34+17.10 (deb from archives on an artful machine). This look very similar to lp:1736861, which is 'fix released'. I tried using snapcraft from --channel edge/patchelf-go. Got a warning: Files in this part are going to be patched to execute correctly on diverse environments. To disable this behavior set `build-attributes: [no-patchelf]` for the part. After adding `build-attributes: [no-patchelf]` the snap built and ran successfully, but I'm pretty sure the patchelf step is needed for the snap to run correctly on all the machines where it should be able to. Thanks.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 52
Quick Win: 12
Complexity: 58
Confidence: 84
Actionability: 57
keep open PatchELF corrupted Go-built Telegraf classic snaps into runtime segfaults; no-patchelf avoided the crash, but a 2019 Snapcraft 3.8 reproduction remains unverified on current code.
stealth/space-bunny-alpha
Impact: 60
Quick Win: 19
Complexity: 65
Confidence: 86
Actionability: 90
close resolved Telegraf's patchelf section warning led to snap core dumps across Snapcraft 2.39-3.8; later Go-specific patchelf and ELF relinking work addresses this failure mode.
qwen/qwen3.6-35b-a3b
Impact: 30
Quick Win: 24
Complexity: 20
Confidence: 90
Actionability: 100
close resolved Patchelf fails on Go binaries due to .note.go.buildid, causing segfaults. This was fixed by commits fa8b7b174 and e39d2404c which strip the buildid and update patchelf for Go.
qwen/qwen3.8-27b
Impact: 25
Quick Win: 15
Staleness: 95
Complexity: 40
Confidence: 70
Support Request: 10
close stale 2018 report: snapcraft 2.39.2 patchelf step warns 'cannot find section' on a Go binary (telegraf) and the resulting snap segfaults (core-dump). No maintainer response. Referenced LP bug lp:1736861 is closed as resolved. Affected version long superseded.
qwen/qwen3.6-35b-a3b
Staleness: 98
Complexity: 30
Confidence: 90
Support Request: 10
close stale User reports patchelf warnings and segfaults when building a Go binary with snapcraft 2.39.2. Issue is over 8 years old with no maintainer response or labels.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 30
Confidence: 90
Support Request: 10
close stale Reports patchelf warnings and segfaults when building a Go snap with snapcraft 2.39.2. Currently inactive for over 6 years with no maintainer response or labels.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 40
Confidence: 90
Support Request: 20
close stale Report of patchelf warnings and telegraf binary segfaults during snapcraft build using version 2.39.2. Issue is over 8 years old with no maintainer interaction or labels.

Update history

Date Change
created

Related work

  • Related To: snapcraft (launchpad)#1736861 (confidence 96%)

    The reporter explicitly identified this as similar; that earlier issue addressed the same PatchELF 'cannot find section' failure for Go binaries.

  • Related To: snapcraft#1798 (confidence 91%)

    That PR/commit fixed the earlier build-side Go section warning, but the reporter reproduced both the warning and runtime segfault using later Snapcraft 2.40 releases.

Related issues

Issue Project State Summary Similarity
#1760897 Classic confined snap started segfaulting after 2.40 upgrade snapcraft (launchpad) open Classic snap segfaults after snapcraft 2.40 due to upstream patchelf corrupting Go binaries; maintainer pointed to the documented no-patchelf build attribute (upstream NixOS/patchelf#146).
74%
#1669 patchelf with ld-linux from the future snapcraft closed Resolved by commit bdaf0b7f1, which added Snapcraft handling for PatchELF and ELF files when the built glibc/linker does not match the base.
74%
#1798881 patchelf fails on i386 vscode snapcraft (launchpad) open The i386 VS Code build hit a patchelf 0.9 ELF underrun; Snapcraft later changed its Go ELF handling, but the Launchpad issue remains open.
72%
#1736861 classic snap fails to build with "cannot find section" snapcraft (launchpad) closed Snapcraft 2.37's bundled patchelf could not patch gotty for a classic build; maintainers linked NixOS/patchelf#66 and directed users to edge/patchelf-go.
72%
#1805205 Ensure elf patching works correctly with golang created ELF files snapcraft (launchpad) closed Fixed Go ELF patching in snapcore/snapcraft PR #2519 by updating the PatchELF handling used for Go-created binaries.
71%