[node red] Unable to locate package rpi.gpio / Remote build failed

Hello everyone,

I’m trying to upload a Node-RED application to my RaspberryPi4 running BalenaOs but i keep getting the same errors which all are about the RUN command in my dockerfile.

Specifically, the application i am trying to upload is this one and my dockerfile looks like this:

# Build step
###
FROM balenalib/%%BALENA_MACHINE_NAME%%-debian-node:12-stretch-build as build

RUN JOBS=MAX npm install -g --production --unsafe-perm \
       node-red \
       node-red-admin \
       node-red-contrib-balena

###
# Runtime image
###
FROM balenalib/%%BALENA_MACHINE_NAME%%-debian-node:12-stretch-run

RUN apt-get update && apt-get install -yq --no-install-recommends \
  rpi.gpio \
  python-dev \
  python-rpi.gpio \
  && apt-get clean && rm -rf /var/lib/apt/lists/*

# Defines our working directory in container
WORKDIR /usr/src/app

# Copy over the files created in the previous step, including lib/, bin/
COPY --from=build /usr/local/bin /usr/local/bin
COPY --from=build /usr/local/lib/node_modules /usr/local/lib/node_modules

# This will copy all files in our root to the working  directory in the container
COPY ./app ./

# server.js will run when container starts up on the device
CMD ["bash", "/usr/src/app/start.sh"] 

The error messages i get are the following ones:

In case i remove the whole RUN section from the dockerfile then the code is being successfully uploaded to my raspberry and via the public url on the balena cloud i can access the Node-red editor and build my flows, though i’m missing the Raspberry_PI nodes and thus, i can’t use the raspberry GPIO’s in my flows.

Since i am fairly new to the whole balena/container scheme, it would be really appreciated if someone could support me with these errors. What is it i am missing here?

Thanks in advance,
Dimitris

Hi @Dim,

So I think this is probably down the use of the Raspberry Pi 4, which is a different architecture to that of the Pi3. You’ve got a couple of options here. The first is that you could run the armv7 (32bit) project on your Pi4 instead, which will allow you to use the same project with a couple of small changes to the Dockerfiles, replacing %%BALENA_MACHINE_NAME%% to raspberry-pi3. This will force the base images used to be for a Pi3.

The other alternative if you want to build them as 64bit, is to switch from using stretch to buster, as this release does include the relevant GPIO packages. In this case you’d want to change any occurrence of stretch to buster in the Dockerfiles. Note that we haven’t tried this ourselves and whilst it should work, you may see issues we have not encountered.

Hope this helps!

Best regards,

Heds

Hello @hedss,

Thank you for your prompt reply.
Even though my goal is to build a 64bit image i tried both of your solutions. Running the armv7 was successful and everything worked as expected, but in the second case in which i switched every strech in my dockerfile to buster the build failed and didn’t released.
Here’s a look at the errors since i can’t include all the logs :

[Info]     Starting build for RaspHotSpot, user dimitris_tsounis
[Info]     Dashboard link: https://dashboard.balena-cloud.com/apps/1534438/devices
[Info]     Building on arm01
[Info]     Pulling previous images for caching purposes...
[Success]  Successfully pulled cache images
[main]     Step 1/9 : FROM balenalib/raspberrypi4-64-debian-node:12-buster-run
[main]      ---> 1100e6fa00d3
[main]     Step 2/9 : RUN JOBS=MAX npm install -g --production --unsafe-perm        node-red        node-red-admin        node-red-contrib-balena
[main]      ---> Running in 7c995cff812d
[main]     /usr/local/bin/node-red-admin -> /usr/local/lib/node_modules/node-red-admin/node-red-admin.js
[main]     /usr/local/bin/node-red -> /usr/local/lib/node_modules/node-red/red.js
[main]     /usr/local/bin/node-red-pi -> /usr/local/lib/node_modules/node-red/bin/node-red-pi
[main]     > bcrypt@3.0.6 install /usr/local/lib/node_modules/node-red/node_modules/bcrypt
[main]     > node-pre-gyp install --fallback-to-build
[main]     node-pre-gyp
[main]
[main]     WARN
[main]
[main]     Using request for node-pre-gyp https download
[main]
[main]     node-pre-gyp
[main]      WARN
[main]     Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.6/bcrypt_lib-v3.0.6-node-v72-linux-arm64-glibc.tar.gz
[main]
[main]     node-pre-gyp
[main]     WARN
[main]
[main]     Pre-built binaries not found for bcrypt@3.0.6 and node@12.13.0 (node-v72 ABI, glibc) (falling back to source compile with node-gyp)
[main]
[main]
[main]     gyp
[main]
[main]     ERR!
[main]
[main]     find Python
[main]
[main]     gyp
[main]      ERR!
[main]
[main]     find Python Python is not set from command line or npm configuration
[main]
[main]     gyp
[main]      ERR!
[main]
[main]     find Python
[main]      Python is not set from environment variable PYTHON
[main]
[main]     gyp
[main]
[main]     ERR!
[main]     find Python
[main]      checking if "python" can be used
[main]
[main]     gyp
[main]
[main]     ERR!
[main]      find Python
[main]      - "python" is not in PATH or produced an error
[main]
[main]     gyp
[main]      ERR!
[main]
[main]     find Python
[main]      checking if "python2" can be used
[main]
[main]     gyp
[main]
[main]     ERR!
[main]
[main]     find Python
[main]      - "python2" is not in PATH or produced an error
[main]
[main]     gyp
[main]
[main]     ERR!
[main]     find Python
[main]      checking if "python3" can be used
[main]
[main]     gyp
[main]      ERR!
[main]
[main]     find Python
[main]      - "python3" is not in PATH or produced an error
[main]
[main]     gyp ERR!
[main]
[main]     find Python
[main]
[main]
[main]     gyp
[main]
[main]     ERR!
[main]
[main]     find Python
[main]      **********************************************************
[main]
[main]     gyp
[main]      ERR!
[main]
[main]     find Python
[main]      You need to install the latest version of Python.
[main]
[main]     gyp
[main]
[main]     ERR!
[main]
[main]     find Python
[main]      Node-gyp should be able to find and use Python. If not,
[main]
[main]     gyp
[main]     ERR!
[main]      find Python
[main]      you can try one of the following options:
[main]     gyp
[main]      ERR!
[main]
[main]     find Python
[main]      - Use the switch --python="/path/to/pythonexecutable"
[main]
[main]     gyp
[main]
[main]     ERR!
[main]     find Python   (accepted by both node-gyp and npm)
[main]
[main]     gyp
[main]
[main]     ERR!
[main]      find Python - Set the environment variable PYTHON
[main]
[main]     gyp
[main]     ERR! find Python
[main]      - Set the npm configuration variable python:
[main]
[main]     gyp
[main]     ERR!
[main]
[main]     find Python
[main]        npm config set python "/path/to/pythonexecutable"
[main]     gyp
[main]
[main]     ERR!
[main]
[main]     find Python
[main]      For more information consult the documentation at:
[main]     gyp
[main]      ERR!
[main]      find Python
[main]      https://github.com/nodejs/node-gyp#installation
[main]
[main]     gyp
[main]
[main]     ERR!
[main]      find Python
[main]      **********************************************************
[main]
[main]     gyp
[main]     ERR!
[main]
[main]     find Python
[main]
[main]
[main]     gyp
[main]
[main]     ERR!
[main]      configure error
[main]
[main]
[main]     gyp
[main]     ERR!
[main]     stack Error: Could not find any Python installation to use
[main]
[main]     gyp
[main]     ERR!
[main]      stack
[main]          at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:307:47)
[main]     gyp
[main]
[main]     ERR!
[main]
[main]     stack
[main]          at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:136:21)
[main]
[main]     gyp
[main]
[main]     ERR!
[main]
[main]     stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:179:16)
[main]
[main]     gyp
[main]
[main]     ERR!
[main]
[main]     stack
[main]          at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:271:16)
[main]     gyp
[main]     ERR!
[main]
[main]     stack
[main]          at exithandler (child_process.js:302:5)
[main]
[main]     gyp
[main]
[main]     ERR!
[main]     stack
[main]          at ChildProcess.errorhandler (child_process.js:314:5)
[main]
[main]     gyp
[main]
[main]     ERR!
[main]
[main]     stack
[main]          at ChildProcess.emit (events.js:210:5)
[main]     gyp
[main]      ERR!
[main]      stack
[main]          at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
[main]     gyp
[main]
[main]     ERR!
[main]
[main]     stack
[main]          at onErrorNT (internal/child_process.js:456:16)
[main]     gyp
[main]
[main]     ERR!
[main]
[main]     stack
[main]          at processTicksAndRejections (internal/process/task_queues.js:80:21)
[main]
[main]     gyp
[main]
[main]     ERR!
[main]
[main]     System
[main]      Linux 4.15.0-45-generic
[main]
[main]     gyp
[main]     ERR!
[main]     command
[main]      "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
[main]     gyp
[main]     ERR! cwd /usr/local/lib/node_modules/node-red/node_modules/bcrypt
[main]
[main]     gyp
[main]     ERR!
[main]     node -v v12.13.0
[main]
[main]     gyp
[main]     ERR!
[main]     node-gyp -v v5.0.5
[main]
[main]     gyp
[main]
[main]     ERR!
[main]      not ok
[main]
[main]
[main]     node-pre-gyp
[main]
[main]     ERR!
[main]
[main]     build error
[main]
[main]
[main]     node-pre-gyp
[main]
[main]     ERR!
[main]
[main]     stack
[main]      Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
[main]
[main]     node-pre-gyp ERR!
[main]     stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/node-red/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
[main]
[main]     node-pre-gyp
[main]      ERR!
[main]
[main]     stack     at ChildProcess.emit (events.js:210:5)
[main]
[main]     node-pre-gyp
[main]
[main]     ERR!
[main]
[main]     stack
[main]          at maybeClose (internal/child_process.js:1021:16)
[main]
[main]     node-pre-gyp
[main]     ERR!
[main]
[main]     stack
[main]          at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
[main]
[main]     node-pre-gyp
[main]
[main]     ERR!
[main]
[main]     System
[main]      Linux 4.15.0-45-generic
[main]
[main]     node-pre-gyp
[main]      ERR! command
[main]      "/usr/local/bin/node" "/usr/local/lib/node_modules/node-red/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
[main]
[main]     node-pre-gyp
[main]     ERR!
[main]     cwd /usr/local/lib/node_modules/node-red/node_modules/bcrypt
[main]
[main]     node-pre-gyp
[main]
[main]     ERR!
[main]      node -v
[main]      v12.13.0
[main]
[main]     node-pre-gyp
[main]     ERR!
[main]     node-pre-gyp -v v0.12.0
[main]
[main]     node-pre-gyp
[main]
[main]     ERR!
[main]
[main]     not ok
[main]
[main]
[main]     Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
[main]     > bcrypt@3.0.7 install /usr/local/lib/node_modules/node-red-admin/node_modules/bcrypt
[main]     > node-pre-gyp install --fallback-to-build
[main]     node-pre-gyp
[main]
[main]     WARN
[main]
[main]     Using request for node-pre-gyp https download
[main]
[main]
[main]     node-pre-gyp
[main]      WARN
[main]
[main]     Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.7/bcrypt_lib-v3.0.7-node-v72-linux-arm64-glibc.tar.gz
[main]
[main]
[main]     node-pre-gyp
[main]
[main]     WARN
[main]
[main]     Pre-built binaries not found for bcrypt@3.0.7 and node@12.13.0 (node-v72 ABI, glibc) (falling back to source compile with node-gyp)
[main]
[main]
[main]     gyp
[main]
[main]     ERR!
[main]      find Python
[main]
[main]
[main]     gyp
[main]     ERR!
[main]
[main]     find Python
[main]      Python is not set from command line or npm configuration
[main]
[main]     gyp
[main]
[main]     ERR!
[main]      find Python
[main]      Python is not set from environment variable PYTHON
[main]     gyp
[main]
[main]     ERR!
[main]
[main]     find Python checking if "python" can be used
[main]     gyp
[main]
[main]     ERR!
[main]      find Python
[main]      - "python" is not in PATH or produced an error
[main]     gyp
[main]     ERR!
[main]
[main]     find Python
[main]      checking if "python2" can be used
[main]
[main]     gyp
[main]
[main]     ERR!
[main]      find Python
[main]      - "python2" is not in PATH or produced an error
[main]
[main]     gyp
[main]
[main]     ERR!
[main]
[main]     find Python checking if "python3" can be used
[main]
[main]     gyp
[main]      ERR!
[main]
[main]     find Python
[main]      - "python3" is not in PATH or produced an error
[main]
[main]     gyp
[main]
[main]     ERR!
[main]     find Python
[main]
[main]
[main]     gyp
[main]
[main]     ERR!
[main]     find Python **********************************************************
[main]
[main]     gyp
[main]     ERR!
[main]
[main]     find Python
[main]      You need to install the latest version of Python.
[main]
[main]     gyp
[main]     ERR!
[main]     find Python Node-gyp should be able to find and use Python. If not,
[main]
[main]     gyp
[main]
[main]     ERR!
[main]      find Python
[main]      you can try one of the following options:
[main]     gyp
[main]      ERR!
[main]      find Python
[main]      - Use the switch --python="/path/to/pythonexecutable"
[main]
[main]     gyp
[main]      ERR!
[main]
[main]     find Python
[main]        (accepted by both node-gyp and npm)
[main]
[main]     gyp
[main]      ERR!
[main]
[main]     find Python
[main]      - Set the environment variable PYTHON
[main]
[main]     gyp
[main]
[main]     ERR!
[main]
[main]     find Python
[main]      - Set the npm configuration variable python:
[main]
[main]     gyp
[main]     ERR!
[main]
[main]     find Python
[main]        npm config set python "/path/to/pythonexecutable"
[main]
[main]     gyp
[main]     ERR!
[main]     find Python For more information consult the documentation at:
[main]
[main]     gyp
[main]
[main]     ERR!
[main]
[main]     find Python
[main]      https://github.com/nodejs/node-gyp#installation
[main]
[main]     gyp
[main]     ERR!
[main]      find Python
[main]      **********************************************************
[main]
[main]     gyp
[main]
[main]     ERR!
[main]
[main]     find Python
[main]
[main]
[main]     gyp
[main]
[main]     ERR!
[main]      configure error
[main]
[main]
[main]     gyp
[main]     ERR!
[main]
[main]     stack
[main]      Error: Could not find any Python installation to use
[main]
[main]     gyp
[main]     ERR!
[main]
[main]     stack     at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:307:47)
[main]
[main]     gyp
[main]
[main]     ERR!
[main]     stack
[main]          at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:136:21)
[main]
[main]     gyp
[main]
[main]     ERR!
[main]
[main]     stack
[main]          at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:179:16)
[main]     gyp
[main]
[main]     ERR!
[main]      stack
[main]          at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:271:16)
[main]
[main]     gyp
[main]
[main]     ERR!
[main]
[main]     stack
[main]          at exithandler (child_process.js:302:5)
[main]
[main]     gyp
[main]
[main]     ERR!
[main]      stack
[main]          at ChildProcess.errorhandler (child_process.js:314:5)
[main]
[main]     gyp
[main]     ERR!
[main]      stack
[main]          at ChildProcess.emit (events.js:210:5)
[main]
[main]     gyp
[main]     ERR!
[main]     stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
[main]
[main]     gyp
[main]
[main]     ERR!
[main]      stack
[main]          at onErrorNT (internal/child_process.js:456:16)
[main]     gyp
[main]
[main]     ERR!
[main]
[main]     stack     at processTicksAndRejections (internal/process/task_queues.js:80:21)
[main]
[main]     gyp
[main]
[main]     ERR!
[main]     System
[main]      Linux 4.15.0-45-generic
[main]
[main]     gyp
[main]     ERR!
[main]     command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/local/lib/node_modules/node-red-admin/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/usr/local/lib/node_modules/node-red-admin/node_modules/bcrypt/lib/binding" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
[main]     gyp
[main]     ERR! cwd
[main]      /usr/local/lib/node_modules/node-red-admin/node_modules/bcrypt
[main]
[main]     gyp
[main]
[main]     ERR!
[main]
[main]     node -v
[main]      v12.13.0
[main]
[main]     gyp
[main]
[main]     ERR!
[main]      node-gyp -v
[main]      v5.0.5
[main]     gyp
[main]
[main]     ERR!
[main]      not ok
[main]
[main]
[main]     node-pre-gyp
[main]
[main]     ERR!
[main]
[main]     build error
[main]
[main]
[main]     node-pre-gyp
[main]      ERR!
[main]      stack
[main]      Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/node-red-admin/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/usr/local/lib/node_modules/node-red-admin/node_modules/bcrypt/lib/binding --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
[main]     node-pre-gyp
[main]     ERR! stack
[main]          at ChildProcess.<anonymous> (/usr/local/lib/node_modules/node-red-admin/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
[main]
[main]     node-pre-gyp ERR!
[main]
[main]     stack
[main]          at ChildProcess.emit (events.js:210:5)
[main]
[main]     node-pre-gyp
[main]     ERR!
[main]
[main]     stack
[main]          at maybeClose (internal/child_process.js:1021:16)
[main]
[main]     node-pre-gyp
[main]      ERR!
[main]
[main]     stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
[main]
[main]     node-pre-gyp
[main]
[main]     ERR!
[main]
[main]     System Linux 4.15.0-45-generic
[main]
[main]     node-pre-gyp
[main]     ERR!
[main]     command
[main]      "/usr/local/bin/node" "/usr/local/lib/node_modules/node-red-admin/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
[main]
[main]     node-pre-gyp
[main]     ERR!
[main]      cwd
[main]      /usr/local/lib/node_modules/node-red-admin/node_modules/bcrypt
[main]
[main]     node-pre-gyp
[main]
[main]     ERR!
[main]      node -v
[main]      v12.13.0
[main]
[main]     node-pre-gyp
[main]
[main]     ERR!
[main]      node-pre-gyp -v
[main]      v0.13.0
[main]
[main]     node-pre-gyp
[main]      ERR!
[main]
[main]     not ok
[main]
[main]     Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/node-red-admin/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/usr/local/lib/node_modules/node-red-admin/node_modules/bcrypt/lib/binding --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
[main]     npm WARN optional
[main]      SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.6 (node_modules/node-red/node_modules/bcrypt):
[main]     npm WARN
[main]     optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.6 install: `node-pre-gyp install --fallback-to-build`
[main]     npm
[main]     WARN optional
[main]      SKIPPING OPTIONAL DEPENDENCY: Exit status 1
[main]
[main]     npm
[main]     WARN
[main]     optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.7 (node_modules/node-red-admin/node_modules/bcrypt):
[main]
[main]     npm
[main]     WARN optional
[main]      SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.7 install: `node-pre-gyp install --fallback-to-build`
[main]
[main]     npm
[main]     WARN
[main]     optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
[main]
[main]
[main]

[main]     Get:33 http://deb.debian.org/debian buster/main arm64 python-rpi.gpio arm64 0.6.5-1 [21.5 kB]
[main]     Get:34 http://deb.debian.org/debian buster/main arm64 python3-rpi.gpio arm64 0.6.5-1 [21.6 kB]
[main]     debconf: delaying package configuration, since apt-utils is not installed
[main]
[main]     Fetched 45.1 MB in 1s (35.1 MB/s)
[main]     Selecting previously unselected package libpython2.7-minimal:arm64.
[main]     (Reading database ...
(Reading database ... 75%ase ... 5%
[main]     (Reading database ... 80%
[main]     (Reading database ... 85%
[main]     (Reading database ... 90%
[main]     (Reading database ... 95%
(Reading database ... 9961 files and directories currently installed.)
[main]     Preparing to unpack .../0-libpython2.7-minimal_2.7.16-2+deb10u1_arm64.deb ...

[main]     Processing triggers for libc-bin (2.28-10) ...
[main]     Removing intermediate container 0f170c6939d1
[main]      ---> eb1cf10d6e7b
[main]     Step 5/9 : WORKDIR /usr/src/app
[main]      ---> Running in 1aea559621f1
[main]     Removing intermediate container 1aea559621f1
[main]      ---> 004015b868e6
[main]     Step 6/9 : COPY --from=build /usr/local/bin /usr/local/bin
[main]     invalid from flag value build: pull access denied for build, repository does not exist or may require 'docker login'
[Info]     Uploading images
[Success]  Successfully uploaded images
[Error]    Some services failed to build:
[Error]      Service: main
[Error]        Error: invalid from flag value build: pull access denied for build, repository does not exist or may require 'docker login'
[Info]     Built on arm01
[Error]    Not deploying release.
Remote build failed

Hi again @Dim,

It looks like you’ve changed the initial base image type from build to run:

[main]     Step 1/9 : FROM balenalib/raspberrypi4-64-debian-node:12-buster-run

This needs to be FROM balenalib/%%BALENA_MACHINE_NAME%%-debian-node:12-buster-build as build as it needs the build type to include all the tools to build the nodegyp modules. Additionally the as build is required to reference it in the next FROM command.

The only differences should be the stretch to buster changes as shown in the diff output below:

diff --git a/node-red/Dockerfile.template b/node-red/Dockerfile.template
index 4562eb4..ab8c4e6 100644
--- a/node-red/Dockerfile.template
+++ b/node-red/Dockerfile.template
@@ -1,7 +1,7 @@
 ###
 # Build step
 ###
-FROM balenalib/%%BALENA_MACHINE_NAME%%-debian-node:12-stretch-build as build
+FROM balenalib/%%BALENA_MACHINE_NAME%%-debian-node:12-buster-build as build

 RUN JOBS=MAX npm install -g --production --unsafe-perm \
        node-red \
@@ -11,7 +11,7 @@ RUN JOBS=MAX npm install -g --production --unsafe-perm \
 ###
 # Runtime image
 ###
-FROM balenalib/%%BALENA_MACHINE_NAME%%-debian-node:12-stretch-run
+FROM balenalib/%%BALENA_MACHINE_NAME%%-debian-node:12-buster-run

 RUN apt-get update && apt-get install -yq --no-install-recommends \
   rpi.gpio \

This will allow the project to build.

Best regards,

Heds

Hi @hedss,

Thank you for your help, indeed changing the stretch to buster was enough for the project to be build.

I have just another question to ask you, i added another service to the project with a simple python script for spi transactions and now the image is not being build again because The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1 . Could you please also assist me with this one?

More specifically the error that i am getting is this one:

The dockerfile for the new service looks like this.

FROM balenalib/raspberrypi3-python:3-buster-run

# Set our working directory
WORKDIR /usr/src/app

# Copy requirements.txt first for better cache on later pushes
 COPY requirements.txt requirements.txt

# pip install python deps from requirements.txt on the resin.io build server
 RUN pip install -r requirements.txt

# This will copy all files in our root to the working  directory in the container
COPY . ./

# Enable udevd so that plugged dynamic hardware devices show up in our container.
ENV UDEV=1

# main.py will run when container starts up on the device
CMD ["python","-u","src/spi_balenaTest.py"]

In the requirements.txt the only thing is written is spidev and i included the new service in the docker-compose.yml file.

Thank you very much,
Dimitris

Hi @Dim,

This is because the FROM balenalib/raspberrypi3-python:3-buster-run in your first line should again be FROM balenalib/raspberrypi3-python:3-buster-build. gcc is the GNU C Compiler which is a build tool, and not present in run base images.

There’s some general info about naming schemes and what is included in base images here and that should give you enough information to help you choose appropriate images in the future.

Best regards,

Heds