Nerves in a distributed setting


We are considering to use Nerves for a project that involves multiple devices, in our case Rpi 3s. The Getting started guide instructs you to burn the firmware onto an SD-card from what I understand to be the host, and then insert the burnt SD-card to the target device. Ideally, we would not like to have to do this for our target devices. My first question, which I suspect has a negative answer, is this:

  • Is there any way to load a Nerves system to a stock Rpi 3 that has, say, Raspbian OS installed by default without having to physically remove the SD-card?

Second, we would have to use certain Python scripts in conjunction with Erlang/Elexir on target devices. A straightforward way to deal with the communication between Python and Erlang on an ordinary OS is to write files. However, a drawback I found is that including Python dependencies is not trivial. A broader question that maybe those of you with experience could provide insight to:

  • Is Python interoperability with Erlang (e.g. reading and writing files) feasible on a Nerves system?


1 Like

A) No, AFAIK there isn’t a way to move from Raspian to Nerves. Nerves is a complete system on a read only volume. So card reformatting is necessary.

B) Yes Python iteration is fairly easy on Nerves. It just requires a customized boot volume with Python. Then you can communicate to it using Ports, which is easiest, or written files. You just need to make sure they are written to the app directory, which is read/write.

Creating a Python boot disk for Nerves is described here: (among other places)


Thank you for your answers. I did have a look at the blog post you linked to, and while it does describe one way to add Python dependencies Steven says he does it

in the ugliest way possible to insure no one actually does this.

He also says that there are other ways to

run external processes easily in a supervised, robust manner.

Does anybody have any pointers as to what the preferred way to run external processes (e.g. Python) is?

To give some more information about your first question:

Is there any way to load a Nerves system to a stock Rpi 3 that has, say, Raspbian OS installed by default without having to physically remove the SD-card?

While you cannot run Nerves on top of Raspbian since it is its own OS, you can of course install Erlang + Elixir under Raspbian. But you would lose out on many of Nerves’ cool features, like:

  • tolerance to most software- and hardware-faults because of the usage of a read-only system.
  • over-the-air hot software upgrades.
  • fast bootup-times.
  • A system without any extra clutter that would take CPU and battery; you only run the BEAM (with the exception of some peripheral systems like the network daemon, of course).

The flash time to (re)-install Nerves on an SD card is by the way extremely fast. It will not hamper your debugging/iteration in the slightest!

You only also have to do this once. If you have nerves on your device (correctly configured) you can start pushing updates over the air.

1 Like

As for communicating with Python: You can run a Python script (or any other shell command) from Erlang/Elixir as a Port, which means that you can communicate with it using a bidirectional UNIX-pipe that is set up.

I see. However, distributed deployment would be ideal for our current use case.

Okay, so the way to go would be via Erlang ports.

1 Like