mitchellrj/hue_exporter

Cannot start on Raspberry pi

Closed this issue · 4 comments

The issue

Hi, I'm using this very useful project on my laptop for a few days now and I'm in the process of migrating it to a raspberry pi server. But that is not that easy:

Running the published docker image for arm:

docker run --rm -it mitchellrj/hue_exporter:0.2.1-arm7
Unable to find image 'mitchellrj/hue_exporter:0.2.1-arm7' locally
0.2.1-arm7: Pulling from mitchellrj/hue_exporter
8e3ba11ec2a2: Pull complete 
cdf532e0d558: Pull complete 
69484a10f36b: Pull complete 
Digest: sha256:f96659046468c06c22bf2292fb366285875d39f142b1c16e5fee0e4bdb42bab7
Status: Downloaded newer image for mitchellrj/hue_exporter:0.2.1-arm7

standard_init_linux.go:190: exec user process caused "exec format error"

So I tried with to run the binaries published on the github release page:

wget https://github.com/mitchellrj/hue_exporter/releases/download/v0.2.1/hue_exporter.arm7
--2018-12-02 16:38:12--  https://github.com/mitchellrj/hue_exporter/releases/download/v0.2.1/hue_exporter.arm7
Resolving github.com (github.com)... 192.30.253.113, 192.30.253.112
Connecting to github.com (github.com)|192.30.253.113|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/143560568/d381880c-9da7-11e8-85c2-ccac3ba00508?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20181202%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20181202T153813Z&X-Amz-Expires=300&X-Amz-Signature=fc81b982d6892f111ba03ebf22463750b342bf8c87a660364b7aaac9dc4fafb6&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dhue_exporter.arm7&response-content-type=application%2Foctet-stream [following]
--2018-12-02 16:38:13--  https://github-production-release-asset-2e65be.s3.amazonaws.com/143560568/d381880c-9da7-11e8-85c2-ccac3ba00508?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20181202%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20181202T153813Z&X-Amz-Expires=300&X-Amz-Signature=fc81b982d6892f111ba03ebf22463750b342bf8c87a660364b7aaac9dc4fafb6&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dhue_exporter.arm7&response-content-type=application%2Foctet-stream
Resolving github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 52.216.128.51
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.216.128.51|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11240674 (11M) [application/octet-stream]
Saving to: 'hue_exporter.arm7'

hue_exporter.arm7                                           100%[=========================================================================================================================================>]  10.72M  5.49MB/s    in 2.0s    

2018-12-02 16:38:15 (5.49 MB/s) - 'hue_exporter.arm7' saved [11240674/11240674]
chmod +x hue_exporter.arm7
./hue_exporter.arm7
hue_exporter.arm7: error: path 'hue_exporter.yml' does not exist, try --help

and there it works. So, when run in the docker image it fails, but straight on the rpi, it works.

My workaround

I can successfully run the following image:

FROM alpine

# https://adminswerk.de/caddy-golang-on-alpine-armv6/
RUN apk add --no-cache libc6-compat

ADD https://github.com/mitchellrj/hue_exporter/releases/download/v0.2.1/hue_exporter.arm7 /bin/hue_exporter
RUN chmod +x /bin/hue_exporter

EXPOSE 9366
ENTRYPOINT ["/bin/hue_exporter"]
CMD ["--config.file=/etc/hue_exporter/config.yml"]

Resolution

I'm sorry I unable to contribute a fix, my Go tooling knowledge being insufficient.

I did notice something fishy:

file hue_exporter.arm7 
hue_exporter.arm7: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, not stripped

which seems to indicate the binary is not statically linked.

and also, the following Docker image fails:

FROM alpine

# https://adminswerk.de/caddy-golang-on-alpine-armv6/
RUN apk add --no-cache libc6-compat


COPY --from=mitchellrj/hue_exporter:latest-arm7 /bin/hue_exporter /bin
RUN chmod +x /bin/hue_exporter

EXPOSE 9366
ENTRYPOINT ["/bin/hue_exporter"]
CMD ["--config.file=/etc/hue_exporter/config.yml"]

Context

$ uname -a
Linux raspberrypi 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l GNU/Linux
docker version
Client:
 Version:           18.09.0
 API version:       1.39
 Go version:        go1.10.4
 Git commit:        4d60db4
 Built:             Wed Nov  7 00:57:21 2018
 OS/Arch:           linux/arm
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.0
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.4
  Git commit:       4d60db4
  Built:            Wed Nov  7 00:17:57 2018
  OS/Arch:          linux/arm
  Experimental:     false

Sorry @thomasleveil I only just saw this. Try again with v0.2.2.

I've just tried to run the 0.2.2-arm7 image, it's showing up as an x64 binary, and the exact same image ID/digest as the 0.2.2 image

Edit: latest-arm7 is pointing at a different image to 0.2.2-arm7, latest-arm7 contains a working arm binary, 0.2.2-arm7 is pointing to the same image as 0.2.2

Aha! Yes, that's it. Dumb typo in my Makefile. I've pushed a fixed version of the tag now.

@thomasleveil @StrangelyTyped I'm going to assume this is resolved now. Please re-open if you have any further issues. Sorry for the stupid mistake!