iot: Cargo causes GpioController to hang on Raspberry Pi 5 Bookworm

Describe the bug

On a Raspberry Pi 5 with a .NET project that uses GpioController, new GpioController() hangs after installing cargo. The same image does not have a problem on other versions of Pi hardware. I found removing llvm-14-tools restores the functionality, but installing that package by itself does not cause the problem.

Steps to reproduce

# Install .NET
wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
bash ./dotnet-install.sh
echo 'export PATH=$PATH:$HOME/.dotnet' >> ~/.bashrc
echo 'export DOTNET_ROOT=$HOME/.dotnet' >> ~/.bashrc
source ~/.bashrc

# Make test project
dotnet new console -n cargotest
cd cargotest
dotnet add package System.Device.Gpio --version 3.2.0
nano Program.cs

Put the following content into Program.cs

using System.Device.Gpio;
Console.WriteLine("before new");
var controller = new GpioController(PinNumberingScheme.Logical);
Console.WriteLine("after new");
controller.Dispose();
Console.WriteLine("exiting");

Test the behaviors

# do the testing
# it should work first try
dotnet run .
sudo apt install -y cargo
# it should fail on this try, cancel once you see it is not moving forward
dotnet run .
sudo apt remove -y llvm-14-tools
# it should work on this last try
dotnet run .

Expected behavior

new GpioController() should not hang with cargo installed (or any non-dotnet package), in the example all 3 Console.WriteLine calls should execute.

Actual behavior

Only the first Console.WriteLine before new GpioController() executes and then it hangs without continuing or error.

Versions used

  • Version of System.Device.Gpio package 3.2.0
  • dotnet --info on the machine where app is being built and run .NET SDK: Version: 8.0.303 Commit: 29ab8e3268 Workload version: 8.0.300-manifests.c915c39d MSBuild version: 17.10.4+10fbfbf2e

Runtime Environment: OS Name: debian OS Version: 12 OS Platform: Linux RID: linux-arm64 Base Path: /home/genmonpi/.dotnet/sdk/8.0.303/

.NET workloads installed: There are no installed workloads to display.

Host: Version: 8.0.7 Architecture: arm64 Commit: 2aade6beb0

.NET SDKs installed: 8.0.303 [/home/genmonpi/.dotnet/sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 8.0.7 [/home/genmonpi/.dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 8.0.7 [/home/genmonpi/.dotnet/shared/Microsoft.NETCore.App]

Other architectures found: None

Environment variables: DOTNET_ROOT [/home/genmonpi/.dotnet]

global.json file: Not found

Learn more: https://aka.ms/dotnet/info

Download .NET: https://aka.ms/dotnet/download

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 31 (31 by maintainers)

Most upvoted comments

The Chromium loop wasn’t breaking for me either even though it existed. The problem is specific to a Pi 5, I tried on a Pi 3A+, 3B, 3B+, Pi 4, Zero 2, and Pi 5 and Pi 5 was the only spot it didn’t work.