Getting IoT Edge Agent error trying to run a Linux container on Windows host: "image operating system "linux" cannot be used on this platform" - docker-for-windows

I am trying to create an Azure IoT Edge device on a Windows host, but running a module built as a Linux container. In a previous experiment, I was able to successfully create an Azure IoT Edge device on a Linux host, and successfully running this same Linux container module.
However, when I deploy the module onto the Windows host, the module shows that it is not running, and when I view the module's log using "iotedge logs camera-capture" I get the following error:
<6> 2019-12-02 13:32:56.016 -08:00 [INF] - Executing command: "Create module camera-capture"
<3> 2019-12-02 13:33:11.674 -08:00 [ERR] - Executing command for operation ["create"] failed.
Microsoft.Azure.Devices.Edge.Agent.Edgelet.EdgeletCommunicationException- Message:Error calling Create module camera-capture: Could not create module camera-capture
caused by: Could not pull image localhost:5000/camera-capture-opencv:1.1.128-amd64
caused by: image operating system "linux" cannot be used on this platform, StatusCode:500, at: at Microsoft.Azure.Devices.Edge.Agent.Edgelet.Version_2019_01_30.ModuleManagementHttpClient.HandleException(Exception exception, String operation) in C:\agent\_work\4\s\edge-agent\src\Microsoft.Azure.Devices.Edge.Agent.Edgelet\version_2019_01_30\ModuleManagementHttpClient.cs:line 194
I have found no results online, or through Microsoft forums, regarding this particular error that was able to resolve my problem. For the record, I have ensured:
I am running a compatible Windows 10 host (17763)
I have Hyper-V and Containers installed
I have VT enabled in the BIOS
I have configured my deployment.template.json to build as "amd64" platform
I have configured my Docker Desktop to run using Linux Containers (and also enabled Experimental mode)
I have tested the basic "hello-world" ubuntu example online, and it works when I run it from Powershell, which proves that a Linux container will run on my Windows host
Any help would be greatly appreciated!

After spending a few days stuck on this issue, I finally found the solution. The problem was with the IoT Edge runtimes on Windows were not configured to handle Linux containers!
As of this writing, the solution is documented here by Microsoft: https://learn.microsoft.com/en-us/azure/iot-edge/how-to-install-iot-edge-windows-with-linux
But in case of a future dead link, you basically have to add additional flags when you install your Azure IoT Edge runtimes to handle linux containers.
. {Invoke-WebRequest -useb aka.ms/iotedge-win} | Invoke-Expression; `
Deploy-IoTEdge -ContainerOs Linux
. {Invoke-WebRequest -useb aka.ms/iotedge-win} | Invoke-Expression; `
Initialize-IoTEdge -ContainerOs Linux

I changed Docker Desktop to Linux container mode and compiled in VSCode. It worked like magic.

Related

Gazebo GUI Not Showing Up when running WSL2 Graphics on Windows 11

I am attempting to use ROS with the Gazebo GUI. I recently upgraded to Windows 11 for the WSL GUI support and have the gedit GUI working. However, when I run the command $ gazebo, the GUI does not open.
Running $ gazebo --verbose gives the following error messages
[Err] [RenderEngine.cc:749] Can't open display: :0
[Err] [GuiIface.cc:124] This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.
After enabling the QT Debug environment variable using export export QT_DEBUG_PLUGINS=1 and rerunning the gazebo command with the verbose option set, It shows me
[Dbg] [GuiIface.cc:112] Got keys from plugin meta data ("xcb")
[Dbg] [GuiIface.cc:112] QFactoryLoader::QFactoryLoader() checking directory path "/usr/bin/platforms" ...
[Dbg] [GuiIface.cc:112] loaded library "/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so"
I believe that I have all of the necessary packages installed from this output, so I am wondering why gazebo is not showing up. I have tried uninstalling/reinstalling gazebo to no avail.
Thank you so much for your time. If I get this problem sorted out, I will post. Please let me know if any other system/output information is needed.
Other information:
I am not using X Server because the Windows 11 upgrade does not require it for graphical WSL applications (but did try it with X Server installed just in case)
I have tinkered around with the ~/.bashrc profile. DISPLAY=0:0 option was set, but I deleted this because Windows 11 did not need it (or so I think?)
Solution:
After reading up online, I found this answer to a similar question to mine.
https://superuser.com/questions/1681647/windows-11-wsl-not-opening-gui-in-my-ubuntu-shell
Getting ubuntu and re-installing gazebo on that worked. Now I can open up the Gazebo GUI.

Stuck in Network azure-iot-edge-dev is external, skipping

