Skip to content

Conversation

tianon
Copy link
Member

@tianon tianon commented Sep 4, 2020

On the very popular Raspberry Pi 1 and Zero devices, the CPU is actually ARMv6, but the chip happens to support the feature bit the kernel uses to differentiate v6/v7, so it gets reported as "CPU architecture: 7" and thus fails to run many of the images that get pulled.

To account for this very popular edge case, this also checks "model name" which on these chips will begin with "ARMv6-compatible" -- we could also check uname, but getCPUInfo is already handy, low overhead, and mirrors the code before this.

To give a small taste of how common this issue is and why (in my opinion) it warrants a special case:

(I proposed this over in moby/moby#41017 (comment), which prompted the following query:)

@estesp: is there any variant of the ARMv7 CPU family that might be adversely affected by this; e.g. might get "downgraded" to a v6 variant inadvertently?

I'm not aware of any that report model name to be ARMv6-compatible like these RPi devices do (and my Google search for "model name : armv6-compatible" comes up with tons of hits for RPi-related discussion, usually around this very kernel quirk, but not much else I can see), so I think the regression potential here is really low.

I personally tested on a Raspberry Pi 1 (ARMv6) and a NanoPi NEO (ARMv7), and ctr i pull docker.io/library/alpine:3.12 does the right thing in both instances (on the RPi1, I get unpacking linux/arm/v6 sha256:... and on the NanoPi, I get unpacking linux/arm/v7 sha256:..., whereas before this change the RPi1 would choose the linux/arm/v7 image which then fails to run).

On the very popular Raspberry Pi 1 and Zero devices, the CPU is actually ARMv6, but the chip happens to support the feature bit the kernel uses to differentiate v6/v7, so it gets reported as "CPU architecture: 7" and thus fails to run many of the images that get pulled.

To account for this very popular edge case, this also checks "model name" which on these chips will begin with "ARMv6-compatible" -- we could also check uname, but getCPUInfo is already handy, low overhead, and mirrors the code before this.

Signed-off-by: Tianon Gravi <admwiggin@gmail.com>
@theopenlab-ci
Copy link

theopenlab-ci bot commented Sep 4, 2020

Build succeeded.

Copy link
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alexellis
Copy link
Contributor

Thanks for this, we couldn't use faasd on RPi 1 +0 due to containerd not passing a build. I'll be taking a look at this, or pointing the openfaas community at it.

robertgzr added a commit to balena-os/balena-engine that referenced this pull request Sep 1, 2021
See containerd/containerd#4530
and `git log ad25c1a9c34361e4071f508b9a91946b05fce165^..2055e12953bb538228d8d9fe627fa545d7cf82be ./platforms/`
in the containerd repo

Change-type: patch
Signed-off-by: Robert Günzler <robertg@balena.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants