Blog Post

Internet of Things Blog
4 MIN READ

Linux modules with Azure IoT Edge on Windows 10 IoT Enterprise

twarwick's avatar
twarwick
Icon for Microsoft rankMicrosoft
May 26, 2020

Microsoft is enabling the ability to run Linux modules with Azure IoT Edge for Linux on Windows 10 IoT Enterprise.

 

This includes the ability to deploy pre-built Linux modules available in the Azure Marketplace from Microsoft as well as 3rd party publishers in addition to custom workloads built for a specific scenario. Running Linux modules on Windows just part of the solution.

 

In addition, Windows processes will be able to smoothly interact with Linux modules running on the same physical device. This will allow a Windows process that may provide UI as well as act as a proxy to data access or specific hardware to be backed by business logic or data inferencing provided by a Linux module.

 

 

This blog will allow you to experience Linux modules on Windows using Azure IoT Edge for Linux as demonstrated in the IoT Show: Linux modules on Windows 10 IoT Enterprise, as a developer

Update: Nov 10, 2020
Additionally, we now have multiple sample code projects available at https://aka.ms/winiotsamples which demonstrates messaging interop between a Windows application and a Linux Edge Module running in a Linux virtual machine.

Keep an eye out for our Azure IoT Edge for Linux on Windows Public Preview coming soon
https://aka.ms/AzIoTEdgeforLinuxOnWindows

  

 

 

Additional information will be provided before 2020 end-of-year about an "official" offering to support Linux modules on Windows using a Linux environment provided by Microsoft specifically for running Azure IoT Edge for Linux in a production environment. 

Recipe: Linux modules on Windows

The following recipe will walk you through the setup and deployment of Azure IoT Edge for Linux as well as deploy one or more Linux modules from the Azure Marketplace on Windows. 

 

For this exercise, you may use either a physical machine running Windows 10 or a virtual machine running Windows 10.   If you choose to use a Windows 10 virtual machine for this exercise you will need to enable nested virtualization before continuing. 

Install the Windows Subsystem for Linux with Ubuntu 18.04 LTS

Windows Subsystem for Linux is designed to support developer workflows, however in this case we are using it to demonstrate a “Proof of Concept” for IoT workloads in production environments.

Now type the following command into PowerShell to confirm that you are ready to go to the next step.

 

 

 

 

wsl --list --verbose

 

 

 

 

 

You should see the following:

Configure WSL 2 to run SystemD to support Moby

WSL 2, which uses a custom init to support integration with multiple Linux distributions, is nearly ready to install Azure IoT Edge for Linux, but first we need to provide a systemd process management environment. Systemd is preinstalled with the Ubuntu 18.04 LTS distribution that you installed previously but it is inactive. The following steps will create a new namespace running systemd then move into that namespace so that we can install Azure IoT Edge and the Moby container engine.

 

CAUTION:  Invoking systemd in WSL 2 is considered an unsupported *HACK* that we are using to demonstrate a this developer scenario. This is NOT to be interpreted as an officially supported scenario and may cause odd behavior with other distributions that you may be using with WSL 2. It is also important to understand that this *HACK* is not persistent. If you reboot Windows, WSL 2 will revert to its default configuration using init.

 

You will enable systemd using a PowerShell administrator session.

 

  1. Click Start, type PowerShell
  2. Right-click Windows PowerShell, and then click Run as administrator.
  3. Start WSL to use the Linux Bash command line interface

 

 

 

 

wsl

 

 

 

 

  1. Installing the Daemonize tool which will allow the creation of a systemd namespace

 

 

 

 

sudo apt-get update -y
sudo apt-get install -y daemonize

 

 

 

 

  1. Create the systemd namespace using daemonize

 

 

 

 

sudo daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target

 

 

 

 

  1. Enter the newly created systemd namespace

 

 

 

 

exec sudo nsenter -t $(pidof systemd) -a su - $LOGNAME

 

 

 

 

 

Note: To return to this WSL session running systemd after a reboot or a new login, simply repeat steps 5 and 6 above.  

 

Deploy Azure IoT Edge with Linux modules

Now that the WSL 2 environment is configured to allow Azure IoT Edge to install, please follow the instructions in each of the following articles to install Azure IoT Edge for Linux and deploy a Linux module from Azure IoT Hub.

 

IMPORTANT: Make sure that you choose the Ubuntu 18.04 or Ubuntu Server 18.04 path when there are multiple operating system choices presented so that your Azure IoT Edge runtime matches the Linux distribution installed earlier.  

 

  1. Register an Azure IoT Edge device
  2. Install Azure IoT Edge runtime for Debian-based Linux Systems  
  3. Deploy Azure IoT Edge Linux modules from the Azure portal

 

Next Steps

Stay tuned for a follow up to this blog in June/July 2020 which will demonstrate how you can build a solution that employs bidirectional communication between a native Windows process and a Linux module as demonstrated in the IoT Show: Linux modules on Windows 10 IoT Enterprise.

Updated Nov 11, 2020
Version 7.0
  • bbenrsa's avatar
    bbenrsa
    Copper Contributor

    Hey twarwick, ,

    Has there been any update on this? I haven't been able to find any documentation since this about either the private or public release this fall or the final release for next year. Very excited about the Linux container capability!!

  • bbenrsa's avatar
    bbenrsa
    Copper Contributor

    Awesome! Thanks so much, appreciate the quick response too