buildah
buildah copied to clipboard
allow using buildah via qemu and binfmt form arm 32 platforms
Using buildah via qemu and binfmt ends up in failure....
level=error msg="failure getting variant" error="getCPUInfo for pattern: Cpu architecture: not found" level=error msg="error parsing PID "": strconv.Atoi: parsing "": invalid syntax"
The procedure is basically the mutiarch qemu-user-static guide, using podman to run containers and within the container run buildah with chroot and vfs https://github.com/multiarch/qemu-user-static
Setting manually --platform --arch or --variant do not help
This happens because /proc/cpuinfo remains with the original values of the main kernel (for example, intel CPU info)
One alternative could be to fail gracefully, and have the architecture variant value undefined, rather than exit the program. Another one is using the GOARM value https://zchee.github.io/golang-wiki/GoArm/ Another one being able to fully override that detection with an argument
Please give us buildah info, as well as the exact command that y9ou were executing when you saw the failure.
You request is irrelevant, it is a problem that can be checked on the code directly
Well give me a repeater.
Or open a PR to fix the code.
A friendly reminder that this issue had no activity for 30 days.
@malikumaliku I think i understand problem a bit you are trying to run arm32
binary on x86
using binfmt_misc
right ?
as @rhatdan suggested simple reproducer script would be helpful but could you try things below.
We are sharing code from containerd so we might have to patch containerd.
Could you please try following diff on buildah and confirm ?
diff --git a/vendor/github.com/containerd/containerd/platforms/cpuinfo.go b/vendor/github.com/containerd/containerd/platforms/cpuinfo.go
index 4a7177e3..9cc6b0d3 100644
--- a/vendor/github.com/containerd/containerd/platforms/cpuinfo.go
+++ b/vendor/github.com/containerd/containerd/platforms/cpuinfo.go
@@ -97,8 +97,7 @@ func getCPUVariant() string {
variant, err := getCPUInfo("Cpu architecture")
if err != nil {
- log.L.WithError(err).Error("failure getting variant")
- return ""
+ return "unknown"
}
// handle edge case for Raspberry Pi ARMv6 devices (which due to a kernel quirk, report "CPU architecture: 7")
After applying diff you would need to do a
make clean # to clean vendor
make
cc @nalind just for info.
A friendly reminder that this issue had no activity for 30 days.
Closing this since there was no reply on the ticket and author id is deleted.