On Windows 10, the following balena-cli build --emulated command fails when specifying a remote docker daemon on a balena device (NUC computer):
node bin\balena-dev build other\simple_container -a test-rpi --nocache --logs --emulated -h 192.168.0.21 -p 2375 -R m\sample_secrets.yml
[Info] Creating default composition with source: C:\Users\paulo\balena\other\simple_container
[Info] Building for armv7hf/raspberrypi3
[Build] Building services...
[Build] main Preparing...
[Info] Emulation is enabled
[Build] main Step 1/7 : FROM eu.gcr.io/buoyant-idea-226013/arm32v7/busybox
[Build] main ---> 7ab81f29afdb
[Build] main Step 2/7 : COPY [".balena/qemu-execve","/tmp/qemu-execve"]
[Build] main ---> 25ca0920bda7
[Build] main Step 3/7 : COPY ["src/hi.txt","/"]
[Build] main ---> dbf2703e4b76
[Build] Built 1 service in 0:03
[Error] Build failed
OCI runtime create failed: container_linux.go:296: starting container process caused "exec: \"/tmp/qemu-execve\": permission denied": unknown
My investigation suggests two issues to be addressed in docker-qemu-transpose:
Bug: the normalizeTarEntry function uses native path functions instead of posix path functions when recreating the tar stream, meaning that backslashes are used when executing on Windows. This is incorrect because a tar stream should always use forward slashes, whether on Windows or Linux.
Improvement/bug: when balena-cli is used on Windows, the Qemu executable may be copied to a local filesystem that does not support the traditional Unix permissions (read-write-execute). As a result, when the Qemu executable is copied from the local fs to the tar stream, the execute permissions may be lost. I propose adding a "qemuFileMode" option to be passed to the transposeTarStream function, for that mode (permissions) to be applied to the qemu executable when the tar stream is recreated.
On Windows 10, the following balena-cli
build --emulated
command fails when specifying a remote docker daemon on a balena device (NUC computer):My investigation suggests two issues to be addressed in
docker-qemu-transpose
:normalizeTarEntry
function uses native path functions instead of posix path functions when recreating the tar stream, meaning that backslashes are used when executing on Windows. This is incorrect because a tar stream should always use forward slashes, whether on Windows or Linux.transposeTarStream
function, for that mode (permissions) to be applied to the qemu executable when the tar stream is recreated.