1

I created an out the box template c# edge solution in VScode using the IoT tools but get the following error when trying to build and push the solution:

Step 4/12 : RUN dotnet restore
---> Running in 22c6f8ceb80c
A fatal error occurred, the folder [/usr/share/dotnet/host/fxr] does not contain any version-numbered child folders
The command '/bin/sh -c dotnet restore' returned a non-zero code: 131

This is clearly happening when its trying to run through the commands in Dockerfile.arm32v7 which has the following in it:

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster-arm32v7 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", "SampleModule.dll"]

This only happens when building for arm32v7 but works for amd64. I'm building for use on raspberry pi so I need arm32.

Seems to me maybe a problem with my environment but not sure where to look? I've also seen some comments that you need to build on an ARM host machine if you want it to work but I haven't seen that in the documentation before and doesn't make sense from an ease of development point of view

rareg3636
  • 29
  • 4
  • May I know what documentation you have referred ? – SatishBoddu Jun 17 '20 at 20:52
  • @SatishBoddu-MSFT, to maybe clarify - I have worked through a few turtorials in the microsoft docs but didnt notice anything to say I have to use a particular machine to build the arm32 solution. If someone can point this out then great. – rareg3636 Jun 17 '20 at 23:07
  • Please follow this [Dockerfile.debian-arm32](https://github.com/dotnet/dotnet-docker/blob/master/samples/dotnetapp/Dockerfile.debian-arm32), and try once if it helps, i.e please try to use this FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build in the line 1, let me know if that helps. – SatishBoddu Jun 17 '20 at 23:11
  • Thanks @SatishBoddu-MSFT, changing line 1 worked but I also had to change COPY --from=build-env /app/out ./ to COPY --from=build /app . for it to finsih building and push. When I deploy to my raspberry pi though the module stays in failed state with this following logs: "It was not possible to find any installed .NET Core SDKs Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from: https://aka.ms/dotnet-download". Should I need to install the .net sdk on the Pi? – rareg3636 Jun 18 '20 at 13:26
  • this is the error when I try run in the Edge Simulator: SampleModule | A fatal error occurred, the folder [/usr/share/dotnet/host/fxr] does not contain any version-numbered child folders SampleModule exited with code 131 – rareg3636 Jun 18 '20 at 15:31
  • I too saw this error when working on VS2019 with 2 EdgeModules. I did updated the IoT edge connection string from Tools menu, then set Solution to 'Release' mode, then built each Module project individually and then built the entire solution and this time it worked. May be you can give it a try on VS2019. The point is somewhere the VS code (in your case) has incorrect info regarding the IoT Hub connection or is not built correctly. Also check your Docker engine running with right container type. – SatishBoddu Jun 25 '20 at 03:56

1 Answers1

0

When submitting a build using az acr build, you can pass in the parameter --platform linux/arm/v7 which should give you an ARM build environment.

If you prefer to build locally, you can try using the pulling the qemu package into the build context in the first stage of your Dockerfile.

bpdohall
  • 1,046
  • 6
  • 9
  • Thanks - I guess the the root issue was that I needed the ARM environment to build the solution. I managed that by using my raspberry pi and following this article: https://devblogs.microsoft.com/iotdev/easily-build-and-debug-iot-edge-modules-on-your-remote-device-with-azure-iot-edge-for-vs-code-1-9-0/ . So I assume the above would work but I wasn't able to test myself – rareg3636 Jul 01 '20 at 14:35