Seriously those stack diagrams are massively overkill designs for OTA update infra.
As for your specific points, I left out a LOT of detail.
- You should think about the fact that this means your root partition changes
Yes, or no, depending on your bootloader. GRUB and others can chainload to other partitions after control is given. Of course you'll need to think about how to re-provision user-specific data, though the first idea that pops in my mind would be to simply read it from the old install on first boot. (IRL we are solving this with a first-boot 'activation' app, which re-downloads user data on completion) - You do want a management server, as this document suggests...
yes, but this is way easier than needing to learn and roll out someone else's complicated piece of tech. An API server that can receive updates from the field and download scripts/run the commands to start the process.Also, if you've been supporting this kind of product for a while you probably already have your own infra.
- You want some mechanism for detecting if the new version doesn't work and rolling back;
of course. Though, if your hardware is uniform you can get away with a lot less of this than one might think, due to the updates being image-based and not package-based. Easiest way is to simply compute a SHA-hash on the download to make sure it wasn't corrupted (make sure the value you compare it with came from a trusted conversation with your server). If it fails to boot the newly provisioned code needs to know to re-point the bootloader at the previous install, though again with uniform hardware your main concerns are transport-related. - The updates should be signed etc. as described in the document.
Fairly trivial with pgp et al.Please do not try to redefine the meaning of an existing term. "FUD" already has its well-known meaning, different than what you tried to use it as: https://en.wikipedia.org/wiki/FUD
Once the device has been installed, there is always at least one working partition on the device - the partition that was last booted. So you don't need a minimal recovery partition or anything. (You could build a recovery command-line option in, if you want, but it's just a custom way of booting the normal partition.)
In particular, for all my use cases, there's already some mechanism for the device gaining a secure channel to the rest of the infrastructure, so if you're worried about keeping updates secret (which you may or may not be!), just protect updates by that mechanism.
Signing and verification in Mender is covered here: https://docs.mender.io/artifacts/signing-and-verification
I definitely agree with the rest of the comment. It's a good solution. I inherited a software product that worked like this at a past job, and it was great. (And now I'm trying to convince my current job that we want to move to this model for normal servers in datacenters, very much not IoT.)
A couple of complications:
- You should think about the fact that this means your root partition changes. Either you want to structure your system with separate read and write partitions and bind-mount the relevant directories from the write partition, or you want to make it completely read-only / stateless. Remember that /var/log is traditionally on your local disk, so if you don't do anything special, you'll even get two /var/logs on each device, which may or may not be what you want.
- You do want a management server, as this document suggests, to track which devices have actually updated and which haven't, so you can manually send people after devices that are just behind a terrible internet connection.
- You want some mechanism for detecting if the new version doesn't work and rolling back; this is basically as simple as setting a "I just tried partition X, if it doesn't work don't try it again" flag in the bootloader on boot, and clearing it once userspace is up (and when the partition gets rewritten with a new version).
- The updates should be signed etc. as described in the document. Depending on your threat model, you might want to prevent replay attacks that cause an attacker-controlled downgrade by giving it a higher-versioned filename; either use HTTPS to an update server you control, or use signed metadata files with timestamps.
The fact that you get image-based deployments instead of dealing with apt upgrades from arbitrarily-old versions (and thus inevitably slightly drifting configs on devices installed at different times) is fantastic.