ChirpStack on Raspberry Pi Zero W

For reasons that are particular to my application, I need to put a full installation of ChirpStack on a Raspberry Pi Zero W running Raspberry Pi OS Lite. The instructions for " Quickstart Debian or Ubuntu" seem to work at first, but the ChirpStack executables will not start. I have tried GatewayOS, and it runs on my setup, but I cannot use the underlying OS to run other software I must also run on the same machine. I have to be running the official Raspberry Pi OS.

Other people seem to have solved this problem, but the explanations of how they did it are too cryptic for someone of my level of competence.

Can what I need to do be done? And if so, could someone with patience please show me how?

Thanks,

    Keith

Have no Pi, but…
What do you mean by full? For the Chirpstack Services (GW-Bridge, AS, NS) you’ll need to compile executables for your architecture. The guide assumes you have the “Big” Raspberry which targets armv7, the nano is afaik armv5. https://www.thepolyglotdeveloper.com/2017/04/cross-compiling-golang-applications-raspberry-pi/

You can find a package for your architecture on:
https://artifacts.chirpstack.io/downloads/

For Example:
https://artifacts.chirpstack.io/downloads/chirpstack-application-server/chirpstack-application-server_3.10.0_linux_armv5.deb

That’s probably the easy part. Getting Postgresql + Redis and the “lora-radio” working is out of my scope and you’ll have to find somebody else.

Thank you, chopmann, but none of the artifacts will install on the Raspberry Pi Zero W running Raspberry Pi OS Lite.

As an alternative, I could run ChirpStackOS if I could load programs. I need Python. However, all methods for loading programs in ChirpStackOS have been disabled. As such, it is pretty much useless to me.

Unfortunately, I purchased two RAK2246 gateways from RAK Wireless, and it looks like they are no good to me now.

Hi keithrussell,

i also had a similar problem about a year ago:

https://forum.chirpstack.io/t/bad-debian-package-for-armv6-raspberry-pi-zero-w/8497

Try to install the deb package and then download the binary and overwrite the installed one.

Could you share the error when you try to run or install the ..._armv5.deb packages? While I haven’t tried it myself, I believe the armv5 should run on the Pi OS Lite as Pi OS Lite is based on Debian. If it doesn’t work, then potentially this is a bug in the packaging.

I could run ChirpStackOS if I could load programs

You can by extending the images. E.g. add python to https://github.com/brocaar/chirpstack-gateway-os/blob/master/meta/recipes-core/images/chirpstack-gateway-os-base.bb#L7 and build a new image. https://layers.openembedded.org/layerindex/branch/dunfell/recipes/ is a search engine for recipes that can be used with Yocto (which is used to build the ChirpStack Gateway OS).

brocaar:

Thanks for your help with this. When I try the _armv5.deb package, I get the error: “dpkg: error processing archive chirpstack-gateway-bridge_3.11.0-test.1_linux_armv5.deb (–install): package architecture (arm5) does not match system (armhf)”

I notice that you have armhf packages, but only in the older lora- versions.

The task I am trying to complete is to make some demonstration boxes that each contain a LoRaWAN gateway, a small amount of support electronics, and six lights. The six lights have various colors that correspond to events on six devices. I need about 20 lines of Python code on the gateway to glue it all together. I can do this just fine on the Pi3 and Pi4 versions, but for space and cost reasons, I wanted to use the RAKWireless RAK7246 based on the Raspberry Pi Zero W.

I may be wrong, but my opinion is that the Python application will not over-tax the Zero W. Consequently, I need to either 1) get Chirpstack running on the RPi armhf platform or 2) get python running on ChirpStackOS.

Next, I will be trying to add Python to your ChirpStackIO package and see if that works.

Again, I thank you for your assistance and I welcome any other ideas you have on this.

@keithrussell I was in the understanding that the Pi Zero armv5 but I think I was wrong. Could you try again with the ..._armv7.deb packages? Looking at the control file within the .deb packages, this should match the OS architecture:

Package: chirpstack-gateway-bridge
...
Architecture: armhf
...

That should be faster than building your own ChirpStack Gateway OS images :slight_smile:

Update: this could be an interesting read: https://raspberrypi.stackexchange.com/questions/83374/raspberry-pi-zero-w-is-armv6-or-armv7.

