Honeygain on a Raspberry Pi: fixing “exec format error”
If docker run honeygain/honeygain dies instantly with exec format error on your Pi, it is not your fault and not a typo. The official image is built for Intel processors, your Pi has an ARM one. The fix is a single command.
Why the message appears
exec format error is the Linux kernel answering a simple question: “can I execute this file?” The answer is no, because the program contains machine instructions for a different processor architecture. Your Raspberry Pi reports aarch64 for uname -m. The Honeygain image carries instructions for x86_64 – Intel and AMD processors, the kind in an ordinary PC.
Docker does not change that: a container shares the kernel with its host. It brings no operating system of its own that could translate. Without help, an ARM kernel cannot start an Intel binary. Full stop.
First check what your Pi reports
You want aarch64. If it says armv7l, you are on a 32-bit system and the translation layer will not help either – in that case reinstall Raspberry Pi OS in its 64-bit variant.
uname -m
Setting up the translation layer
Linux can run foreign machine instructions if you tell it what to run them with. The mechanism is binfmt_misc, a kernel feature that registers an interpreter for particular file types. The interpreter is QEMU, running in user mode – it emulates the instructions of one program rather than a whole machine.
The tonistiigi/binfmt image registers that association for you. It runs once, exits and disappears – the --rm flag cleans the container up immediately. What remains is the entry in the kernel.
docker run --privileged --rm tonistiigi/binfmt --install all
Why --privileged is here
The command writes into the host kernel and needs elevated rights to do so. For this one step that is unavoidable. Never grant elevated rights to a container that runs permanently or comes from a source you do not trust.
The entry does not survive a reboot. If your container runs with --restart unless-stopped, Docker will start it again after booting – but the interpreter is missing, so the container hits the same error. The next section solves that for good.
Setting Honeygain up completely
If Docker is still missing, this is the route the vendor recommends:
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER
newgrp docker
What curl … | sh actually does
It downloads someone else's script and runs it immediately with your rights. For get.docker.com that is the official route. For unknown sources, download the script and read it before you run it – that goes for every guide on the internet, including this one.
docker run --privileged --rm tonistiigi/binfmt --install all
docker run -d \
--name honeygain \
--restart unless-stopped \
--platform linux/amd64 \
honeygain/honeygain -tou-accept \
-email [YOUR_HONEYGAIN_EMAIL] \
-pass [YOUR_HONEYGAIN_PASSWORD] \
-device [NAME_FOR_THE_PI]
About the password
It sits inside the container and can be read back in plain text later via docker inspect honeygain. Use a long, unique password you do not use anywhere else. Worth remembering if you share the Pi with anyone.
The log lines tell you whether it is running:
docker logs honeygain
Making it survive a reboot
The translation layer is gone after every boot. The cleanest fix is a small system service that runs once before Docker. Honeygain then comes back on its own after a power cut.
sudo tee /etc/systemd/system/binfmt-arm.service >/dev/null <<'EOF'
[Unit]
Description=binfmt for foreign architectures
Before=docker.service
[Service]
Type=oneshot
ExecStart=/usr/bin/docker run --privileged --rm tonistiigi/binfmt --install all
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable binfmt-arm.service
How to verify
After a reboot, docker ps shows whether the container is running. If nothing is listed, docker logs honeygain will usually show the old error again – which means the service above was not active.
Getting rid of it again
One command and the container is gone along with its contents. You delete the account separately in the provider's dashboard.
docker rm -f honeygain