Skip to content

fix: keep ARMv7 wheels out of the arm/v6 image - #429

Merged
manbearwiz merged 3 commits into
mainfrom
fix/armv6-armv7-wheels
Nov 28, 2026
Merged

manbearwiz merged 3 commits into
mainfrom
fix/armv6-armv7-wheels

Conversation

@manbearwiz

@manbearwiz manbearwiz commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

Fixes #424.

Problem

The linux/arm/v6 image crashes on real ARMv6 hardware (Raspberry Pi Zero and Pi 1). The arm/v6 build runs under QEMU, whose default CPU is ARMv7 and reports armv7l. So pip installed musllinux_1_2_armv7l wheels, and their compiled modules use ARMv7 instructions. The current latest arm/v6 image ships four of them:

  • charset_normalizer/cd
  • charset_normalizer/md
  • markupsafe/_speedups
  • websockets/speedups

CI never caught this because it only ever runs the amd64 image.

Fix

Dockerfile: on v6 only, the pip install step exports QEMU_CPU=arm1176, QEMU's model of the Pi Zero's ARMv6 core. The build then reports armv6l, so pip rejects every armv7l wheel by itself. It falls back to a pure-Python wheel or a source build with Alpine's gcc, which targets ARMv6.

  • It's exported inside that one RUN step rather than set with ENV, so the image doesn't carry it.
  • A native build without QEMU ignores it.
  • There's no package list to keep current.

CI: a new step runs after the push on merges and tags. It greps the published arm/v6 image's .dist-info/WHEEL files for armv7l.

  • It catches an ARMv7 wheel getting in, and it catches the QEMU_CPU export silently not working, because then every package compiled during the build would be tagged armv7l again.
  • It fails if it can't read the files, so it can't pass by checking nothing.

The commits show how this got here: the first used a hand-kept PIP_NO_BINARY list and a long check that loaded every compiled file on an emulated ARMv6 CPU. Later commits replaced the list with QEMU_CPU and the check with the grep, so review the combined diff.

Tested locally (Docker Desktop, QEMU)

Image QEMU_CPU=arm1176 Default QEMU CPU
Published latest arm/v6 ❌ the 4 modules above crash with SIGILL ✅ 45/45 load
This branch, arm/v6 ✅ 42/42 load —

I ran the loading test above with the earlier, longer check. The new grep check was tested separately:

Image Grep check
Published latest arm/v6 ❌ fails and lists its 5 armv7l wheels
python:3.15.2-alpine3.24 (no armv7l wheels) ✅ passes
alpine:3.24 (no Python) ❌ fails, so it can't pass by finding nothing

This branch's image has no armv7l tags, so the grep check would pass on it.

On the arm1176 CPU model, this branch's image also:

  • passes /healthz in about 9 seconds
  • starts ffmpeg -version and node --version
  • has no QEMU_CPU in its environment

How each affected package now installs:

Package Installed as
markupsafe, brotli, pycryptodomex compiled from source, tagged linux_armv6l
charset-normalizer, websockets pure-Python wheels

For reviewers

  • Only arm/v6 changes. amd64, arm64 and arm/v7 install the same wheels as before. This PR's CI builds amd64 only, and I didn't build amd64 locally.
  • Dependencies will update. Changing the RUN line clears the cached pip layer, so every platform reinstalls once and resolves its unpinned dependencies afresh. The local build got charset-normalizer 3.5.3, one release newer than today's image's 3.5.2.
  • websockets is slower on v6. It's now pure Python and loses its C speedups, which matters only for the few sites where yt-dlp uses websockets.
  • The new check reads labels, not code. It wouldn't catch a wheel whose tag is wrong, or compiled code that pip didn't install.
  • The new check runs after the push. If it fails, the broken v6 image is already published. The existing smoke test works the same way.
  • The pip step is about as fast as before. It took roughly 11 minutes under QEMU, almost all of it compiling brotli and pycryptodomex, which already happened before this change.
  • Security exposure is about the same. Versions are identical, gcc is removed in the same layer, and source builds already ran during the v6 build.
  • Still unknown: whether libdav1d and libtheora, Alpine libraries marked ARMv7, cause trouble when ffmpeg actually uses them on a Pi. This fix doesn't touch them.
  • Not tested on real hardware. The issue's author offered to test a build on a Pi Zero W.

🤖 Generated with Claude Code

manbearwiz and others added 3 commits November 28, 2026 01:43
The arm/v6 image is built under QEMU, whose default CPU is ARMv7 and
reports armv7l, so pip installed musllinux armv7l wheels for
charset-normalizer, markupsafe and websockets. Their compiled modules
use ARMv7 instructions and crash on real ARMv6 hardware (Raspberry Pi
Zero and Pi 1). On v6 only, build those packages from source so
Alpine's gcc targets ARMv6.

CI now loads every compiled file in the published arm/v6 image on
QEMU's arm1176 CPU model, so a new dependency with the same problem
fails the build instead of shipping.

Fixes #424

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the hand-kept PIP_NO_BINARY list with the root cause: under
QEMU's default ARMv7 CPU the arm/v6 build reports armv7l, so pip picks
armv7l wheels. Exporting QEMU_CPU=arm1176 for the v6 pip install makes
the build report armv6l, so pip rejects every armv7l wheel on its own
and falls back to a pure-Python wheel or a source build with Alpine's
gcc, which targets ARMv6. Native builds ignore the variable, and it is
exported in the RUN rather than set with ENV so the image does not
carry it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With pip now running on QEMU's ARMv6 model in the v6 build, the
installed wheels' tags say what pip chose: armv6l when it worked,
armv7l when an ARMv7 wheel got in or the QEMU_CPU export stopped
working. A grep over the WHEEL files catches both in one line, in
place of loading each compiled file on an emulated ARMv6 CPU. grep
exits 1 only when it read the files and found no match, so a missing
site-packages fails the step instead of passing it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@manbearwiz
manbearwiz merged commit f6d2246 into main Nov 28, 2026
3 checks passed
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.

linux/arm/v6 image crashes on Raspberry Pi Zero W (ARMv6)

1 participant