Problem setting up Basicstation on RAK831+RPI3

Hello,

I’m trying to set up a LoRa Gateway and connect it to the The Tings Stack v3.

Whatever I try, I do not succeed. If I choose RPI3 64 bit (aarch64) and use the Deploy button from the Hub-page (https://hub.balena.io/apps/1835021/basicstation-gateway-TTS) it starts building a release and then stops with an error.

[Info]          Dashboard link: https://dashboard.balena-cloud.com/apps/2325837/devices
[Info]          Building on a8df1a3
[Info]          No suitable previous release for caching, skipping cache pull
[Info]          Starting to build basicstation
[Info]          Uploading images
[Success]       Successfully uploaded images
[Error]         Some services failed to build:
[Error]           Service: basicstation
[Error]             Error: The command '/bin/sh -c install_packages jq' returned a non-zero code: 100
[Info]          Built on a8df1a3
[Error]         Not deploying release.

If i try it with RPI3 (armv7hf) from https://hub.balena.io/apps/1759470/basicstation i get this:

[Info]     Starting build for basicstation, user info298
[Info]     Dashboard link: 
[Info]     Building on 28fcfdc
[Info]     No suitable previous release for caching, skipping cache pull
[Info]     Starting to build main
[Info]     Uploading images
[Success]  Successfully uploaded images
[Error]    Some services failed to build:[Error]      Service: main
[Error]        Error: The command ‘/bin/sh -c pip3 install aiohttp websockets’ returned a non-zero code: 1
[Info]     Built on 28fcfdc
[Error]    Not deploying release.

I also tried with CLI: No difference.

If I make a fresh RPI3 (arm7vf) with balenaOS 6.7.7+rev2 and push these GitHub’s, I get with CLI:

https://github.com/xoseperez/the-things-stack-basicstation-balena :

[Info]          Starting build for basicstation, user info298
[Info]          Dashboard link: https://dashboard.balena-cloud.com/apps/2325838/devices
[Error]         Could not detect project type: Service basicstation: Could not find a Dockerfile for this service
[Error]         Not deploying release.
Remote build failed

https://github.com/mpous/basicstation :

[Info]          Starting build for basicstation, user info298
[Info]          Dashboard link: https://dashboard.balena-cloud.com/apps/2325838/devices
[Info]          Building on 28fcfdc
[Info]          No suitable previous release for caching, skipping cache pull
[basicstation]  Step 1/11 : FROM balenalib/raspberrypi3-debian:buster-build as builder
[basicstation]   ---> ac52f95948ca
[basicstation]  Step 2/11 : WORKDIR /usr/src/app
[basicstation]  Using cache
[basicstation]   ---> 36c0d256450d
[basicstation]  Step 3/11 : COPY . .
[basicstation]  Using cache
[basicstation]   ---> 50eb3d4d50cd
[basicstation]  Step 4/11 : RUN make platform=rpi variant=std arch=armv7hf
[basicstation]  Using cache
[basicstation]   ---> 14313736a3eb
[basicstation]  Step 5/11 : RUN make platform=corecell variant=std arch=armv7hf
[basicstation]  Using cache
[basicstation]   ---> ed101dd863cd
[basicstation]  Step 6/11 : FROM balenalib/raspberrypi3-debian:buster
[basicstation]   ---> 63d84a5d0f55
[basicstation]  Step 7/11 : RUN install_packages jq
[basicstation]   ---> Running in 98618563faf1
[basicstation]  E: The repository 'http://deb.debian.org/debian buster Release' does not have a Release file.
[basicstation]  E: The repository 'http://deb.debian.org/debian-security buster/updates Release' does not have a Release file.
[basicstation]  E: The repository 'http://deb.debian.org/debian buster-updates Release' does not have a Release file.
[basicstation]  E: The repository 'http://archive.raspbian.org/raspbian buster Release' does not have a Release file.
[basicstation]  
[basicstation]  apt failed, retrying
[basicstation]  E: The repository 'http://deb.debian.org/debian buster Release' does not have a Release file.
[basicstation]  E: The repository 'http://deb.debian.org/debian-security buster/updates Release' does not have a Release file.
[basicstation]  E: The repository 'http://deb.debian.org/debian buster-updates Release' does not have a Release file.
[basicstation]  E: The repository 'http://archive.raspbian.org/raspbian buster Release' does not have a Release file.
[basicstation]  
[basicstation]  apt failed, retrying
[basicstation]  E: The repository 'http://deb.debian.org/debian buster Release' does not have a Release file.
[basicstation]  E: The repository 'http://deb.debian.org/debian-security buster/updates Release' does not have a Release file.
[basicstation]  E: The repository 'http://deb.debian.org/debian buster-updates Release' does not have a Release file.
[basicstation]  E: The repository 'http://archive.raspbian.org/raspbian buster Release' does not have a Release file.
[basicstation]  
[basicstation]  Removing intermediate container 98618563faf1
[basicstation]  The command '/bin/sh -c install_packages jq' returned a non-zero code: 100
[Info]          Uploading images
[Success]       Successfully uploaded images
[Error]         Some services failed to build:
[Error]           Service: basicstation
[Error]             Error: The command '/bin/sh -c install_packages jq' returned a non-zero code: 100
[Info]          Built on 28fcfdc
[Error]         Not deploying release.
Remote build failed

https://github.com/lorabasics/basicstation :

[Info]     Starting build for basicstation, user info298
[Info]     Dashboard link: https://dashboard.balena-cloud.com/apps/2325838/devices
[Info]     Building on a8df1a3
[Info]     No suitable previous release for caching, skipping cache pull
[main]     Step 1/11 : FROM ubuntu:18.04
[main]      ---> e1317ca4808c
[main]     Step 2/11 : ENV container=docker TERM=xterm LC_ALL=en_US LANGUAGE=en_US LANG=en_US.UTF-8
[main]      ---> Running in 33bf0b2beab0
[main]     Removing intermediate container 33bf0b2beab0
[main]      ---> 49fe213fca5b
[main]     Step 3/11 : ENV DEBIAN_FRONTEND=noninteractive
[main]      ---> Running in 1fcc53658abd
[main]     Removing intermediate container 1fcc53658abd
[main]      ---> ec3336346ec4
[main]     Step 4/11 : RUN apt-get update -q > /dev/null &&         apt-get install --no-install-recommends -yq apt-utils locales language-pack-en dialog         > /dev/null &&         locale-gen $LANGUAGE $LANG
[main]      ---> Running in 8ae2fa445a95
[main]     perl: warning: Setting locale failed.
[main]     perl: warning: Please check that your locale settings:
[main]     	LANGUAGE = "en_US",
[main]     	LC_ALL = "en_US",
[main]     	LANG = "en_US.UTF-8"
[main]         are supported and installed on your system.
[main]     perl: warning: Falling back to the standard locale ("C").
[main]     
[main]     debconf: delaying package configuration, since apt-utils is not installed
[main]     
[main]     /bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US)
[main]     
[main]     Generating locales (this might take a while)...
[main]       en_US.ISO-8859-1
[main]     ...
[main]      done
[main]       en_US.UTF-8
[main]     ...
[main]      done
[main]     Generation complete.
[main]     Removing intermediate container 8ae2fa445a95
[main]      ---> a41e710b58a5
[main]     Step 5/11 : RUN apt-get -yq install sudo > /dev/null
[main]      ---> Running in 8c568e8e771b
[main]     Removing intermediate container 8c568e8e771b
[main]      ---> c3933c619577
[main]     Step 6/11 : RUN echo "nonprivuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
[main]      ---> Running in 6d4baa79deaf
[main]     Removing intermediate container 6d4baa79deaf
[main]      ---> 3477e8f6202c
[main]     Step 7/11 : RUN useradd --no-log-init --home-dir /home/nonprivuser --create-home --shell /bin/bash -u 1000         nonprivuser && adduser nonprivuser sudo
[main]      ---> Running in beb9158f4832
[main]     Adding user `nonprivuser' to group `sudo' ...
[main]     Adding user nonprivuser to group sudo
[main]     Done.
[main]     Removing intermediate container beb9158f4832
[main]      ---> 7f74d8968e19
[main]     Step 8/11 : USER nonprivuser
[main]      ---> Running in e1f6e3d9f544
[main]     Removing intermediate container e1f6e3d9f544
[main]      ---> 15b4dfa712ac
[main]     Step 9/11 : WORKDIR /home/nonprivuser
[main]      ---> Running in 505792de89f7
[main]     Removing intermediate container 505792de89f7
[main]      ---> 7413fb0d4d5c
[main]     Step 10/11 : RUN sudo apt-get install --no-install-recommends -yq         git psmisc build-essential lcov curl netcat-openbsd         python3 python3-pip python3-setuptools python3-wheel         > /dev/null &&         sudo apt-get clean -q &&         sudo ln -s /usr/bin/python3 /usr/bin/python
[main]      ---> Running in d28c61a749f4
[main]     dpkg-preconfigure: unable to re-open stdin: No such file or directory
[main]     
[main]     Removing intermediate container d28c61a749f4
[main]      ---> 8566beb171b0
[main]     Step 11/11 : RUN pip3 install aiohttp websockets
[main]      ---> Running in 39051decf27a
[main]     Collecting aiohttp
[main]       Downloading https://files.pythonhosted.org/packages/fd/01/f180d31923751fd20185c96938994823f00918ee5ac7b058edc005382406/aiohttp-3.8.6.tar.gz (7.4MB)
[main]         Complete output from command python setup.py egg_info:
[main]         *********************
[main]         * Accelerated build *
[main]         *********************
[main]         Traceback (most recent call last):
[main]           File "<string>", line 1, in <module>
[main]           File "/tmp/pip-build-ed55uv1l/aiohttp/setup.py", line 54, in <module>
[main]             setup(**setup_kwargs)
[main]           File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 129, in setup
[main]             return distutils.core.setup(**attrs)
[main]           File "/usr/lib/python3.6/distutils/core.py", line 121, in setup
[main]             dist.parse_config_files()
[main]           File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 494, in parse_config_files
[main]             ignore_option_errors=ignore_option_errors)
[main]           File "/usr/lib/python3/dist-packages/setuptools/config.py", line 106, in parse_configuration
[main]             meta.parse()
[main]           File "/usr/lib/python3/dist-packages/setuptools/config.py", line 382, in parse
[main]             section_parser_method(section_options)
[main]           File "/usr/lib/python3/dist-packages/setuptools/config.py", line 355, in parse_section
[main]             self[name] = value
[main]           File "/usr/lib/python3/dist-packages/setuptools/config.py", line 173, in __setitem__
[main]             value = parser(value)
[main]           File "/usr/lib/python3/dist-packages/setuptools/config.py", line 430, in _parse_version
[main]             version = self._parse_attr(value)
[main]           File "/usr/lib/python3/dist-packages/setuptools/config.py", line 305, in _parse_attr
[main]             module = import_module(module_name)
[main]           File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
[main]             return _bootstrap._gcd_import(name[level:], package, level)
[main]           File "<frozen importlib._bootstrap>", line 994, in _gcd_import
[main]           File "<frozen importlib._bootstrap>", line 971, in _find_and_load
[main]           File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
[main]           File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
[main]           File "<frozen importlib._bootstrap_external>", line 678, in exec_module
[main]           File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
[main]           File "/tmp/pip-build-ed55uv1l/aiohttp/aiohttp/__init__.py", line 5, in <module>
[main]             from . import hdrs as hdrs
[main]           File "/tmp/pip-build-ed55uv1l/aiohttp/aiohttp/hdrs.py", line 8, in <module>
[main]             from multidict import istr
[main]         ModuleNotFoundError: No module named 'multidict'
[main]         ----------------------------------------
[main]     Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ed55uv1l/aiohttp/
[main]     
[main]     Removing intermediate container 39051decf27a
[main]     The command '/bin/sh -c pip3 install aiohttp websockets' returned a non-zero code: 1
[Info]     Uploading images
[Success]  Successfully uploaded images
[Error]    Some services failed to build:
[Error]      Service: main
[Error]        Error: The command '/bin/sh -c pip3 install aiohttp websockets' returned a non-zero code: 1
[Info]     Built on a8df1a3
[Error]    Not deploying release.
Remote build failed

