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

barnabasJ
You can now add subscriptions using the DSL. subscriptions do pubsub YourAppWeb.Endpoint subscribe :something_changed do action...
New
zachdaniel
Hey friends! A long time quality of life feature we’ve been wanting to add is the ability to refer to to-one relationships in calculation...
New
mspanc
Membrane v1.2.6 has been released. What’s Changed Adjust to Elixir 1.19 by @Noarkhh in Update to elixir 1.19 by Noarkhh · Pull Request ...
New
jimsynz
As some of you know, I have been working on a tight integration between Ash and Reactor which has triggered a few small bug fixes in Spar...
New
zachdaniel
:police_car_light: New AshAuthentication Installers :police_car_light: The AshAuthentication igniter installers are released! Today on s...
New
fhunleth
Normally, we don’t announce patch release Nerves systems, but the nerves_system_br v1.30.1 release is particularly important for anyone u...
New
lawik
It is my pleasure to announce the official release of the new generation of NervesHub with the v2.0.0 release. Containers are tagged. :p...
New
zachdaniel
The second video from the Ash Primers series is out! https://www.youtube.com/watch?v=GtsL_lIis4Q This one is about the migration generato...
New
jjcarstens
NervesPack 0.4.0 is a minor bump with a fairly big change. This update drops :nerves_firmware_ssh in favor of the newer and more focused...
New
zachdaniel
Hey folks! We’re giving a training at the upcoming ElixirConf EU! If you want a leg up on 3.0, this is definitely something you don’t wan...
New

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
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
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
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
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
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
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New

We're in Beta

About us Mission Statement