Balena-cli, balena-engine and SecretRemovalError

@aliasbits, I have tested the command line you mentioned with CLI v11.9.7 (standalone zip package), but I have not got any errors:

$ balena build --deviceType intel-nuc --arch amd64 --docker /var/run/balena-engine.sock
[Info]    Creating default composition with source: /mnt/data/balena-idling
[Info]    Building for amd64/intel-nuc
[Build]   Built 1 service in 0:16
[Build]   main Image size: 41.15 MB
[Success] Build succeeded!

Is the issue you are having consistent, or intermittent? The SecretRemovalError error can have several underlying the causes. The issues you have linked, and the output you have shared, seem to have different causes:

In order to find out where the ECONNRESET error you are getting is coming from, it would be helpful to be able to reproduce the error. Perhaps you could share a bit more about your “environment” (machine where you’re running the CLI, how you have installed the CLI, OS version, balenaOS version, if you’re using a VirtualBox VM, etc) and a sample Dockerfile or docker-compose.yml file that reproduces the error.

By the way, I think that the --docker /var/run/balena-engine.sock option you are using is not a common workflow; I imagine you’re either:

  • Running balenaEngine on your non-balenaOS development machine (laptop or desktop, e.g. running Ubuntu Linux), or
  • Running balena CLI in a container on balenaOS with balenaEngine.

I think neither option above is a common workflow, but I was using the second option to try to use the command line you shared:

# on a balenaOS host OS prompt on a NUC device or VirtualBox VM:
$ mkdir /mnt/data/cli
$ cd /mnt/data/cli
$ curl -LO https://github.com/balena-io/balena-cli/releases/download/v11.9.7/balena-cli-v11.9.7-linux-x64-standalone.zip
$ unzip balena-cli-v11.9.7-linux-x64-standalone.zip
$ mv balena-cli balena-cli-11.9.7

# now put the device in local mode (https://www.balena.io/docs/learn/develop/local-mode/)
# and create and run an ubuntu:bionic container (on balenaOS)
$ balena-engine run -it -v /mnt/data:/mnt/data -v /var/run/balena-engine.sock:/var/run/balena-engine.sock --network host ubuntu:bionic /bin/bash

# then inside the ubuntu:bionic container powered by balenaEngine/balenaOS
$ cd /mnt/data/
$ git clone https://github.com/balena-io-projects/balena-idling
$ cd balena-idling
$ /mnt/data/cli/balena-cli-11.9.7/balena build --deviceType intel-nuc --arch amd64 --docker /var/run/balena-engine.sock
[Info]    Creating default composition with source: /mnt/data/balena-idling
[Info]    Building for amd64/intel-nuc
[Build]   Built 1 service in 0:16
[Build]   main Image size: 41.15 MB
[Success] Build succeeded!

I’ve got “build succeeded” using both a “real” NUC computer (running balenaOS 2.32.0+rev4) and also running the intel-nuc image on a VirtualBox VM with balenaOS 2.41.1+rev1.

A more common workflow would be to run balenaCLI on your development machine (Mac, Windows or Linux) and select a remote balenaEngine daemon with the --dockerHost and --dockerPort command-line options (where “remote” could be a development/lab device like a NUC computer on the local network, or a VirtualBox VM running an intel-nuc balenaOS image). In theory however the results should be similar.