Addon on Raspberry Pi 4: architecture mismatch?

Hi all,

Does anybody have an example of an hassio addon that does NOT use the official base image and works on Raspberry Pi 4?

This dockerfile works:

ARG BUILD_FROM
FROM $BUILD_FROM
...
CMD [ "/run.sh" ]

This works too (I’m building it just for one architecture at the moment):

FROM homeassistant/aarch64-base:latest
...
CMD [ "/run.sh" ]

But if I use the image homeassistant/aarch64-base's based on (arm64v8/alpine, taken from here: docker-base/Dockerfile at fa6c4bd5f0fe835edf002d5c31b391ab56a5c6ec · home-assistant/docker-base · GitHub):

FROM arm64v8/alpine:latest
...
CMD [ "/run.sh" ]

I get the architecture mismatch when starting the addon:

exec /run.sh: exec format error

docker inspect on homeassistant/aarch64-base and arm64v8/alpine show the exact same architecture (arm64, v8, linux), so I’m a bit lost.

Does run.sh start with a proper shebang line?

It does:

#/bin/sh
echo ready

The same exact run.sh works with the first two Dockerfiles

Ah but that’s wrong, it should be:

#!/bin/sh
echo ready

(added a ! after the #)

At least with Alpine, you need a proper shebang line with shell scripts, otherwise the kernel(?) will interpret the file as an ELF executable, which is isn’t (causing an “exec format error”).

Oh my god. I suspected it was something trivial but this is embarrassing :slight_smile:

Thank you!

1 Like