Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The "--use-current-runtime" option doesn't work correctly in Arm-based musl system (Alpine)

See original GitHub issue

The --use-current-runtime option should make use of the current system’s RID. This is not working currently when that system is on the Arm architecture and musl-based. I specifically used Alpine. Not sure if it’s all musl systems or just specific to Alpine since Alpine has its own RID. It’s essentially treating it as a non-musl-based system. In other words, it’s deriving the RID as linux-arm64 instead of linux-musl-arm64. What’s interesting is that this only occurs for Arm64/Arm32 but not x64.

This can be shown in two ways using the dotnet restore and dotnet publish commands.

Repro steps

  1. Install .NET 7 RC2 SDK
  2. Verify RID by running dotnet --info:
 Version:   7.0.100-rc.2.22477.23
 Commit:    0a5360315a

Runtime Environment:
 OS Name:     alpine
 OS Version:  3.16
 OS Platform: Linux
 RID:         alpine.3.16-arm64
 Base Path:   /usr/share/dotnet/sdk/7.0.100-rc.2.22477.23/

  Version:      7.0.0-rc.2.22472.3
  Architecture: arm64
  Commit:       550605cc93

.NET SDKs installed:
  7.0.100-rc.2.22477.23 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.0-rc.2.22476.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 7.0.0-rc.2.22472.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:

Environment variables:
  Not set

global.json file:
  Not found

Learn more:

Download .NET:
  1. Create a simple console app: dotnet new console
  2. Restore the project: dotnet restore --use-current-runtime -v normal

Notice in the output that package names are not specific to musl when they should be. For example, linux-arm64 should be linux-musl-arm64 in this output:

  1. Restore again, this time explicitly specifying the RID: dotnet restore -r linux-musl-arm64
  2. Now attempt to publish using the --use-current-runtime option: dotnet publish -c Release -o /app --use-current-runtime --no-restore

And you get this error because it’s trying to use linux-arm64 instead of linux-musl-arm64:

/usr/share/dotnet/sdk/7.0.100-rc.2.22477.23/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(267,5): error NETSDK1047: Assets file '/source/obj/project.assets.json' doesn't have a target for 'net7.0/linux-arm64'. Ensure that restore has run and that you have included 'net7.0' in the TargetFrameworks for your project. You may also need to include 'linux-arm64' in your project's RuntimeIdentifiers. [/source/aspnetapp.csproj]

If you just use --use-current-runtime for all these steps and ignore the fact it’s not doing the right stuff, the app won’t run because it’s not using the correct bits for the system it’s running on. You end up getting this fun error when attempting to run the app:

standard_init_linux.go:228: exec user process caused: no such file or directory

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

am11commented, Oct 30, 2022

The --use-current-runtime option should make use of the current system’s RID. This is not working currently when that system is on the Arm architecture and musl-based.

I am actually using --use-current-runtime on musl arm64 for a while with net6.0 earliest RTM in a build machine. This regression was introduced in #22373 which I noticed a few weeks ago when testing upgrades with 7.0.0-rc2. We should backport the regression fix to 6.x as well.

mmitchecommented, Oct 28, 2022

@mthalman I would hope so, but we are running out of time, or have already ran out of time, for fixes in GA. Probably the former. @tmds Was this fix planned for GA?

cc @mmitche

We have definitely run out of time for GA. But this could be fixed in 7.0.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Wheels for musl (Alpine) - Packaging - Python discussion
My reading of Rich's post is that generally, you can be pretty confident that it works to build against musl version X and...
Read more >
how to get rust to compile an a purely musl-based system?
Hey,. I'm trying to compile signal-rs on an arm-device on postmarketOS (based on alpine), which uses musl as its C standard libary.
Read more >
Wheels for musl (Alpine) - #63 by uranusjr - Packaging
I just want to make the issue with Rust + musl 1.2 on 32-bit systems very clear, if anyone is planning on using...
Read more >
Building a distro with musl libc Why and how Alpine Linux did it
FOSDEM 2017 Hacking conference#hacking, #hackers, #infosec, #opsec, #IT, #security.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found