One of the IoT Edge Module is in Backoff state Raspberry Pi 4 with Raspbian OS

狂风中的少年 提交于 2021-01-07 01:34:03

问题


I have developed a module and built the image for arm64v8 architecture as my Edge device is running in Raspberry Pi 4. I got the file deployment.arm64v8.json in the config folder correctly. But when I right-click on the device in Visual Studio Code and select Create Deployment for Single Device, the modules are getting added, but one of the modules is showing Backoff state. What could be the problem here, and was strictly following this doc.

I also tried restarting the services.

Device Information

Host OS: Raspberry OS Architecture: Arm64v8 Container OS: Linux containers

Runtime Versions

iotedged: iotedge 1.0.9.4 Docker/Moby [run docker version]:

Update:

I am trying to build arm32 image in my 64 bit Windows Dev Machine, I guess that is the reason why I am getting this issue. Now I have 3 options.

  1. Install the 64 bit version of Raspberry OS from here
  2. Set up a 32 bit virtual machine and use it as a dev machine and build 32 bit images
  3. I already have a WSL running, maybe running the Visual Studio code solution there?

Could you please tell me what would be the better way?


回答1:


There were a couple of issues where I was doing wrong. First thing is that I was trying to build an arm64 image in my 64 bit Windows Dev Machine and then deploy the image to the arm32 Raspbian OS, which will never work. You can see the version and other details by running the below commands.

If it says aarch64 then it is 64 bit. If it says armv7l then it is 32 bit. In my case, it is arm71. So now I had to build an arm32 container images on my 64 bit Windows Host machine and use it on my Raspberry Pi 4. According to this doc, it is definitely possible.

You can build ARM32 and ARM64 images on x64 machines, but you will not be able to run them

Running was not my problem, as I just had to build the image and I will use it in my Raspberry Pi. To make it work, I had to change my Dockerfile.arm32v7, specifically the first line where we pull the base image.

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build-env
WORKDIR /app

COPY *.csproj ./
RUN dotnet restore

COPY . ./
RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/core/runtime:3.1-buster-slim-arm32v7
WORKDIR /app
COPY --from=build-env /app/out ./

RUN useradd -ms /bin/bash moduleuser
USER moduleuser

ENTRYPOINT ["dotnet", "SendTelemetry.dll"]

The "build-env" image should be the same architecture as the host OS, the final image should be the target OS architecture. Once I made the changes to the docker file, I changed the version in the module.json file inside my module folder so that the new image with a new tag will be added to the Container Registry when I use the option Build and Push IoT Edge Solution after right-clicking deployment.template.json, and then I used Create Deployment for Single Device option after right-clicking on the device name in Visual Studio Code. And then when I monitor the device (Start Monitoring Built-in Event Endpoint option), I am getting this output.

Support with Microsoft was really cool with this issue. They really helped me to solve this GitHub issue that I had posted.



来源:https://stackoverflow.com/questions/63249180/one-of-the-iot-edge-module-is-in-backoff-state-raspberry-pi-4-with-raspbian-os

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!