Unable to push basicstation

When pushing basisstation (with balena-CLI) to a RAK7248 (RAK2287) i get the following error:
Error: The command '/bin/sh -c make platform=rpi variant=std arch=aarch64’returned a non-zero code 2
Pushing the-things-stack works fine, using a link where a fleet is generated and also the release: The Things Stack Gateway it works fine.
I would like to push the stack and basicstation.
When i follow the tutorial for this i get the same error when i uncomment basicstation.
So when building basicstation (CLI) the error occurs.
OS version: balenaOS2.82.10+rev1, cloned the latest submodels.
What is going wrong?

Hi Evert,

did you try this tutorial Deploy a LoRa Basics™ Station gateway with TTN and balena ? I am trying to understand at what point are you getting stuck. Can you try pushing this code GitHub - mpous/basicstation: LoRa Basics™ Station - The LoRaWAN Gateway Software

Hi,
I followed the tutorial (Run your private The Things Stack network server on a Raspberry Pi with balena) and this works fine.
I followed the tutorial (Deploy a LoRa Basics™ Station gateway with TTN and balena) this also works fine, but when i use the (optional) CLI method with the latest basicstation code from github. i get an error.
I get stuck when pushing the basicstation code to balena using the CLI (on windows 10) in the build process for the basicstation service (container).

When i follow the tutorial for basicstation + stack i get the same error when i uncomment the basicstation submodule in the docker-ompose.yml.

Thanks @eversteeg for getting back. As I understand you are not able to get the container built for basicstation with the multiapp setup here: the-things-stack-balena/docker-compose.yml at master · xoseperez/the-things-stack-balena · GitHub.

Can you try just pushing the basicstation service (GitHub - mpous/basicstation: LoRa Basics™ Station - The LoRaWAN Gateway Software) as my colleague @iamsolankiamit has suggested above, and let us know if you are facing any errors?

Regards,
N

What Raspberry Pi are you using @eversteeg ?

A Pi 4, 4GB, RAK7248, ordered for the the things academy summer school, just watched your video / Q&A

That’s odd @eversteeg could you please give it another try?

@mpous Started all over with a new account, different computer, installed the CLI etc.
No change.

I tried to start a fleet from the HUB (basicstation + LNS), i get the folllowing error with the release that comes with the project:

[Info] Starting build for the-things-stack-basicstation-balena, user e_versteeg
[Info] Dashboard link: balena dashboard
[Error] Could not detect project type: Service basicstation: Could not find a Dockerfile for this service
[Error] Not deploying release.

@mpous @eversteeg the issue seems to be that the repository in question uses git submodules. When you use the deploy with balena process, the balena side is requesting the source from GitHub using their tarball feature. The balena backend takes the repo URL and uses to request a tarball of the repository from GitHub, which it then extracts and tries to build. The issue is that GitHub do not include submodules within their tarballs (see here) - this appears to be a longstanding feature request which isn’t going to change soon. This is what causes the ‘Could not find a Dockerfile for this service’ error - because there simply is no Dockerfile for this service, as the submodule (in this case basicstation) has not been downloaded. The same issue would occur for the other two submodules (wifi-connect and balena-legacy-packet-forwader) if they were enabled.

This problem will also occur if you download the tarball or zip and extract it locally in order to use balena push, submodules are not included.

The only way to address this that I’m aware of is to clone the repository locally using git and then update the submodules using something like git submodule update --recursive, but this then requires that you have a local installation of git.

If GitHub does start building tarballs with the submodules included this will just start working, but until then I’d recommend avoiding their use - perhaps open an issue on the repo in question to highlight this. We do have this limitation highlighted in the DWB docs also.

@chrisys @mpous I have git (for windows installed) and followed this readme: GitHub - mpous/the-things-stack-basicstation-influxdb-grafana-balena

Used this commands:
git clone GitHub - xoseperez/the-things-stack-balena: Deploys the The Things Stack LoRaWAN Network Server Open Sourc
cd balena-tts-lns
git submodule update --init => mudules are checked out (legacy-forwarder, basicstation and wifi)

Then did this: Edit the docker-compose.yml file and uncommented the BasicStation service.

Then: balena push fleet-name

I get the following error (it happens when buiding basicstation):

[basicstation] /bin/sh: 1: ./prep.sh: Permission denied
[basicstation]
[basicstation] make[1]: Leaving directory ‘/usr/src/app/deps/mbedtls’
[basicstation] make[1]: *** [makefile:55: platform-rpi] Error 126
[basicstation]
[basicstation] make: *** [makefile:67: deps/mbedtls] Error 2
[basicstation]
[basicstation] Removing intermediate container c9fed18c782d
[basicstation] The command ‘/bin/sh -c make platform=rpi variant=std arch=aarch64’ returned a non-zero code: 2

And a at the end:

[stack] Successfully built 83520653cee4
[postgres] [=========================================================] 100%
[Info] Uploading images
[Success] Successfully uploaded images
[Error] Some services failed to build:
[Error] Service: basicstation
[Error] Error: The command ‘/bin/sh -c make platform=rpi variant=std arch=aarch64’ returned a non-zero code: 2
[Info] Built on arm02
[Error] Not deploying release.
Remote build failed

In the dashboard i see a release is statring to build.
But it stops when the access is denied (some file in the cloud?)

The same happens when i push the basicstation container without stack, redis and postgress.

@mpous Up and running now, weird windows permission thing…
Started again on macOS, now it works!
Thanks for the help!

1 Like

Glad to hear that it worked out for you, let us know if you need any more help!

Solved using this as Dockerfile.template
FROM balenalib/%%BALENA_MACHINE_NAME%%-debian:buster-build as builder

WORKDIR /usr/src/app

COPY . .

RUN sudo chmod +x deps/mbedtls/prep.sh

RUN sudo chmod +x deps/lgw/prep.sh

RUN sudo chmod +x deps/lgw1302/prep.sh

RUN sudo chmod +x deps/smtcpico/prep.sh

RUN make platform=rpi variant=std arch=%%BALENA_ARCH%%

RUN make platform=corecell variant=std arch=%%BALENA_ARCH%%

FROM balenalib/%%BALENA_MACHINE_NAME%%-debian:buster

RUN install_packages jq

WORKDIR /usr/src/app

COPY --from=builder /usr/src/app/ ./

COPY start* ./

CMD [“bash”, “start.sh”]

2 Likes

Hello @tagar welcome to the balena forums. Are you running the basicstation on a Pi Zero?

Hello @tagar I know this is an old issue and there is a pending PR to be accepted. I have tried myself and my pi zero is not working with this solution! Does it work on your side? Thanks!