How to run farmerbot on a Raspberry Pi

Please note: The farmerbot releases for ARM which run on Raspberry Pi are not tested as rigorously as the regular releases. This should be considered as a beta release with limited support. While I’ll do my best to help with any issues that come up, our developers can’t guarantee that ARM specific issues will get fixed in the code, if something were to arise.


Inquiring minds want to know: can you run the ThreeFold famerbot on a Raspberry Pi? The answer is, yes, you can, with a few tweaks from the normal instructions. This method should work with Pi 2, 3, and 4, although I’ve only tested on my Pi 4 so far. Supporting Pi 1 and Zero would be just a bit of extra work, as far as I can see, so drop me a line if you have interest in using one of those models and I’ll see about making it happen.

The tricky part about working with the Pi is that the binary executables we release for Intel and AMD x64 based systems aren’t natively compatible with the ARM based processor in the Pi. To overcome this, we’ll use a combination of recompiled binaries and using an emulator to run the existing binaries, to provide a suitable mix of running services that support a working farmerbot.

For now, I am providing a set of ARM compatible containers hosted in my personal forks of our Github repositories. I’ll be working with the dev team to incorporate this into our normal build cycle and our official repositories.

Prerequisites

To follow this tutorial, you’ll need the following:

  • ARM based computer, with at least ARMv7 or higher chip (Pi 2 and later)
  • 512mb total RAM (~200mb of free RAM is required to run Docker and farmerbot)
  • 1-2gb free storage space
  • Debian based operating system like Raspbian/RPi OS or Ubuntu (I tested on 32 bit “Buster” and 64 bit “Bullseye”)

You can use a different OS if you want to, but the needed packages might have different names and there could be some other quirks to account for. We don’t need a desktop, so the using a “lite” or “server” OS image is okay.

Update: There are now two paths to choose from below, the first is the original option, which works on any of the devices and operating systems mentioned above. If you’re not sure, this is the way to go.

The second option is for 64 bit Pis (3 and 4) running a 64 bit operating system. Note that the default Raspberry Pi OS images are 32 bit. You can check by running uname -m in a terminal. The output on a 64 bit OS will be aarch64. In that case, you can skip to the 64 bit section below for a bit simpler setup.

Let’s go

I won’t cover the farmerbot setup in detail here. Check the link at the top of the post for written instructions or see my video. You can follow the normal instructions and come back here to complete the rest just before you run docker compose up.

Install Docker

While the version of Docker included in the repositories might work, I like to get the latest version using Docker’s install script:

wget -O docker.sh get.docker.com
sudo sh docker.sh

Install QEMU (32 Bit OS)

The following instructions are only for 32 bit operating systems. If you do have a 64 bit OS running on your Pi, you can skip to the 64 bit instructions below.

We’re going to install QEMU for emulation support inside Docker. This is needed because one component that makes farmerbot work, rmb-peer, won’t compile natively for 32 bit ARM systems:

sudo apt update
sudo apt install qemu-user-static

While this was not necessary in my own testing, one user reported needing to install binfmt-support manually as well. You can check if it’s working properly with:

ls /proc/sys/fs/binfmt_misc/

There should be many entries starting with qemu-. If not, try this:

sudo apt install binfmt-support

docker-compose.yaml

You can find an ARM compatible docker-compose.yaml file here. To download it on your machine, run this command:

wget https://github.com/scottyeager/farmerbot/raw/development/arm/docker-compose.yaml

Run it

Alright that’s it. Now we can run docker compose up and Docker will take care of the rest.

Quick troubleshooting tip

I’m not sure why, but I found during my testing that sometimes Docker had trouble pulling down the images and gave this error:

Error response from daemon: manifest unknown

If you see that, you can pull the images manually:

docker pull ghcr.io/scottyeager/farmerbot:0.2.0-arm
docker pull ghcr.io/scottyeager/rmb-peer:1.0.6-arm
docker pull ghcr.io/scottyeager/grid_http_server:2.1.0-rc2-arm

Then try docker compose up again.

Wrapping up

While I did my best not to pack this post with details about the problem and process of porting software from one platform to another, there’s more to say on that for anyone who’s curious, and I’m keeping my thoughts on that as a draft for now to maybe add to this post later :slight_smile:

Please drop a reply here with any questions and your experience running farmerbot on a Rpi or other ARM based computer. It would be great to generate a collection of reports about what works and try to troubleshoot what doesn’t.

6 Likes

WE WANT THE DETAILS!

We want the details!

Thanks Scott. Nice post :slight_smile:

Amazing ! i was looking for a small NUC or so, but with this new i will just use my sleeping Pi3 ! Thank you !

2 Likes

Absolutely, and glad to hear it! It’s nice to know that some farmers can dust off a Pi they have around and put it to work for this :slight_smile:

1 Like

Today I’ve released the ARM builds for farmerbot v0.1.0. Check the original post for the updated docker-compose.yaml file. Don’t forget to change MNEMONIC to SECRET in your .env file!

While I did some basic sanity checks that the new versions run, I didn’t do any extensive testing. I’d recommend keeping a backup in case you need to roll back.

1 Like

! rmbpeer The requested image’s platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested.

Tried adding platform: armhf in the redis section, but that didn’t work either.

Any ideas?

Scott now has a native 64bit image for use with arm, just replace the image listed under rmbpeer section of docker-compose.yaml with scottyeager/rmb-peer:1.0.3

Thanks @TheCaptain. I’ll update the guide to include this.

It seems to be a common confusion that does not match the detected host platform is actually not an error. This is just how Docker is telling you that it will use QEMU to emulate the container (assuming QEMU is available). I’ll add a note on this too.

@sharpharp, did you get it working?

Nope - didn’t fix the issue. I edited rmb-peer as per TheCaptions comments. i then do compose up -d and it says created started. but nodes still not shutting down unfortunately