@brocaar Thanks again for the help. I feel like I may be making progress, but I’m not quite there yet.

I did the complete manual install described here: https://www.chirpstack.io/project/guides/debian-ubuntu/ including the ChirpStack Gateway Bridge, and the programs installed without complaint. I did the Postgresql setup and mosquitto install, and they load and run. Then I did the rak_common_for_gateway install, allowing it to bypass the ChirpStack installation.

Now when I start any of the ChirpStack programs or reboot, I get the following errors:

– Logs begin at Mon 2021-04-26 16:59:25 EDT. –
Apr 26 16:59:56 rak-gateway systemd[1]: Started ChirpStack Network Server.
Apr 26 16:59:56 rak-gateway systemd[1]: Started ChirpStack Application Server.
Apr 26 16:59:57 rak-gateway systemd[1]: Started ChirpStack Gateway Bridge.
Apr 26 16:59:57 rak-gateway systemd[1]: chirpstack-network-server.service: Main process exited, code=killed, status=4/ILL
Apr 26 16:59:57 rak-gateway systemd[1]: chirpstack-network-server.service: Failed with result ‘signal’.
Apr 26 16:59:57 rak-gateway systemd[1]: chirpstack-application-server.service: Main process exited, code=killed, status=4/ILL
Apr 26 16:59:57 rak-gateway systemd[1]: chirpstack-application-server.service: Failed with result ‘signal’.
Apr 26 16:59:57 rak-gateway systemd[1]: chirpstack-gateway-bridge.service: Main process exited, code=killed, status=4/ILL
Apr 26 16:59:57 rak-gateway systemd[1]: chirpstack-gateway-bridge.service: Failed with result ‘signal’.
Apr 26 16:59:58 rak-gateway systemd[1]: chirpstack-network-server.service: Service RestartSec=100ms expired, scheduling restart.
Apr 26 16:59:58 rak-gateway systemd[1]: chirpstack-network-server.service: Scheduled restart job, restart counter is at 1.
Apr 26 16:59:58 rak-gateway systemd[1]: chirpstack-application-server.service: Service RestartSec=100ms expired, scheduling restart.
Apr 26 16:59:58 rak-gateway systemd[1]: chirpstack-application-server.service: Scheduled restart job, restart counter is at 1.
Apr 26 16:59:58 rak-gateway systemd[1]: chirpstack-gateway-bridge.service: Service RestartSec=100ms expired, scheduling restart.
Apr 26 16:59:58 rak-gateway systemd[1]: chirpstack-gateway-bridge.service: Scheduled restart job, restart counter is at 1.
Apr 26 16:59:58 rak-gateway systemd[1]: Stopped ChirpStack Gateway Bridge.
Apr 26 16:59:58 rak-gateway systemd[1]: Started ChirpStack Gateway Bridge.
Apr 26 16:59:59 rak-gateway systemd[1]: Stopped ChirpStack Application Server.
Apr 26 16:59:59 rak-gateway systemd[1]: Started ChirpStack Application Server.
Apr 26 16:59:59 rak-gateway systemd[1]: Stopped ChirpStack Network Server.
Apr 26 16:59:59 rak-gateway systemd[1]: Started ChirpStack Network Server.
Apr 26 16:59:59 rak-gateway systemd[1]: chirpstack-gateway-bridge.service: Main process exited, code=killed, status=4/ILL
Apr 26 16:59:59 rak-gateway systemd[1]: chirpstack-gateway-bridge.service: Failed with result ‘signal’.
Apr 26 16:59:59 rak-gateway systemd[1]: chirpstack-application-server.service: Main process exited, code=killed, status=4/ILL
Apr 26 16:59:59 rak-gateway systemd[1]: chirpstack-application-server.service: Failed with result ‘signal’.
Apr 26 16:59:59 rak-gateway systemd[1]: chirpstack-network-server.service: Main process exited, code=killed, status=4/ILL
Apr 26 16:59:59 rak-gateway systemd[1]: chirpstack-network-server.service: Failed with result ‘signal’.
Apr 26 16:59:59 rak-gateway systemd[1]: chirpstack-gateway-bridge.service: Service RestartSec=100ms expired, scheduling restart.
Apr 26 16:59:59 rak-gateway systemd[1]: chirpstack-gateway-bridge.service: Scheduled restart job, restart counter is at 2.
Apr 26 16:59:59 rak-gateway systemd[1]: chirpstack-network-server.service: Service RestartSec=100ms expired, scheduling restart.
Apr 26 16:59:59 rak-gateway systemd[1]: chirpstack-network-server.service: Scheduled restart job, restart counter is at 2.
Apr 26 17:00:00 rak-gateway systemd[1]: chirpstack-application-server.service: Service RestartSec=100ms expired, scheduling restart.
Apr 26 17:00:00 rak-gateway systemd[1]: chirpstack-application-server.service: Scheduled restart job, restart counter is at 2.
Apr 26 17:00:00 rak-gateway systemd[1]: Stopped ChirpStack Application Server.
Apr 26 17:00:00 rak-gateway systemd[1]: Started ChirpStack Application Server.
Apr 26 17:00:00 rak-gateway systemd[1]: Stopped ChirpStack Network Server.
Apr 26 17:00:00 rak-gateway systemd[1]: Started ChirpStack Network Server.
Apr 26 17:00:00 rak-gateway systemd[1]: Stopped ChirpStack Gateway Bridge.
Apr 26 17:00:00 rak-gateway systemd[1]: Started ChirpStack Gateway Bridge.
Apr 26 17:00:00 rak-gateway systemd[1]: chirpstack-application-server.service: Main process exited, code=killed, status=4/ILL
Apr 26 17:00:00 rak-gateway systemd[1]: chirpstack-application-server.service: Failed with result ‘signal’.
Apr 26 17:00:00 rak-gateway systemd[1]: chirpstack-network-server.service: Main process exited, code=killed, status=4/ILL
Apr 26 17:00:00 rak-gateway systemd[1]: chirpstack-network-server.service: Failed with result ‘signal’.
Apr 26 17:00:00 rak-gateway systemd[1]: chirpstack-gateway-bridge.service: Main process exited, code=killed, status=4/ILL
Apr 26 17:00:00 rak-gateway systemd[1]: chirpstack-gateway-bridge.service: Failed with result ‘signal’.
Apr 26 17:00:00 rak-gateway systemd[1]: chirpstack-application-server.service: Service RestartSec=100ms expired, scheduling restart.
Apr 26 17:00:00 rak-gateway systemd[1]: chirpstack-application-server.service: Scheduled restart job, restart counter is at 3.
Apr 26 17:00:01 rak-gateway systemd[1]: chirpstack-network-server.service: Service RestartSec=100ms expired, scheduling restart.
Apr 26 17:00:01 rak-gateway systemd[1]: chirpstack-network-server.service: Scheduled restart job, restart counter is at 3.
Apr 26 17:00:01 rak-gateway systemd[1]: chirpstack-gateway-bridge.service: Service RestartSec=100ms expired, scheduling restart.
Apr 26 17:00:01 rak-gateway systemd[1]: chirpstack-gateway-bridge.service: Scheduled restart job, restart counter is at 3.
Apr 26 17:00:01 rak-gateway systemd[1]: Stopped ChirpStack Gateway Bridge.
Apr 26 17:00:01 rak-gateway systemd[1]: Started ChirpStack Gateway Bridge.
Apr 26 17:00:01 rak-gateway systemd[1]: Stopped ChirpStack Network Server.
Apr 26 17:00:01 rak-gateway systemd[1]: Started ChirpStack Network Server.
Apr 26 17:00:01 rak-gateway systemd[1]: Stopped ChirpStack Application Server.
Apr 26 17:00:01 rak-gateway systemd[1]: Started ChirpStack Application Server.
Apr 26 17:00:01 rak-gateway systemd[1]: chirpstack-gateway-bridge.service: Main process exited, code=killed, status=4/ILL
Apr 26 17:00:01 rak-gateway systemd[1]: chirpstack-gateway-bridge.service: Failed with result ‘signal’.
Apr 26 17:00:01 rak-gateway systemd[1]: chirpstack-network-server.service: Main process exited, code=killed, status=4/ILL
Apr 26 17:00:01 rak-gateway systemd[1]: chirpstack-network-server.service: Failed with result ‘signal’.
Apr 26 17:00:01 rak-gateway systemd[1]: chirpstack-application-server.service: Main process exited, code=killed, status=4/ILL
Apr 26 17:00:01 rak-gateway systemd[1]: chirpstack-application-server.service: Failed with result ‘signal’.
Apr 26 17:00:01 rak-gateway systemd[1]: chirpstack-gateway-bridge.service: Service RestartSec=100ms expired, scheduling restart.
Apr 26 17:00:01 rak-gateway systemd[1]: chirpstack-gateway-bridge.service: Scheduled restart job, restart counter is at 4.
Apr 26 17:00:01 rak-gateway systemd[1]: Stopped ChirpStack Gateway Bridge.
Apr 26 17:00:01 rak-gateway systemd[1]: Started ChirpStack Gateway Bridge.
Apr 26 17:00:01 rak-gateway systemd[1]: chirpstack-gateway-bridge.service: Main process exited, code=killed, status=4/ILL
Apr 26 17:00:01 rak-gateway systemd[1]: chirpstack-gateway-bridge.service: Failed with result ‘signal’.
Apr 26 17:00:01 rak-gateway systemd[1]: chirpstack-network-server.service: Service RestartSec=100ms expired, scheduling restart.
Apr 26 17:00:01 rak-gateway systemd[1]: chirpstack-network-server.service: Scheduled restart job, restart counter is at 4.
Apr 26 17:00:01 rak-gateway systemd[1]: chirpstack-application-server.service: Service RestartSec=100ms expired, scheduling restart.
Apr 26 17:00:01 rak-gateway systemd[1]: chirpstack-application-server.service: Scheduled restart job, restart counter is at 4.
Apr 26 17:00:01 rak-gateway systemd[1]: Stopped ChirpStack Application Server.
Apr 26 17:00:02 rak-gateway systemd[1]: Started ChirpStack Application Server.
Apr 26 17:00:02 rak-gateway systemd[1]: Stopped ChirpStack Network Server.
Apr 26 17:00:02 rak-gateway systemd[1]: Started ChirpStack Network Server.
Apr 26 17:00:02 rak-gateway systemd[1]: chirpstack-application-server.service: Main process exited, code=killed, status=4/ILL
Apr 26 17:00:02 rak-gateway systemd[1]: chirpstack-application-server.service: Failed with result ‘signal’.
Apr 26 17:00:02 rak-gateway systemd[1]: chirpstack-network-server.service: Main process exited, code=killed, status=4/ILL
Apr 26 17:00:02 rak-gateway systemd[1]: chirpstack-network-server.service: Failed with result ‘signal’.
Apr 26 17:00:02 rak-gateway systemd[1]: chirpstack-gateway-bridge.service: Service RestartSec=100ms expired, scheduling restart.
Apr 26 17:00:02 rak-gateway systemd[1]: chirpstack-gateway-bridge.service: Scheduled restart job, restart counter is at 5.
Apr 26 17:00:02 rak-gateway systemd[1]: Stopped ChirpStack Gateway Bridge.
Apr 26 17:00:02 rak-gateway systemd[1]: chirpstack-gateway-bridge.service: Start request repeated too quickly.
Apr 26 17:00:02 rak-gateway systemd[1]: chirpstack-gateway-bridge.service: Failed with result ‘signal’.
Apr 26 17:00:02 rak-gateway systemd[1]: Failed to start ChirpStack Gateway Bridge.
Apr 26 17:00:02 rak-gateway systemd[1]: chirpstack-application-server.service: Service RestartSec=100ms expired, scheduling restart.
Apr 26 17:00:02 rak-gateway systemd[1]: chirpstack-application-server.service: Scheduled restart job, restart counter is at 5.
Apr 26 17:00:02 rak-gateway systemd[1]: chirpstack-network-server.service: Service RestartSec=100ms expired, scheduling restart.
Apr 26 17:00:02 rak-gateway systemd[1]: chirpstack-network-server.service: Scheduled restart job, restart counter is at 5.
Apr 26 17:00:02 rak-gateway systemd[1]: Stopped ChirpStack Network Server.
Apr 26 17:00:02 rak-gateway systemd[1]: chirpstack-network-server.service: Start request repeated too quickly.
Apr 26 17:00:02 rak-gateway systemd[1]: chirpstack-network-server.service: Failed with result ‘signal’.
Apr 26 17:00:02 rak-gateway systemd[1]: Failed to start ChirpStack Network Server.
Apr 26 17:00:02 rak-gateway systemd[1]: Stopped ChirpStack Application Server.
Apr 26 17:00:02 rak-gateway systemd[1]: chirpstack-application-server.service: Start request repeated too quickly.
Apr 26 17:00:02 rak-gateway systemd[1]: chirpstack-application-server.service: Failed with result ‘signal’.
Apr 26 17:00:02 rak-gateway systemd[1]: Failed to start ChirpStack Application Server.

