lawik

lawik

Nerves Core Team

NervesHub - Delta updates

Nerves, fwup and NervesHub have had delta updates as a feature on the checklist for a long time. A delta update being essentially a patch you send to update the binary data on a device instead of sending all the desired data. It can be way more efficient in terms of bandwidth. We use xdelta3 for the binary diffing.

The delta support has been kind of gnarly though. In several important ways they were best-effort and whether they worked or not was dependent on what fwup features you used and how you used them. If you used disk encryption it was a no-go.

Thanks to work at SmartRent we now get fully functional delta updates that understand way more about what the heck you are doing with your firmware. And you don’t really need to think about it very much. Just turn on Delta updates for your deployment and if you have a compatible setup you should get the advantages. This is all on main in nerves_hub and you get it if you run the latest tag for the container or similar.

There are still updates we can do to Nerves systems to make delta updates apply to a larger part of the system. Currently they tend to apply to the rootfs.

A bunch of things needed to be lined up to make this happen:

  • NervesHub needed to get smarter about generating the delta packages to understand whether an update was possible. Is the version of fwup high enough? Does this archive have support for deltas at all? Does it use disk encryption and does the delta update respect that?
  • fwup needed to provide a combination of the disk encryption feature and the delta update feature. Awesome job by @fhunleth :sparkles:

fwup uses the libconfuse format for config files so as part of this I made a kind of rough library for dealing with those files, I call it confuse. A bunch of nimble_parsec and then some really helpful functionality to interpret the structure based on fwup usage and conventions. Most of the smarts around deltas for NervesHub live in confuse.

fwup itself does not know how to create a delta firmware archive, maybe it should but currently it does not. So NervesHub becomes the reference implementation so even if you want to use another delivery mechanism you can yoink the functionality out of it.

NervesHub will create deltas for the files that have the relevant delta options applied and other files will be provided in full.

For an extreme case where we just bumped the version number we actually saw a delta update down in the kilobytes for a firmware that was 90Mb. In reality it will vary significantly. One usually mild trade-off is that applying the firmware will likely take longer due to compression and the procedure of reading and patching the existing data to write to the new partition.

You can try this on NervesCloud already as we run very recent versions. Feel free to weigh in with questions in this thread or elsewhere.

Where Next?

Popular in News & Updates Top

zachdaniel
Hey folks! We’ve just released the beta 0.1.0 version of ash_sqlite. Take a look at the guide here: https://hexdocs.pm/ash_sqlite/get-sta...
New
zachdaniel
We’re working hard on improving docs, and have some substantial things that it would be great to get some thoughts on. One of the bigges...
New
fhunleth
We recently released Nerves 1.4.0 and an update to the Nerves new project generator, nerves_bootstrap. The biggest change is support for ...
New
jjcarstens
Do you like Hacktoberfest? Also enjoy working with Nerves and want to contribute? Fantastic! :tada: :beers: Here are some potential sta...
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
zachdaniel
Working with nested forms in Ash was already great, but it’s even better now with a the new features that will be in the next release of ...
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
bartblast
I’m excited to announce Hologram v0.5.0, a major evolution of the full-stack Elixir web framework! This release brings massive performanc...
New
bartblast
Hey Elixir community! :waving_hand: First, I owe you all an apology. There’s a running joke among my friends that Hologram is like nucle...
New
jjcarstens
The Raspberry Pi is a very popular hardware platform for Nerves users and the official systems are getting an upgrade! :tada: :beers: Wh...
New

Other popular topics Top

senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 35421 110
New
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New

We're in Beta

About us Mission Statement