When trying to figure out the wrong endpoint, I stumbled on this post: ( Path to generic x86-64 kernel headers - #13 by nilsdebruin ). In this post I noticed that the filename changed. In the example on the github repo the file is called “kernel-modules-headers.tar.gz”. But for some reason the filename changed to “kernel_modules_headers.tar.gz". The dash (-) changed to underscore (_).
If you have the same problem to find the kernel-modules-headers files change to this in the docker file:
# Download the kernel source then prepare kernel source to build a module.
RUN \
curl -fsSL "https://files.balena-cloud.com/images/${BALENA_MACHINE_NAME}/${VERSION}/kernel_modules_headers.tar.gz" \
| tar xz --strip-components=2 && \
make -C build modules_prepare -j"$(nproc)"