Yesterday, my Telegraf service suddenly crashed after pushing a new build. After further inspection, I found out that the issue was caused by an emulated build. I’ve set up a small repository to reliably reproduce the issue. For convenience, I’ve posted the README of this repo below.
balenaCloud offers two types of builders for ARM devices:
- Native ARM builders
- x86 builders using QEMU emulation
This repository shows that there are applications for which these two builders do not produce the same output. In fact, emulated building produces a broken container. The sample application provided is extremely simple and consists of a single
Dockerfile containing the following line:
- A balenaCloud account.
- Installation of balena-cli.
- A balenaCloud application named
balenacloud-emulationwith an ARM device type (such as a Raspberry Pi) and at least one device.
Steps to reproduce
Run the following commands to download this repository and reproduce the issue:
git clone https://github.com/pascal-hwky/balenacloud-emulation.git cd balenacloud-emulation balena push balenacloud-emulation --emulated
After the deployment is completed, you should see the following device output:
standard_init_linux.go:211: exec user process caused "exec format error"
This error message indicates that the Docker image contains invalid instructions and was therefore compiled for a different architecture. Repeating the build without emulation (by leaving out the
--emulated flag) does not cause this issue.
The balena-cli documentation mentions the following:
The emulated builds will also happen on the rare occasion that the native ARM builder is overloaded or unavailable.
However, as in the above case the emulated build fails, this could cause applications to randomly crash.