What do I need to do next?

@brocaar

Sorry, I forgot to mention that I did all the above on a fresh Raspberry Pi Zero W LITE install with the latest update and upgrade.

Here are my machine stats after the installations:
pi@rak-gateway:~ $ free -h
total used free shared buff/cache available
Mem: 430Mi 39Mi 289Mi 13Mi 100Mi 328Mi
Swap: 99Mi 0B 99Mi
pi@rak-gateway:~ $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 15G 1.6G 13G 12% /
devtmpfs 183M 0 183M 0% /dev
tmpfs 216M 12K 216M 1% /dev/shm
tmpfs 216M 3.1M 212M 2% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 216M 0 216M 0% /sys/fs/cgroup
/dev/mmcblk0p1 253M 48M 205M 19% /boot
tmpfs 44M 0 44M 0% /run/user/1000
pi@rak-gateway:~ $

What you could try is stop the services through systemd systemctl stop chirpstack-.... and start these manually (gw bridge example):

chirpstack-gateway-bridge -c /etc/chirpstack-gateway-bridge/chirpstack-gateway-bridge.toml

That should hopefully give you the exact reason why the process is crashing.

I get:

pi@rak-gateway:~ $ sudo chirpstack-gateway-bridge -c /etc/chirpstack-gateway-bridge/chirpstack-gateway-bridge.toml
Illegal instruction

