Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#79794 - [containerd] static binaries missing build-id info

Attached to Project: Arch Linux
Opened by Seth Pellegrino (sethp0808) - Wednesday, 27 September 2023, 12:36 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:20 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Santiago Torres (sangy)
Morten Linderud (Foxboron)
Robin Candau (Antiz)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

When I run `file /usr/bin/{containerd,containerd-shim}`, I see:

```
/usr/bin/containerd: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=a4155102a309801bf5a0461585b7d5b32ef5cd8e, for GNU/Linux 4.4.0, stripped
/usr/bin/containerd-shim: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped
```

Additional info:

This is with containerd package v1.7.6-1

I've dug into the build a little bit, and it looks like setting an explicit `-B` flag for the linker (which also implies the PKGBUILD script invents its own build id) leaves the binaries in an "unstripped" state for some reason. The other thing I tried was passing `-linkmode=external`, and that produced a binary with a build-id that crashes when invoked (with a SIGTRAP).

Steps to reproduce:

I noticed this when I attempted to run `debuginfod-find debuginfo /usr/bin/containerd-shim-runc-v2` and it reported:

```
Cannot extract build-id from /usr/bin/containerd-shim-runc-v2: no error
Server query failed: Invalid argument
```

I'm not quite sure where to go next; for now, I've manually built & installed the `containerd-debug` package and that's gotten me access to the symbols I was looking for, but it'd be nice if the regular `debuginfod` infrastructure could be made to work for these binaries too.
This task depends upon

Closed by  Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:20 GMT
Reason for closing:  Moved
Additional comments about closing:  https://gitlab.archlinux.org/archlinux/p ackaging/packages/containerd/issues/2
Comment by loqs (loqs) - Wednesday, 27 September 2023, 15:49 GMT
Have you tried removing EXTRA_LDFLAGS="-buildid=" which was added in [1]?
Edit:
That makes things worse.
SHIM_CGO_ENABLED=1 produces the same result as `-linkmode=external` which is disabled by default [2].
Seems this will be supported at some future point by the internal linker [3].

[1] https://gitlab.archlinux.org/archlinux/packaging/packages/containerd/-/commit/bd8c9a828347bf3ea5370989e871df47c5bfe454
[2] https://github.com/golang/go/issues/17789#issuecomment-258542220
[3] https://github.com/golang/go/issues/41004#issuecomment-1725513970
Comment by Seth Pellegrino (sethp0808) - Thursday, 28 September 2023, 14:22 GMT
Oh, nice find! `-B gobuildid` sure seems like it'd help here. Sounds like the thing to do then is to defer until that flag wends its way into the go toolchain used by the packaging ecosystem?
Comment by Morten Linderud (Foxboron) - Friday, 29 September 2023, 21:30 GMT
The situation isn't great currently. Some of these files needs to be statically built Go files, they simply won't have debug info in the current setup.

Loading...