Skip to content

Loading issue when RID is linux-musl-x64 on Alpine 3.15 #65152

@adityapatwardhan

Description

@adityapatwardhan

Description

When loading dependencies of PowerShell on Alpine 3.15, it falls back to load linux-x64 dependencies. The issue does not repro with alpine 3.14. In both cases, the SDK version is 6.0.0.

It was found that the RID for Alpine 3.15 is missing on .NET 6 SDK. See: #62938

Note, dotnet --info does show the correct RID:

~/.dotnet/tools # dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Runtime Environment:
 OS Name:     alpine
 OS Version:  3.15
 OS Platform: Linux
 RID:         linux-musl-x64
 Base Path:   /usr/share/dotnet/sdk/6.0.100/

Host (useful for support):
  Version: 6.0.0
  Commit:  4822e3c3aa

.NET SDKs installed:
  6.0.100 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

I have attached load trace logs for the powershell load failure. loadtrace.txt

Excerpt below:

HostRID is alpine.3.15-x64
Falling back to base HostRID: linux-x64
The targeted framework does not support the runtime 'linux-x64'. Some native libraries from [System.Speech/6.0.0] may fail to load on this platform.
The targeted framework does not support the runtime 'linux-x64'. Some native libraries from [System.Speech/6.0.0] may fail to load on this platform.
The targeted framework does not support the runtime 'linux-x64'. Some native libraries from [System.Speech/6.0.0] may fail to load on this platform.
The targeted framework does not support the runtime 'linux-x64'. Some native libraries from [runtime.win-arm64.runtime.native.System.Data.SqlClient.sni/4.4.0] may fail to load on this platform.
The targeted framework does not support the runtime 'linux-x64'. Some native libraries from [runtime.win-arm64.runtime.native.System.Data.SqlClient.sni/4.4.0] may fail to load on this platform.
The targeted framework does not support the runtime 'linux-x64'. Some native libraries from [runtime.win-arm64.runtime.native.System.Data.SqlClient.sni/4.4.0] may fail to load on this platform.
The targeted framework does not support the runtime 'linux-x64'. Some native libraries from [runtime.osx-x64.runtime.native.System.IO.Ports/6.0.0] may fail to load on this platform.
The targeted framework does not support the runtime 'linux-x64'. Some native libraries from [runtime.osx-x64.runtime.native.System.IO.Ports/6.0.0] may fail to load on this platform.
The targeted framework does not support the runtime 'linux-x64'. Some native libraries from [runtime.osx-x64.runtime.native.System.IO.Ports/6.0.0] may fail to load on this platform.
The targeted framework does not support the runtime 'linux-x64'. Some native libraries from [runtime.linux
[loadtrace.txt](https://github.com/dotnet/runtime/files/8043912/loadtrace.txt)
-x64.runtime.native.System.IO.Ports/6.0.0] may fail to load on this platform.
The targeted framework does not support the runtime 'linux-x64'. Some native libraries from [runtime.linux-x64.runtime.native.System.IO.Ports/6.0.0] may fail to load on this platform.
The targeted framework does not support the runtime 'linux-x64'. Some native libraries from [Microsoft.Win32.Registry.AccessControl/6.0.0] may fail to load on this platform.
The targeted framework does not support the runtime 'linux-x64'. Some native libraries from [Microsoft.Win32.Registry.AccessControl/6.0.0] may fail to load on this platform.
The targeted framework does not support the runtime 'linux-x64'. Some native libraries from [Microsoft.Win32.Registry.AccessControl/6.0.0] may fail to load on this platform.
The targeted framework does not support the runtime 'linux-x64'. Some native libraries from [Microsoft.PowerShell.Native/7.2.0] may fail to load on this platform.
The targeted framework does not support the runtime 'linux-x64'. Some native libraries from [Microsoft.PowerShell.Native/7.2.0] may fail to load on this platform.
Chose linux-x64, so removing rid (win-x86) specific assets for package Microsoft.PowerShell.Native/7.2.0 and asset type native
Chose linux-x64, so removing rid (win-arm) specific assets for package Microsoft.PowerShell.Native/7.2.0 and asset type native
Chose linux-x64, so removing rid (win-x64) specific assets for package Microsoft.PowerShell.Native/7.2.0 and asset type native
Chose linux-x64, so removing rid (osx) specific assets for package Microsoft.PowerShell.Native/7.2.0 and asset type native

Reproduction Steps

On Alpine 3.15 container with .NET SDK

dotnet tool install --global PowerShell
~/.dotnet/tools/pwsh

Expected behavior

pwsh should execute correctly

Actual behavior

~/.dotnet/tools # ./pwsh
PowerShell 7.2.1
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

One or more errors occurred. (The type initializer for 'System.Management.Automation.TypeAccelerators' threw an exception.)
One or more errors occurred. (The type initializer for 'System.Management.Automation.TypeAccelerators' threw an exception.)
Cannot load PSReadline module. Console is running without PSReadline.
Process terminated. The type initializer for 'System.Management.Automation.PSObject' threw an exception.
at System.Environment.FailFast(System.String, System.Exception)
at Microsoft.PowerShell.UnmanagedPSEntry.Start(System.String[], Int32)
at Microsoft.PowerShell.ManagedPSEntry.Main(System.String[])
System.TypeInitializationException: The type initializer for 'System.Management.Automation.PSObject' threw an exception.
---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Management.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.

Regression?

No response

Known Workarounds

No response

Configuration

.NET SDK 6.0.0
Alpine 3.15

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions