go: runtime: multi-arch build via qemu fails to exec go binary
Go version
go version 1.23.0 linux/arm64
Output of go env in your module/workspace:
I'm unable to provide the output of `go env` as it fails with the same telemetry fork/exec error.
What did you do?
Our automated image build process fails to perform any step that invokes the go binary with the following error:
can't start telemetry child process: fork/exec /usr/local/go/bin/go: invalid argument
The Dockerfile is here, and is being built via a script that invokes docker buildx with multiple platforms, like:
docker buildx build --platform=linux/amd64,linux/arm64 --file 1.23/Dockerfile
It seems that there is something inherent in the qemu arm64 environment that renders go unable to fork itself to complete the telemetry setup. I’m fairly confident it’s something specific to the 1.23 release as 1.22.6 builds successfully using the same setup today.
What did you see happen?
Failures to invoke any go command
What did you expect to see?
A successful install and configuration of go 1.23.0 in a multi-arch docker build.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 16
- Comments: 57 (39 by maintainers)
Commits related to this issue
- It seemed the build problem was caused by a bug in Go toolchain (https://github.com/golang/go/issues/68976). We'll disable bugged `linux/arm64` and `linux/arm` Docker image builds for now to avoid the... — committed to nirui/sshwifty by nirui 2 years ago
- telemetry: do not crash parent if child could not be started Instead of calling log.Fatal if the child could not be started, call log.Print. Various factors in the user's environment could cause the ... — committed to golang/telemetry by matloob 2 years ago
- [internal-branch.go1.23-vendor] telemetry: do not crash parent if child could not be started Instead of calling log.Fatal if the child could not be started, call log.Print. Various factors in the use... — committed to golang/telemetry by matloob 2 years ago
- [release-branch.go1.23] cmd: vendor golang.org/x/telemetry@internal-branch.go1.23-vendor Update x/telemetry to fix #68976 and #68946. Commands run: go get golang.org/x/telemetry@internal-branch.go... — committed to golang/go by prattmic 2 years ago
- cmd: vendor golang.org/x/telemetry@a797f33 Update x/telemetry to fix #68976 and #68946. Commands run: go get golang.org/x/telemetry@a797f33 go mod tidy go mod vendor Fixes #68946 Fixes #68946... — committed to mateusz834/go by findleyr 2 years ago
- [gopls-release-branch.0.16] gopls: update x/telemetry dependency Update x/telemetry to pick up the fixes for golang/go#68976 and golang/go#68946. Commands run (from the gopls module): go get golan... — committed to golang/tools by findleyr 2 years ago
- gopls: update x/telemetry dependency Update x/telemetry to pick up the fixes for golang/go#68976 and golang/go#68946. Commands run (from the gopls module): go get golang.org/x/telemetry@f29ab53 ... — committed to golang/tools by findleyr 2 years ago
- chore (arm): disable arm build for now go 1.23 has a couple issue on arm that is documented here https://github.com/golang/go/issues/68976 Up until this is solved we have to remove arm build because ... — committed to mickael-kerjean/filestash by mickael-kerjean 2 years ago
- fix: Downgrade Go to 1.22.7 due to known ARM docker build bug See https://github.com/golang/go/issues/68976 Signed-off-by: bwplotka <bwplotka@gmail.com> — committed to GoogleCloudPlatform/alertmanager by bwplotka 2 years ago
- fix: Downgrade Go to 1.22.7 due to known ARM docker build bug See https://github.com/golang/go/issues/68976 Signed-off-by: bwplotka <bwplotka@google.com> — committed to GoogleCloudPlatform/prometheus-engine by bwplotka 2 years ago
- fix: downgrade Go to 1.22.7 due to known ARM docker build bug See https://github.com/golang/go/issues/68976 Signed-off-by: bwplotka <bwplotka@google.com> — committed to GoogleCloudPlatform/prometheus-engine by bwplotka 2 years ago
- fix: downgrade Go to 1.22.7 due to known ARM docker build bug See https://github.com/golang/go/issues/68976 Signed-off-by: bwplotka <bwplotka@google.com> — committed to GoogleCloudPlatform/prometheus-engine by bwplotka 2 years ago
- fix: downgrade Go to 1.22.7 due to known ARM docker build bug See https://github.com/golang/go/issues/68976 Signed-off-by: bwplotka <bwplotka@google.com> — committed to GoogleCloudPlatform/prometheus-engine by bwplotka 2 years ago
- fix: downgrade Go to 1.22.7 due to known ARM docker build bug See https://github.com/golang/go/issues/68976 Signed-off-by: bwplotka <bwplotka@google.com> — committed to GoogleCloudPlatform/prometheus-engine by bwplotka 2 years ago
- docker: downgrade static build to Go 1.22 to avoid https://github.com/golang/go/issues/68976 Signed-off-by: deadprogram <ron@hybridgroup.com> — committed to hybridgroup/gocv by deadprogram 2 years ago
- docker: downgrade static build to Go 1.22 to avoid https://github.com/golang/go/issues/68976 Signed-off-by: deadprogram <ron@hybridgroup.com> — committed to hybridgroup/gocv by deadprogram 2 years ago
- docker: downgrade static build to Go 1.22 to avoid https://github.com/golang/go/issues/68976 Signed-off-by: deadprogram <ron@hybridgroup.com> — committed to hybridgroup/gocv by deadprogram 2 years ago
- syscall: use SYS_EXIT_GROUP in CLONE_PIDFD feature check child Inside Google we have seen issues with QEMU user mode failing to wake a parent waitid when this child exits with SYS_EXIT. This bug appe... — committed to golang/go by prattmic 2 years ago
- [release-branch.go1.23] os: add clone(CLONE_PIDFD) check to pidfd feature check clone(CLONE_PIDFD) was added in Linux 5.2 and pidfd_open was added in Linux 5.3. Thus our feature check for pidfd_open ... — committed to golang/go by prattmic 2 years ago
- [release-branch.go1.23] syscall: use SYS_EXIT_GROUP in CLONE_PIDFD feature check child Inside Google we have seen issues with QEMU user mode failing to wake a parent waitid when this child exits with... — committed to golang/go by prattmic 2 years ago
Yeah, I didn’t think closely enough about this initially. I thought the code starting the telemetry subprocess was doing something special, but the real bug here is that any
os.StartProcess/os/execis broken.I have the same problem. I can see the error
can't start telemetry child processin my log, but as you said, it is not fatal, so it is working properly.Unfortunately, now I see the same error @the-hotmann is referring to when I try to use
go installorgo run. That error is fatal (exit code 1).Here is the output of
go install:To reproduce:
EDIT: missing
--platform linux/arm64in the command (lost in the copy-paste)Apologies for that, there was confusion on the status of the backport because this issue wasn’t closed when https://go.dev/cl/592078 went in. Closing now, as there are no more known issues (other than the maybe-Google-specifc https://github.com/golang/go/issues/69259#issuecomment-2376755781).
FWIW, Debian bookworm has QEMU 7.2 in its repository, which is probably why so many people have hit this.
To reproduce this issue:
go.mod:main.go:Dockerfile:Without https://go.dev/cl/592078:
With https://go.dev/cl/592078:
Ah, sorry for the misunderstanding.
@tianon Could you try cherry-picking https://go.dev/cl/592077 and https://go.dev/cl/592078 to see if they fix the issue?
You can get a cherry pick command from Gerrit from the upper right “…” menu -> “Download patch”.
Thanks for the logs. The offending call is:
Flag
0x1000isCLONE_PIDFD. I’d assume that is the flag QEMU is complaining about.What version of QEMU are you using?
CLONE_PIDFDsupport appears to be added in https://github.com/qemu/qemu/commit/895ce8bb534e66ca418dea62ae67a92dccafb2e1 (QEMU 8.0).We test that syscalls
pidfd_openandpidfd_send_signalwork before attempting to useCLONE_PIDFD. In Linux, support of those guarantees support forCLONE_PIDFD, but perhaps not in QEMU?Moved to Go1.24 milestone since this need to be fixed on the main branch first (for Go 1.24), before being considered for backporting. Please use the usual process (https://go.dev/wiki/MinorReleases) to create a separate backport tracking issue in the Go1.23.1 milestone.
@findleyr It’s important that issues in the minor milestones are the backport kind with a CherryPickCandidate label, otherwise we might miss them in our release meeting review. Thanks.
I switched from
multiarch/qemu-user-static(QEMU 7.2) to a custom image with QEMU 9.1 fromdebian:unstableand my multi-arch builds worked seamlessly. Uploaded here for reference: https://github.com/andreadelfino/qemu-user-staticIt’s probably just a workaround, and I still need to extensively test to see if everything downstream works as before.
This is a 1.23 / dev 1.24 bug. Yes, if one is running into this (as I did), they could consider downgrading to 1.22 until 1.23/dev 1.24 is fixed.
Turning off telemetry doesn’t fix it – it’s literally
os/execitself that’s broken (so if it isn’t telemetry triggering it, it’ll be forking thecompileprocess instead), as noted in the last few comments before yours. 🙈@tianon It sounds like this is fixed? I’ll mark this closed.
Tried again, because I noticed I was setting
GOHOST*🙃Got a successful build with those two CLs (cherry-picked exactly as described in my comment above), and the build appears to work correctly:
Yes, I mean this issue shouldn’t be closed by that. This issue affects more than just telemetry.
It looks like
pidfd_open, etc were added in https://github.com/qemu/qemu/commit/cc054c6f139cf54ce8fbefd6fd536f50b4cba694 (QEMU 7.2), prior toCLONE_PIDFD…Related Issues and Documentation
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)