Maybe someone has an idea how to accomplish running a Basicstation on Balena.

Funny fact: I had it working with this hardware. I set it up years ago: I remember pushing a Balena Deploy button from a GitHub repository and followed the instructions and….it worked and connected to The Thing Network. I even found a photo of it. But I used the SD-card for something else, so I erased it a few weeks ago :laughing: :grimacing: :face_with_peeking_eye: :slight_smile:

Any help appreciated!

Hi, if you had it working in your “TTNGateway” fleet as pictured, you should be able to go to the devices page for that fleet, “add new device” and download the same working image to flash to the device. (in other words, don’t try to build it again.) Just make sure the new device is on the same working release. This of course doesn’t address the errors when trying a new build, which would require more analysis.

@alanb128 Thanks for your reply. Unfortunately I deleted everything.

Ah, I see. You’ll need to go through the Dockerfiles and update them a bit to fix the errors then try re-pushing with the CLI. For instance, in your first example, try replacing RUN install_packages jq with RUN apt-get update && apt-get install -y jq

Also note the repo message: This project is deprecated! You can see the balena basicstation updated here

https://github.com/xoseperez/basicstation

Hi @alanb128 Thanks again. Yes, I read it. But since it is a direct link from Balena’s Hubpage, I thought maybe they use an old release on purpose. The RAK831 and RPI3 I use are also ancient.

That also gives an error:

[basicstation]  Removing intermediate container aa7611c64759
[basicstation]  The command '/bin/sh -c RUN apt-get update && apt-get install -y jq' returned a non-zero code: 127
[Info]          Uploading images
[Success]       Successfully uploaded images
[Error]         Some services failed to build:
[Error]           Service: basicstation
[Error]             Error: The command '/bin/sh -c RUN apt-get update && apt-get install -y jq' returned a non-zero code: 127
[Info]          Built on 28fcfdc
[Error]         Not deploying release.
Remote build failed

I also tried https://github.com/xoseperez/basicstation-docker with CLI.

I checked the docker-compose.yaml with https://codebeautify.org/yaml-validator/, but I keep on getting an error:

data/services should NOT have additional properties

That docker-compose file is missing a version at the top. Adding version: 2.4 at the top makes it build.

I will try. Thanks

In the meanwhile I managed to compile Basics Station on the RPI and got it working with the RAK831 concentrator. It connects to The Things Stack V3 and is stable. Unfortunately Balena is out of the loop this way.