Remotely Updating Raspberry Pi Software 'over the air'

dopey picture dopey · Nov 16, 2016 · Viewed 7.8k times · Source

We use a Raspberry Pi embedded computer to connect IP cameras on a customers network to our cloud based recording service. We are using Raspbian and about 50% are Wheezy and 50% are Jessie.

The challenge we have is how to remotely update the software running on these IFUs.

Our current method involves using SSH and Ansible. We have a complex Ansible script that makes all the changes to the Raspberry Pi and we have automated this to an extent so we can updates lots of Raspberry Pi's at a time.

However, the problem is is that this is a non-atomic update. The Raspberry Pi's do not necessarily always have exactly the same package versions on them depending on when they were updated. Its also possible for an upgrade to fail half way through etc.

I am aware that there are a couple of ways of doing an atomic upgrade by downloading a new 'software image' and swapping over to using it instead using a bootloader. I think OpenWRT can do this as well as swupdate: https://github.com/sbabic/swupdate

Has anyone ever done something like this on a Raspberry Pi before?

Thanks

Answer

dopey picture dopey · Mar 9, 2017

As a bit of an update to this question, I found a couple of ways of doing this.

The first thing to consider is that you do not have to stick with the RPI's default bootloader as @user3145836 pointed out. Uboot allows you to flip the boot partition.

The best option at the moment appears to be https://mender.io and this is the option that we have gone with.

If you can dockerize your app, https://resin.io/ is a nice hosted way of doing it.