{"id":2074,"date":"2018-11-05T17:12:33","date_gmt":"2018-11-05T09:12:33","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/iotdev\/?p=2074"},"modified":"2019-02-15T10:27:05","modified_gmt":"2019-02-15T02:27:05","slug":"a-workaround-to-run-azure-iot-edge-on-arm64-devices","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/iotdev\/a-workaround-to-run-azure-iot-edge-on-arm64-devices\/","title":{"rendered":"A Workaround to Run Azure IoT Edge on ARM64 Devices"},"content":{"rendered":"<p class=\"code-line \">Azure IoT Edge went\u00a0<a title=\"https:\/\/azure.microsoft.com\/blog\/azure-iot-edge-generally-available-for-enterprise-grade-scaled-deployments\/\" href=\"https:\/\/azure.microsoft.com\/blog\/azure-iot-edge-generally-available-for-enterprise-grade-scaled-deployments\/\">generally available<\/a>\u00a0in June, with\u00a0<a title=\"https:\/\/docs.microsoft.com\/en-us\/azure\/iot-edge\/support\" href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/iot-edge\/support\">official support<\/a>\u00a0for AMD64 and ARM32 platforms. Recently, more and more developers from the community requested to run Azure IoT Edge on ARM64 (a.k.a. AArch64) devices such NVIDIA TX2. While the ARM64 support of Azure IoT Edge is still in progress, this post will introduce a workaround.<\/p>\n<p class=\"code-line\">When we talk about &#8220;running Azure IoT Edge&#8221;, what we actually mean is running both the Azure IoT Edge security daemon (including its dependencies such as hsmlib) and the Azure IoT Edge runtime images (i.e., edgeAgent and edgeHub). As a result, the workaround requires changes to the official tutorial for these two parts.<\/p>\n<h2 id=\"iot-edge-security-daemon\" class=\"code-line\">IoT Edge Security Daemon<\/h2>\n<p class=\"code-line\">To run IoT Edge security daemon on ARM64 devices, you need to\u00a0<em>either<\/em>:<\/p>\n<ol>\n<li class=\"code-line \">Install ARM32 (a.k.a., armhf) architecture Azure IoT Edge security daemon, hsmlib, and all their dependencies libs.\u00a0<a title=\"https:\/\/github.com\/marktayl1\" href=\"https:\/\/github.com\/marktayl1\">@marktayl1<\/a>\u00a0has provided installation steps in\u00a0<a title=\"https:\/\/gist.github.com\/marktayl1\/108bdb8a5a0cee8dc354a7b88d831043\" href=\"https:\/\/gist.github.com\/marktayl1\/108bdb8a5a0cee8dc354a7b88d831043\">this gist<\/a><\/li>\n<li class=\"code-line \">Compile both Azure IoT Edge security daemon and hsmlib for ARM64 from source code, or use the pre-built binaries from the community (for example,\u00a0<a title=\"https:\/\/github.com\/vjrantal\" href=\"https:\/\/github.com\/vjrantal\">@vjrantal<\/a>\u00a0has provided pre-built 1.0.2 version)<\/li>\n<\/ol>\n<h3 id=\"cross-compile-iot-edge-security-daemon-and-hsmlib-for-arm64-on-linux-amd64-machines\" class=\"code-line\">Cross-compile IoT Edge Security Daemon and hsmlib for ARM64 on Linux AMD64 Machines<\/h3>\n<blockquote class=\"code-line\">\n<p class=\"code-line\">You can skip this section if you would like to use pre-built binaries from the community.<\/p>\n<\/blockquote>\n<ol>\n<li class=\"code-line\">Install\u00a0<a title=\"https:\/\/docs.docker.com\/install\/linux\/docker-ce\/ubuntu\/\" href=\"https:\/\/docs.docker.com\/install\/linux\/docker-ce\/ubuntu\/\">Docker-CE<\/a>, and follow\u00a0<a title=\"https:\/\/docs.docker.com\/install\/linux\/linux-postinstall\/#manage-docker-as-a-non-root-user\" href=\"https:\/\/docs.docker.com\/install\/linux\/linux-postinstall\/#manage-docker-as-a-non-root-user\">this tutorial<\/a>\u00a0to configure managing Docker as a non-root user<\/li>\n<li class=\"code-line\">Install\u00a0<a title=\"https:\/\/rustup.rs\/\" href=\"https:\/\/rustup.rs\/\">rustup<\/a>:\u00a0<code>curl https:\/\/sh.rustup.rs -sSf | sh<\/code>, and add Rust toolchain to\u00a0<code>$PATH<\/code>:\u00a0<code>source ~\/.cargo\/env<\/code><\/li>\n<li class=\"code-line\">Clone the source code of IoT Edge OSS project:\u00a0<code>$ git clone https:\/\/github.com\/Azure\/iotedge.git<\/code><\/li>\n<li class=\"code-line\"><code>$ cd iotedge\/edgelet\/build\/linux\/docker\/cross-compile<\/code><\/li>\n<li class=\"code-line\">Build the container image with cross-compile toolchain:\u00a0<code>$ ubuntu16.04\/build_arm64_toolchain_container.sh aarch64-unknown-linux-gnu<\/code><\/li>\n<\/ol>\n<blockquote class=\"code-line\">\n<p class=\"code-line\">The above command targets ARM64 and Ubuntu 16.04. Read the\u00a0<a title=\"https:\/\/github.com\/Azure\/iotedge\/blob\/master\/edgelet\/build\/linux\/docker\/cross-compile\/README.md\" href=\"https:\/\/github.com\/Azure\/iotedge\/blob\/master\/edgelet\/build\/linux\/docker\/cross-compile\/README.md\">README<\/a>\u00a0file to learn about the commands targeting other OS such as Debian and Centos, as well as what tools are inside the build container.<\/p>\n<\/blockquote>\n<ol start=\"6\">\n<li class=\"code-line\"><code>$ cd ..\/..\/ubuntu16.04\/aarch64\/<\/code><\/li>\n<li class=\"code-line\"><code>$ chmod +x *.sh<\/code><\/li>\n<li class=\"code-line\">Open\u00a0<code>package-iotedged.sh<\/code>\u00a0and\u00a0<code>package-libiothsm.sh<\/code>\u00a0in text editors, and comment the line with\u00a0<code>docker pull \"$IMAGE\"<\/code><\/li>\n<\/ol>\n<blockquote class=\"code-line\">\n<p class=\"code-line\">By default, the images built in Step 5 are tagged with a private registry which requires credentials to pull. By bypassing the\u00a0<code>docker pull \"$IMAGE\"<\/code>\u00a0step we will always use the locally built ones.<\/p>\n<\/blockquote>\n<ol start=\"9\">\n<li class=\"code-line\">Cross-compile hsmlib:\u00a0<code>.\/package-libiothsm.sh<\/code><\/li>\n<li class=\"code-line\">Cross-compile IoT Edge Security Daemon:\u00a0<code>.\/package-iotedged.sh<\/code><\/li>\n<\/ol>\n<h2 id=\"iot-edge-runtime-images\" class=\"code-line\">IoT Edge Runtime Images<\/h2>\n<p class=\"code-line \">For IoT Edge runtime images, edgeAgent (<code>mcr.microsoft.com\/azureiotedge-agent:1.0<\/code>) and edgeHub (<code>mcr.microsoft.com\/azureiotedge-hub:1.0<\/code>), the Docker tags are\u00a0<a title=\"https:\/\/blog.docker.com\/2017\/11\/multi-arch-all-the-things\/\" href=\"https:\/\/blog.docker.com\/2017\/11\/multi-arch-all-the-things\/\">multi-arch<\/a>. This means when you pull them on Linux AMD64 machines you get the Linux AMD64 variant, and when you pull them on ARM32 machines you get the ARM32 variant. However, these multi-arch tags don\u2019t support ARM64 yet. When you pull them on ARM64 machines, Docker daemon will try the find the ARM64 variant and finally get a 404 error. To workaround this, you need to explicitly specify the ARM32 variants, for example,\u00a0<code>mcr.microsoft.com\/azureiotedge-agent:1.0.4-linux-arm32v7<\/code>\u00a0and\u00a0<code>mcr.microsoft.com\/azureiotedge-hub:1.0.4-linux-arm32v7<\/code>.<\/p>\n<h2 id=\"full-steps-to-run-the-simulated-temperature-sensor\" class=\"code-line\">Full Steps to Run the Simulated Temperature Sensor<\/h2>\n<p class=\"code-line\">Here are the full steps I used to set up IoT Edge runtime on NVIDIA TX2 running Ubuntu 16.04 and deploy the simulated temperature sensor module (a.k.a., the Hello World for Azure IoT Edge):<\/p>\n<ol>\n<li class=\"code-line\">Install Docker CE\n<blockquote class=\"code-line\">\n<p class=\"code-line\">You may need to check the\u00a0<a title=\"https:\/\/github.com\/Technica-Corporation\/Tegra-Docker\" href=\"https:\/\/github.com\/Technica-Corporation\/Tegra-Docker\">Tegra-Docker<\/a>\u00a0project to learn how to enable Docker support on NVIDIA Tegra devices. Others from the community reported Moby also worked for them.<\/p>\n<\/blockquote>\n<ol>\n<li class=\"code-line\"><code>$ sudo apt-get update<\/code><\/li>\n<li class=\"code-line\"><code>$ sudo apt-get install apt-transport-https ca-certificates curl software-properties-common<\/code><\/li>\n<li class=\"code-line\"><code>$ curl -fsSL https:\/\/download.docker.com\/linux\/ubuntu\/gpg | sudo apt-key add -<\/code><\/li>\n<li class=\"code-line\"><code>$ sudo add-apt-repository \"deb [arch=arm64] https:\/\/download.docker.com\/linux\/ubuntu $(lsb_release -cs) stable\"<\/code><\/li>\n<li class=\"code-line\"><code>$ sudo apt-get update<\/code><\/li>\n<li class=\"code-line\"><code>$ sudo apt-get install docker-ce<\/code><\/li>\n<li class=\"code-line\">Make sure Docker runs successfully:\u00a0<code>$ sudo docker run hello-world<\/code><\/li>\n<\/ol>\n<\/li>\n<li class=\"code-line\">Install the ARM64 IoT Edge daemon and hsmlib(here we take the 1.0.2 version pre-built by\u00a0<a title=\"https:\/\/github.com\/vjrantal\" href=\"https:\/\/github.com\/vjrantal\">@vjrantal<\/a>\u00a0for example)\n<ol>\n<li class=\"code-line\"><code>$ wget https:\/\/github.com\/vjrantal\/iot-edge-darknet-module\/files\/2423742\/iotedge-libiothsm-std-aarch64.zip<\/code><\/li>\n<li class=\"code-line\">Unzip\u00a0<code>iotedge-libiothsm-std-aarch64.zip<\/code><\/li>\n<li class=\"code-line\"><code>$ sudo apt-get install .\/libiothsm-std-1.0.2-aarch64.deb<\/code><\/li>\n<li class=\"code-line\"><code>$ sudo apt-get install .\/iotedge_1.0.2-1_aarch64.deb<\/code><\/li>\n<\/ol>\n<\/li>\n<li class=\"code-line\"><a title=\"https:\/\/docs.microsoft.com\/azure\/iot-hub\/iot-hub-create-through-portal\" href=\"https:\/\/docs.microsoft.com\/azure\/iot-hub\/iot-hub-create-through-portal\">Create an IoT Hub<\/a><\/li>\n<li class=\"code-line\"><a title=\"https:\/\/docs.microsoft.com\/azure\/iot-edge\/how-to-register-device-portal\" href=\"https:\/\/docs.microsoft.com\/azure\/iot-edge\/how-to-register-device-portal\">Create an IoT Edge device and retrieve the device connection string<\/a><\/li>\n<li class=\"code-line\">Update IoT Edge Runtime configurations:\u00a0<code>sudo vi \/etc\/iotedge\/config.yaml<\/code>\n<ol>\n<li class=\"code-line\">Set\u00a0<code>provisioning<\/code>\u00a0-&gt;\u00a0<code>device_connection_string<\/code>\u00a0with the device connection string retrieved in the last step<\/li>\n<li class=\"code-line\">Set\u00a0<code>agent<\/code>\u00a0-&gt;\u00a0<code>config<\/code>\u00a0-&gt;\u00a0<code>image<\/code>\u00a0with\u00a0<a title=\"http:\/\/mcr.microsoft.com\/azureiotedge-agent%3A1.0.4-linux-arm32v7\" href=\"http:\/\/mcr.microsoft.com\/azureiotedge-agent%3A1.0.4-linux-arm32v7\">mcr.microsoft.com\/azureiotedge-agent:1.0.4-linux-arm32v7<\/a><\/li>\n<\/ol>\n<\/li>\n<li class=\"code-line\">Restart IoT Edge runtime:\u00a0<code>$ sudo systemctl restart iotedge<\/code><\/li>\n<li class=\"code-line\">Check IoT Edge runtime status:\u00a0<code>$ sudo systemctl status iotedge<\/code>\u00a0<img decoding=\"async\" id=\"image-hash-7e52c58e9dd0bf03f184a0e89b183397d0f8b3a47366f6af07cdb7cc0d985da0\" src=\"https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2018\/11\/runtime-status.png\" alt=\"\" \/><\/li>\n<li class=\"code-line\"><a title=\"https:\/\/docs.microsoft.com\/en-us\/azure\/iot-edge\/how-to-deploy-modules-portal\" href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/iot-edge\/how-to-deploy-modules-portal\">Deploy simulated temperature sensor module<\/a>\n<ol>\n<li class=\"code-line\">In the 5th step of the above linked tutorial, use\u00a0<code>mcr.microsoft.com\/azureiotedge-simulated-temperature-sensor:1.0.4-linux-arm32v7<\/code>\u00a0instead of\u00a0<code>mcr.microsoft.com\/azureiotedge-simulated-temperature-sensor:1.0<\/code>.<\/li>\n<li class=\"code-line\">Before the 9th step of the above linked tutorial, click the \u201cConfigure advanced Edge runtime settings\u201d button\u00a0<img decoding=\"async\" id=\"image-hash-0da40b218fff07f42407044f88e9723c59ad415535e12349c5d8380e2988c76e\" src=\"https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2018\/11\/advanced-runtime-settings.jpg\" alt=\"\" \/>\n<ol>\n<li class=\"code-line\">Set Edge Hub&#8217;s Image with\u00a0<code>mcr.microsoft.com\/azureiotedge-hub:1.0.4-linux-arm32v7<\/code><\/li>\n<li class=\"code-line\">Set Edge Agent&#8217;s Image with\u00a0<code>mcr.microsoft.com\/azureiotedge-agent:1.0.4-linux-arm32v7<\/code><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<\/li>\n<li class=\"code-line\">Wait for about a few seconds, check the status of edgeAgent, edgeHub and the simulated temperature sensor module\n<ol>\n<li class=\"code-line\"><code>$ sudo iotedge list<\/code>\u00a0<img decoding=\"async\" id=\"image-hash-63b250ec5eab9799254c9d3fa4881afc6ff876b5ea31b8274f5a33698f1cbd2d\" src=\"https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2018\/11\/iotedge-list.png\" alt=\"\" \/><\/li>\n<li class=\"code-line\"><code>$ sudo docker ps<\/code>\u00a0<img decoding=\"async\" id=\"image-hash-6c8cdf847fab0f55d18c8eebc535472dc8e255708f11d81e7a01b1f894e51453\" src=\"https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2018\/11\/docker-ps.jpg\" alt=\"\" \/><\/li>\n<li class=\"code-line\"><code>$ sudo docker logs -f &lt;module_name&gt;<\/code>\u00a0to check module logs\uff0cfor example:\u00a0<img decoding=\"async\" id=\"image-hash-73ee5e2dc8cb3918960897d109cfec3f2a9925c4337f384857d57ccb75b0e8b1\" src=\"https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2018\/11\/docker-logs.png\" alt=\"\" \/><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Azure IoT Edge went\u00a0generally available\u00a0in June, with\u00a0official support\u00a0for AMD64 and ARM32 platforms. Recently, more and more developers from the community requested to run Azure IoT Edge on ARM64 (a.k.a. AArch64) devices such NVIDIA TX2. While the ARM64 support of Azure IoT Edge is still in progress, this post will introduce a workaround. When we talk [&hellip;]<\/p>\n","protected":false},"author":536,"featured_media":2086,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[5,6,7,16,17,20],"class_list":["post-2074","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-iot-dev","tag-azure","tag-azure-iot","tag-azure-iot-hub","tag-internet-of-things","tag-iot","tag-iot-edge"],"acf":[],"blog_post_summary":"<p>Azure IoT Edge went\u00a0generally available\u00a0in June, with\u00a0official support\u00a0for AMD64 and ARM32 platforms. Recently, more and more developers from the community requested to run Azure IoT Edge on ARM64 (a.k.a. AArch64) devices such NVIDIA TX2. While the ARM64 support of Azure IoT Edge is still in progress, this post will introduce a workaround. When we talk [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/posts\/2074","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/users\/536"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/comments?post=2074"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/posts\/2074\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/media\/2086"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/media?parent=2074"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/categories?post=2074"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/tags?post=2074"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}