Runing the Build and Run Iot Edge Solution in Simulator stopped working suddenly, and the log builds the containers and stops at this message Network azure-iot-edge-dev is external, skipping Everything was working fine 5mins ago, tried rebooting, restarting docker, iotedgehubdev, but in vain. Do you know how can I get more logs and/or resolve this problem ?
This is a generic error that is thrown for a variety of reasons.
Possible causes can be:
Proxy blocking pulling images of edgeHub and edgeAgent
A problem in the deployment.template.json (or debug template), e.g. missing brackets
Ports of edgeHub that are in use
Docker configured for Windows containers when targeting Linux or visa-versa
The Build output or IoT hub output in Visual Studio usually gives a bit more information.
Do you know how can I get more logs and/or resolve this problem ?
Are you trying to debug/simulate it locally on windows 10 machine?
When you need to gather logs from an IoT Edge device, the most convenient way is to use the support-bundle command. By default, this command collects module, IoT Edge security manager and container engine logs, iotedge check JSON output, and other useful debug information. It compresses them into a single file for easy sharing. The support-bundle command is available in release 1.0.9 and later.
Run the support-bundle command with the --since flag to specify how long from the past you want to get logs. For example 6h will get logs since the last six hours, 6d since the last six days, 6m since the last six minutes and so on. Include the --help flag to see a complete list of options.
sudo iotedge support-bundle --since 6h
By default, the support-bundle command creates a zip file called support_bundle.zip in the directory where the command is called. Use the flag --output to specify a different path or file name for the output.
Incase if you are looking to debug the modules locally on VS2019, VS Code below documentations will be useful.
Use Visual Studio 2019 to develop and debug modules for Azure IoT Edge and
Use Visual Studio Code to develop and debug modules for Azure IoT Edge
Please share the complete logs if the above doesn't help.
I have this issue when trying to start a project from within Visual Studio when it's not running in administrator mode. I always forget and end up with this error. Same goes for if I run "iotedgehubdev.exe setup" from a command prompt. It only works when the command prompt is running in administrator mode.

IoTEdge module gives timeout

I have an IoTEdge module which runs a deep learning model on a Raspberry Pi 3 and runs well but then somehow returns this error:
Error: Time:Mon Jan 28 22:45:21 2019 File:/usr/sdk/src/c/iothub_client/src/iothubtransport_mqtt_common.c Func:InitializeConnection Line:2230 mqtt_client timed out waiting for CONNACK
Is this a network connection issue? It seems afterwards, this error disappears. Not sure why this is the case. I thought there might be a communication error between this IoTEdge module and the IoTHub, so I even restarted the IoTEdge module and rebooted the Raspberry Pi device.
How can this be resolved? Does it have to deal with a time.sleep(1) code in Python?
You are using the original version of the Azure IoT Python SDK. This is a wrapper around the C SDK and the message you are encountering is a known bug in the C SDK. This has been fixed in the C SDK but was never propagated into the Python v1 reposiotry.
I suggest that you rebuild your Edge module using the new Python v2 SDK (https://github.com/Azure/azure-iot-sdk-python). By default, this is the version now used by the Visual Studio Cloud Azure Edge extension.

Server not starting in IBM API connect toolkit

I have created API's in API connect toolkit. For testing the API locally in Explore tab, I am trying to start server.
But getting "Error: It appears that Docker for Windows has not been installed. To install Docker for Windows, please visit https://docs.docker.com/docker-for-windows/install/ For more information, check the docs" error.
From my understanding you don't need docker to test locally in toolkit. Any suggestions to fix the issue?
More Info: APIC version: API Connect: v5.0.8.3 (apiconnect: v2.7.209) NPM version : 6.1.0
It used to work before suddenly I am getting the above error. I tried re-installing but issue persist.
With new versions of APIC you must have Docker installed and working properly on your Windows environment to be able to install the API Connect Toolkit with DataPower.
Please find the steps to install the APIC toolkit on these pages:
https://www.ibm.com/support/knowledgecenter/en/SSFS6T/com.ibm.apic.toolkit.doc/tapim_cli_install.html
https://www.ibm.com/support/knowledgecenter/en/SSFS6T/com.ibm.apic.toolkit.doc/tapim_apic_test_with_dpdockergateway.html

The operating system of the container does not match

I have created a Windows Server 2016 VM, build 15063.2.
I installed Docker EE according to these instructions.
I can pull images and list them. But I cannot run them.
I tried running microsoft/windowsservercore using this command.
docker run -it microsoft/windowsservercore cmd
It fails saying the version of the OS doesn't match. Full error output is below.
docker: Error response from daemon: container
266a8f9f77f7ee57efb41ecd74001721b57fbbf1fc85150fd5156627782b6f61
encountered an error during CreateContainer: failure in a Windows
system call: The operating system of the container does not match the
operating system of the host. (0xc0370101) extra info:
{"SystemType":"Container","Name":"266a8f9f77f7ee57efb41ecd74001721b57fbbf1fc85150fd5156627782b6f61","Owner":"docker","IsDummy":false,"VolumePath":"\\?\Volume{8adf7e25-dc21-4bb9-8aaf-80408b5d5085}","IgnoreFlushesDuringBoot":true,"LayerFolderPath":"C:\ProgramData\docker\windowsfilter\266a8f9f77f7ee57efb41ecd74001721b57fbbf1fc85150fd5156627782b6f61","Layers":[{"ID":"9ca74b81-1d43-5ae3-b82e-4c584e5ebba7","Path":"C:\ProgramData\docker\windowsfilter\1e0c3f8d0cd7905b72efc4b4114c33b4585623e82a3d661636c68a5637a213d2"},{"ID":"86613523-d1d5-5b5b-8889-fc0c33a7d7ab","Path":"C:\ProgramData\docker\windowsfilter\31578f2c995a3891bb3af19de88efff45dbec9f9bdc6067c133abcf05a451171"}],"HostName":"266a8f9f77f7","MappedDirectories":[],"HvPartition":false,"EndpointList":["43f9f400-ce4f-48e9-89a1-b3b804285e61"],"Servicing":false,"AllowUnqualifiedDNSQuery":true}.
How do I figure the correct version of the host OS to use?