Running the official Ruuviberry image on Raspberry Pi Zero W

I tried running the example Raspberry Pi image from https://lab.ruuvi.com/ruuvitag-fw/ on a Raspberry Pi Zero W, but it didn’t work. Everything else is fine, but the included Grafana binary was compiled for armv7, and Raspberry Pi Zero is armv6. I was able to make it work by taking the compiler from here https://github.com/raspberrypi/tools/
as well as Grafana 4.6.3 sources, and compiling with the following command:

CFLAGS=’-march=armv6 -mfloat-abi=hard -mfpu=vfp’ CC=/home/jl/tools/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc CGO_ENABLED=1 GOARCH=arm GOARM=6 go build -o ./bin/grafana-server ./pkg/cmd/grafana-server

Thus created grafana-server binary runs fine on the Zero. You might want to do the same fix on the official image.

2 Likes

…and before other people waste equal amounts of time on this: The ARM GCC cross-compiler from the Debian Stretch package gcc-6-arm-linux-gnueabihf (as well as 7 and 8) will silently produce armv7 binaries even when you say -march=armv6.

reports:

pi >/usr/sbin/grafana-server
Illegal instruction

pi > ls -l /usr/sbin/grafana-server
-rwxr-xr-x 1 root root 24929556 Dec 28 06:51 /usr/sbin/grafana-server

pi > file /usr/sbin/grafana-server
/usr/sbin/grafana-server: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.32, BuildID[sha1]=f6956bfb86b91fec898814a2115fbdd7e9b72fca, not stripped

It happens that the grafana version included in the image is from this github release which is indeed built only for pi2/pi3.
But, a pi1 version is also made available, as explained in the corresponding wiki (see the apt/bintray part). You can go without apt-get and download it directly from bintray.
If the image is supposed to be used also on pi1, this is the version that should be installed and this is a bug.
By the way, I don’t understand why the bintray repo is not added to apt-get source. That would allow an easy upgrade.

PS: thanks to the nice limited link policy for new used :

  • wiki is accessible from the link on the release

Hello,

First of all, Thank You for maintaining the Grafana on Raspberry.
I’ll add a note for Raspberry Pi 1 users on our blog post (draft) on how to make Raspberry Pi GW.

An update: while running Grafana and InfluxDB on the Raspberry Pi Zero W does work, the performance after a few weeks of collecting data is terrible. Not sure why, but it takes over 30 seconds to render graphs for the past 7 days of data. The bottleneck would seem to be in InfluxDB.

You might need to create a retention policy to downsample the data or send the data to a more capable server on the cloud.

You may need to check your queries in Grafana that you are using an appropriate group by time interval, otherwise that will clog up even the beefiest machines if it blindly retrieves every single datapoint every time

2 Likes

Scrin, thanks! The group by interval was the problem. I had it set to a fixed value, and after setting it to $__interval the graphs render much faster.