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.
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.
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.
Click Start, type PowerShell
Right-click Windows PowerShell, and then click Run as administrator.
Start WSL to use the Linux Bash command line interface
Installing the Daemonize tool which will allow the creation of a 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.
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.