Difference between revisions of "SBCX-TN-002: Running Microsoft Azure IoT Edge runtime"

From DAVE Developer's Wiki
Jump to: navigation, search
Line 4: Line 4:
{{WarningMessage|text=This technical note was validated against specific versions of hardware and software. It may not work with other versions.}}
{{WarningMessage|text=This technical note was validated against specific versions of hardware and software. It may not work with other versions.}}

Latest revision as of 09:52, 14 February 2020

Info Box
SBC-AXEL-02.png Applies to SBC AXEL
Axel-04.png Applies to Axel Ultra
Axel-lite 02.png Applies to Axel Lite
Axel-02.png Applies to AXEL ESATTA
Cloud-computing-banner.jpg Applies to IoT
Warning-icon.png This technical note was validated against specific versions of hardware and software. It may not work with other versions. Warning-icon.png

History[edit | edit source]

Version Date Notes
1.0.0 August 2019 First public release
1.1.0 August 2019 Added gateway patterns

Introduction[edit | edit source]

As stated in this Technical Note, nowadays several cloud platforms are available to implement advanced (Industrial) IoT systems.

This Technical Note illustrates how to use the SBC Axel (SBCX for short) to implement a Microsoft Azure IoT Edge-enabled device. Thanks to its flexibility and to its rich set of I/O interfaces, the SBCX single-board computer can be leveraged to implement an IoT gateway with good processing power. This combination makes this board particularly suited for the applications where significant computations have to be deployed on the edge.

Gateway patterns as defined by Microsoft Azure (image source: How an IoT Edge device can be used as a gateway)

It is worth to remember that this Technical Note is not a step-by-step guide to set up the edge device and the cloud platform to implement an Azure-based system. Azure documentation is rich and detailed in this regard. Rather, this document aims to underline some specific SBCX-related steps required to run the Azure IoT Edge runtime on this device successfully. Nevertheless, in the following sections, several relevant links to the Azure documentation will be provided.

Testbed configuration[edit | edit source]

Regarding the hardware, the testbed used for this Technical Note (TN) consists of an SBCX single-board computer equipped with a quad-core i.MX6Q system-on-chip (SoC).

For what concerns software, the following configuration was used:

  • Linux kernel: 4.9.11-xelk-4.0.0 (see XELK 4.0.0)
  • Debian Strech root file system (armbian)
    • The root file system is the same used for this TN.

Install the Azure IoT Edge runtime[edit | edit source]

In essence, to install Azure IoT Edge runtime to the SBCX, the procedure described in the Install the Azure IoT Edge runtime on Debian-based Linux systems guide was followed.

Linux kernel configuration[edit | edit source]

The Azure IoT Edge runtime is released as a Moby/Docker container. As such, the Linux kernel must be configured appropriately in order to provide all the functionalities required to support containerization.

Starting from the default configuration file (imx_v7_axel_defconfig), a new kernel configuration was set up providing all the required options. This configuration is available for download here.

To verify what options are missing, this script is very useful. Some of the checked functionalities are relevant for x86 architectures, however.

Root file system configuration[edit | edit source]

After setting up the Linux kernel properly, issue the following command to mount the cgroupfs hierarchy.

armbian@sbcx:~# sudo aptitude install cgroupfs-mount

Azure IoT Edge runtime installation[edit | edit source]

The system is now ready to install the runtime as described in the guide mentioned previously. The last step should procude an output like this:

armbian@sbcx:~/devel/azure-iot-edge$ sudo apt-get update
Get:1 http://security.debian.org stretch/updates InRelease [94.3 kB]
Hit:6 https://deb.nodesource.com/node_10.x stretch InRelease
Ign:3 http://cdn-fastly.deb.debian.org/debian stretch InRelease
Get:4 http://cdn-fastly.deb.debian.org/debian stretch-updates InRelease [91.0 kB]
Get:5 http://cdn-fastly.deb.debian.org/debian stretch-backports InRelease [91.8 kB]
Hit:8 https://packages.microsoft.com/debian/stretch/multiarch/prod stretch InRelease
Hit:7 http://cdn-fastly.deb.debian.org/debian stretch Release
Hit:2 https://apt.armbian.com stretch InRelease
Fetched 277 kB in 5s (50.2 kB/s)
Reading package lists... Done
armbian@sbcx:~/devel/azure-iot-edge$ sudo apt-get install iotedge
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
The following NEW packages will be installed:
  iotedge libiothsm-std
0 upgraded, 2 newly installed, 0 to remove and 10 not upgraded.
Need to get 4663 kB of archives.
After this operation, 22.4 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 https://packages.microsoft.com/debian/stretch/multiarch/prod stretch/main armhf libiothsm-std armhf 1.0.8-2 [501 kB]
Get:2 https://packages.microsoft.com/debian/stretch/multiarch/prod stretch/main armhf iotedge armhf 1.0.8-2 [4162 kB]
Fetched 4663 kB in 3s (1380 kB/s)
Selecting previously unselected package libiothsm-std.
(Reading database ... 53013 files and directories currently installed.)
Preparing to unpack .../libiothsm-std_1.0.8-2_armhf.deb ...
Unpacking libiothsm-std (1.0.8-2) ...
Selecting previously unselected package iotedge.
Preparing to unpack .../iotedge_1.0.8-2_armhf.deb ...
Adding system user `iotedge' (UID 110) ...
Adding new user `iotedge' (UID 110) with group `nogroup' ...
Creating home directory `/var/lib/iotedge' ...
Adding group `iotedge' (GID 116) ...
Adding user `iotedge' to group `docker' ...
Adding user iotedge to group docker
Unpacking iotedge (1.0.8-2) ...
Processing triggers for systemd (232-25+deb9u11) ...
Setting up libiothsm-std (1.0.8-2) ...
Processing triggers for man-db ( ...
Setting up iotedge (1.0.8-2) ...

                              Azure IoT Edge

  IMPORTANT: Please update the configuration file located at:


  with your device's provisioning information. You will need to restart the
  'iotedge' service for these changes to take effect.

  To restart the 'iotedge' service, use:

    'systemctl restart iotedge'

    - OR -

    /etc/init.d/iotedge restart

  These commands may need to be run with sudo depending on your environment.

Created symlink /etc/systemd/system/sockets.target.wants/iotedge.mgmt.socket -> /lib/systemd/system/iotedge.mgmt.socket.
Created symlink /etc/systemd/system/multi-user.target.wants/iotedge.service -> /lib/systemd/system/iotedge.service.
Created symlink /etc/systemd/system/sockets.target.wants/iotedge.socket -> /lib/systemd/system/iotedge.socket.
Processing triggers for systemd (232-25+deb9u11) ...

After the Azure IoT Edge runtime is started, the IoT hub dashboard on cloud side should look like this:

Azure IoT hub dashboard