jjcarstens

jjcarstens

Nerves Core Team

Nerves Raspberry Pi Systems v2.0.0 release candidates

The Raspberry Pi is a very popular hardware platform for Nerves users and the official systems are getting an upgrade! :tada: :beers:

Whats New?

The biggest change is that the rpi* systems now utilizes initramfs to load a very minimal root filesystem, nerves_initramfs, before mounting the real rootfs. This allows us to do really early pre-start checks via a nerves_initramfs.config script file.

With this new found power, each rpi* system now does a simple firmware validation check before loading the rootfs. If it fails, it triggers a revert to the last firmware automatically. This helps prevent infinite boot loops when errors are caused after compilation but before startup, such as kernel panics, bad erlinit.config, etc etc.

But…

with-great-power

This change requires the firmware to be marked as valid at runtime. Because the answer to “What makes my firmware valid?” differs drastically, Nerves makes no assumptions here and you, the user, are required to validate your firmware based on your conditions by calling Nerves.Runtime.validate_firmware().

For most situations, just getting to runtime is valid enough and you could mark it as your application is starting. Something like:

defmodule My.Application do
  use Application

  def start(_type, _args) do
    Nerves.Runtime.validate_firmware()
   # ... all your other startup things
  end
end

For others, you might have conditions to be connected to a specific network, hardware needs to be detected, MQTT connection must be established, etc etc, before considering the firmware valid. If you have such conditions, check out the post “You Gotta Have Heart” about using the Erlang :heart module to tie these checks into the hardware watchdog for triggering reverts when your conditions aren’t met.

Can I update existing devices?

Yes…with a tiny bit of work.

The pre-start check looks for a UBoot variable nerves_fw_validated. fwup also checks this variable before updating to ensure you have a working, validated firmware on the device before putting an new one on. This is a hardened check to prevent bricking a device by updating a bad firmware with another bad firmware.

Nerves rpi* systems < v2.0.0 don’t have this UBoot variable set, so any attempt to update via fwup (such as SSH or upload.sh script) will fail with an error like:

“Please check the media being upgraded. It doesn’t look like either the A or B partitions are active.”

So before updating, you’ll need to manually validate the running firmware with:

Nerves.Runtime.validate_firmware()

Or

Nerves.Runtime.KV.put("nerves_fw_validated", "1")

Then update like normal :beers:

Why 2.0.0?

Introducing nerves_initramfs and the revert scheme is a decent size change to how the system functions. It’s a new tool and startup path which, we feel, warrants a major version bump. Our hope is that others try out the release candidates and submit issues to help us iron out any kinks.

How Can I Try It?

The release candiates are on hex.pm:

Where Next?

Popular in News & Updates Top

bartblast
Hi folks, For anyone following Hologram’s development or curious about running Elixir in the browser, I’ve created the Client Runtime Re...
New
zachdaniel
Hey folks, we have a minor CVE issued for AshAuthentication. Please read the CVE and update accordingly. Relatively low severity, can’t c...
New
bartblast
New Features Add ~JS sigil support for basic JavaScript interoperability Bug Fixes Fix root HTML element attribute patching during pag...
New
zachdaniel
Hey folks! We’re starting a new weekly newsletter with the goings on of the various Ash packages and other interesting news from myself a...
New
bartblast
Hologram v0.6.0 is here, bringing production-ready features to the full-stack Elixir web framework! This release focuses on enhanced secu...
New
fhunleth
We’re excited to announce that we’re actively working on NervesHub 2.0, an improved version of our IoT device firmware update and managem...
New
zachdaniel
Hey folks, made some recent performance improvements to spark, the tool underlying all of our DSLs. GitHub - ash-project/spark: Tooling f...
New
fhunleth
We’ve released new versions of all of the officially maintained Nerves Systems. The official systems, nerves_system_rpi0, nerves_system_b...
New
zachdaniel
First two Ash cookbooks are live! We’re still refining the format, so please give us your feedback, good or bad! The first two are: optim...
New
fhunleth
We recently released Nerves 1.5.0 and corresponding updates to the Nerves new project generator, nerves_bootstrap and our official system...
New

Other popular topics Top

SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New

We're in Beta

About us Mission Statement