The Pantacor team recently merged an update to the Device Update for IoT Hub repo allowing anyone to deploy containers over the air and to update IoT fleets at the intelligent edge. The Device Update for IoT Hub is based on the same reliable and secure technology created for Windows Software but is optimized for IoT devices. By combining Device Update (DU) with lightweight containers on embedded Linux devices, release teams can now easily maintain and secure IoT device fleets across all architectures.
In this post, we’ll show you how that works with a hands-on tutorial. You’ll prepare an update, export it and then apply it to your embedded Linux IoT devices with the Azure IoT Hub dashboard.
Pantavisor – an embedded framework for building containerized IoT devices
Pantavisor turns the runtime on your embedded Linux IoT device into a set of containers. Any updates you push from the Device Update UI will result in a group of containers that can be added, updated, or removed. This includes the Device Update (DU) agent, which has also been containerized to be run on a Pantavisor-enabled device.
How Docker and Pantavisor work together
The contents of each container are defined in the Dockerfile template that is built for arm32, arm64 and x64 architectures on GitLab CI with container-ci. Containers on a Pantavisor-enabled system are not natively run by Docker, but instead, Pantavisor offers a lightweight container engine to run them. The Dockerfile is only used to define the container root file system.
The Device Update agent is also implemented as a container that can be added to any Pantavisor-enabled device. Once done, you can can onboard your Pantavisor device and use Device Update to deploy software updates at scale.
The main components of the DU agent container are:
- Device Update service with PVControl content handler
- Delivery Optimization service: dependency of DU agent used to download the updates
- PVcontrol: used by the DU PVControl Handler that communicates with Pantavisor on the device
Before you begin
Prerequisites:
- Create a Device Update account and instance, and configure access controls for it.
- PVR cli: used to interact with your device from your host computer
- pvr2adu: a script to download images and prepare images
Device updates with DU update
To simplify this guide, a precompiled image with the DU client is provided. If you prefer, you can also set up a standard Pantavisor-enabled device first and then add the agent using the pvr2adu add-agent
command.
Set up Device Update in IoT Hub if you haven’t done that already.
- Download the image with the following:
pvr2adu [options] download arm-bpi-r64|arm-rpi64|x64-uefi <connection-string> <manufacturer> <model>
Where,
options
– can be help or verbose mode -h or -vconnection- string
– A pre-provisioned connection string the device uses to connect to the IoT Hub.manufacturer
– Reported by the device update agent as part of theDeviceInformation
interface.model
– Reported by the Device Update Agent as part of theDeviceInformation
interface.
See Device Update Configuration File – list of fields
For example, to download an arm-rpi64
compatible image, use the following:
pvr2adu download arm-rpi64 <your-connection-string> FabrikamToaster
-
- Next, flash the device storage with the downloaded image.
- Turn on the device and check that it successfully connected to DU IoT Hub.
- Clone the current running revision in your host computer with pvr cli. First, you will need to know your device IP. If your host computer is in the same network, you can use the PVR device scan command:
pvr scan
- After scanning and finding an IP, clone the revision into your computer with:
pvr clone https://192.168.1.122:12368/cgi-bin/pvr my-checkout
- Make changes to the state revision. In this case, you will install a new NGINX container from DockerHub.
cd my-checkout
pvr app add --from nginx:stable-alpine webserver
pvr add .
pvr commit - Convert the PVR checkout into Azure DU format with the pvr2adu script
pvr2adu -p Pantacor -n Toaster -m Fabrikam -d Toaster -v 1.1 -o out
- Deploy the resulting manifest from the Device Update dashboard.
- Next, flash the device storage with the downloaded image.
Below you can see how to upload the tar file to the device updater to complete the deployment.
Note: For updates to this tutorial look to the GitLab source and Readme file.
Final Thoughts
This tutorial demonstrated how to update containerized embedded Linux IoT devices through the Device Update dashboard. With the support of containers and Pantavisor, you can now use DU IoT Hub to update your entire fleet regardless of the device architecture.
Questions or Comments?
Ask a question on our Community forum or submit an issue to the Pantavisor GitHub repo. We’d be very happy to hear from you.