runtime: .NET Core 2.2 alpine images have 'unknown' rid

@tmds commented on Sat Dec 22 2018

.NET Core 2.2 alpine images use alpine 3.8. This rid isn’t in the .NET Core 2.2 rid graph. This causes .NET Core to fall back to the linux-x64 rid. This may cause issues in particular because linux-x64 implies glibc, and alpine uses musl.


@MichaelSimons commented on Wed Jan 02 2019

This is an issue with the RID graph in CoreFx. Moving issue.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 23 (21 by maintainers)

Commits related to this issue

Most upvoted comments

IMO - at a minimum we need to add alpine 3.8 to the RID graph for 3.0. And we probably need to be adding it to the RID graph for 2.1 and 2.2 since we claim we support “Alpine Linux 3.7 or later versions” (see Linux Prerequisites).

Without this RID in the graph, we are not supporting Alpine 3.8.

@tmds, good point. To test whether it works in 2.2 Alpine docker, we could create a nuget package with only Alpine 3.8 and/or 3.9 native deps say, C-libgethelloworld (resolver mustn’t know about unreleased versions of OS either 😄), and restore from local filesystem-based repo.

I read some related points in @eerhardt’s post: https://github.com/dotnet/core-setup/issues/1846. Looks like we have a way to override the RID using environment variable DOTNET_RUNTIME_ID=linux-musl-x64 (which official 3.8 Dockerfile can define): https://github.com/dotnet/core-setup/blob/dbb1c1e5/src/corehost/cli/deps_format.cpp#L138-L163, but it would be also good if implementation insert musl there as well, e.g. in CMAKE:

# to accommodate future versions of alpine and other musllibc-based distros
execute_process (
    COMMAND ldd --version 2>&1 | grep musl
    OUTPUT_VARIABLE CLR_CMAKE_MUSL_LIBC_PLATFORM
)

and wire the #define in C++ code to insert the value in the construction of RID and in fallback RID. The fallback RID currently does not account for non-glibc Linux (or Berkeley distros): https://github.com/dotnet/core-setup/blob/c90e8d7e/src/corehost/common/pal.h#L61-L72, where the proposed CLR_CMAKE_MUSL_LIBC_PLATFORM could be used.

Yes, 2.1.9 does have the right change(I just re-verified 😄). This problem with the Platforms package only affected release/2.2 branch.

This will get fixed in the upcomming 2.2 release (2.2.5). Even though this got checked in for 2.2.3, there was a problem with our Platforms package that has now been addressed. 2.2.5 will contain the fix for this.

@joperezr Microsoft Alpine .NET Core 2.2 images are based on Alpine 3.8. Because 3.8 isn’t in the 2.2 rid graph, weird issues will happen.

@steveharter @jeffschwMSFT @vitek-karas - for thoughts on changing the fallback RID calculation for musl based distros. (It makes sense to me.)

IMO - the root issue here is that RIDs are supposed to be opaque strings, but that design doesn’t scale/work in the Linux/Unix distro world. See https://github.com/NuGet/Home/issues/5862 which describes the issue perfectly. However that issue has gotten zero traction and is 1.5 years old.

/cc @ericstj @rrelyea