I start to understand your confusion :wink:

goreleaser (the tool that I use to generate the different binary packages) uses the following mapping from arm version to architecture:

  • armv6 -> armel
  • armv7 -> armhf

It looks like that this is the issue. I believe the armv6 binaries would fail to install because of the armel vs armhf architecture mismatch. The armv7 binaries do install, but can’t be executed because the Pi Zero does not implement the armv7 instruction set.

One more idea, does the following command work for you:

dpkg --add-architecture armel

(https://unix.stackexchange.com/questions/60282/can-one-install-an-armel-ubuntu-package-on-armhf-ubuntu-system/60287#60287)

And then install the armv6 binaries?

@brocaar, this works perfectly. You are a wizard and a gentleman. Thanks so much for your patient help.

1 Like

With the help of @brocaar I was able to find the solution. Here are the general steps:

  1. Create the latest Raspberry Pi OS LITE image, and set up connectivity
  2. Follow GitHub - RAKWireless/rak_common_for_gateway, stopping after the git clone
  3. edit ./rak_common_for_gateway/chirpstack/install.sh to remove (or comment out) the 5 lines that start with: rpi_model=do_get_rpi_model. This will make the script install the wrong ChirpStack binaries, but will perform all the configurations, postgresql, and mosquitto setups properly. Continue with the RAK install, choosing the RAK2246.
  4. run the command “sudo dpkg --add-architecture armel”. This allows the installer to install the …armv6.deb version of ChirpStack
  5. use wget to retrieve the armv6.deb files of the ChirpStack version of your choice from https://artifacts.chirpstack.io/downloads
  6. copy the ChirpStack .toml configuration files to a safe place
  7. install the ChirpStack binaries with "sudo dpkg -i "
  8. reboot
  9. use “ps -aux” to see if everything loaded OK
  10. depending on the ChirpStack version you loaded, the .toml configuration files might be OK. If not, copy them back and reboot.

I know this process is crazy, but it is well worth it. By my tests, the RPi installation leaves more free disk space and more free memory than the ChirpStackOS install, and you will have all the RPi tools available.

1 Like