Repository navigation
Closed
Labels
Issue-BugIssue has been identified as a bug in the productResolution-ExternalThe issue is caused by external component(s).WG-Maintainers-Buildspecific to affecting the build
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
I've installed PowerShell as a global tool with .NET 6 in an Alpine 3.15 container. When attempting to run pwsh, it results in the following error:
PowerShell 7.2.0
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.
File name: 'Microsoft.Management.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
--- End of inner exception stack trace ---
at System.Management.Automation.PSObject.get_Properties()
at System.Management.Automation.HostUtilities.GetDollarProfile(String allUsersAllHosts, String allUsersCurrentHost, String currentUserAllHosts, String currentUserCurrentHost)
at Microsoft.PowerShell.ConsoleHost.DoRunspaceInitialization(Boolean skipProfiles, String initialCommand, String configurationName, Collection`1 initialCommandArgs)
at Microsoft.PowerShell.ConsoleHost.DoCreateRunspace(String initialCommand, Boolean skipProfiles, Boolean staMode, String configurationName, Collection`1 initialCommandArgs)
at Microsoft.PowerShell.ConsoleHost.CreateRunspace(Object runspaceCreationArgs)
at Microsoft.PowerShell.ConsoleHost.DoRunspaceLoop(String initialCommand, Boolean skipProfiles, Collection`1 initialCommandArgs, Boolean staMode, String configurationName)
at Microsoft.PowerShell.ConsoleHost.Run(CommandLineParameterParser cpp, Boolean isPrestartWarned)
at Microsoft.PowerShell.ConsoleHost.Start(String bannerText, String helpText)
at Microsoft.PowerShell.UnmanagedPSEntry.Start(String[] args, Int32 argc)
Repro Steps:
- Build the following Dockerfile (e.g.
docker build -t test .):
FROM alpine:3.15
RUN apk add --no-cache \
ca-certificates \
\
# .NET dependencies
icu-libs \
krb5-libs \
libgcc \
libintl \
libssl1.1 \
libstdc++ \
zlib
# Install .NET SDK
RUN wget -O dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/6.0.100/dotnet-sdk-6.0.100-linux-musl-x64.tar.gz \
&& mkdir -p /usr/share/dotnet \
&& tar -C /usr/share/dotnet -oxzf dotnet.tar.gz \
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
# Install PowerShell
RUN dotnet tool install --global PowerShell
ENTRYPOINT [ "/root/.dotnet/tools/pwsh" ]- Run the container (e.g.
docker run --rm test)
Expected behavior
A successful execution into the shell of PowerShellActual behavior
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.
File name: 'Microsoft.Management.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
--- End of inner exception stack trace ---
at System.Management.Automation.PSObject.get_Properties()
at System.Management.Automation.HostUtilities.GetDollarProfile(String allUsersAllHosts, String allUsersCurrentHost, String currentUserAllHosts, String currentUserCurrentHost)
at Microsoft.PowerShell.ConsoleHost.DoRunspaceInitialization(Boolean skipProfiles, String initialCommand, String configurationName, Collection`1 initialCommandArgs)
at Microsoft.PowerShell.ConsoleHost.DoCreateRunspace(String initialCommand, Boolean skipProfiles, Boolean staMode, String configurationName, Collection`1 initialCommandArgs)
at Microsoft.PowerShell.ConsoleHost.CreateRunspace(Object runspaceCreationArgs)
at Microsoft.PowerShell.ConsoleHost.DoRunspaceLoop(String initialCommand, Boolean skipProfiles, Collection`1 initialCommandArgs, Boolean staMode, String configurationName)
at Microsoft.PowerShell.ConsoleHost.Run(CommandLineParameterParser cpp, Boolean isPrestartWarned)
at Microsoft.PowerShell.ConsoleHost.Start(String bannerText, String helpText)
at Microsoft.PowerShell.UnmanagedPSEntry.Start(String[] args, Int32 argc)
### Error details
_No response_
### Environment data
```powershell
Unable to get this data since PowerShell can't be run.
Visuals
No response
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productResolution-ExternalThe issue is caused by external component(s).WG-Maintainers-Buildspecific to affecting the build
Activity
iSazonov commentedon Nov 30, 2021
/cc Aditya Patwardhan (@adityapatwardhan) for information.
mthalman commentedon Dec 1, 2021
Just to clarify the conditions for this issue:
adityapatwardhan commentedon Dec 1, 2021
We have not explicitly tested on Alpine 3.15 yet. I will have a look.
mthalman commentedon Dec 15, 2021
Aditya Patwardhan (@adityapatwardhan) - I've verified that this still doesn't work when using PowerShell 7.2.1/.NET SDK 6.0.101.
adityapatwardhan commentedon Dec 15, 2021
Let me have a look, it seemed to work in my testing. I might have missed something.
mikeTWC1984 commentedon Dec 16, 2021
I was installing pwsh7.2 (without sdk) on alpine3.15, using official instructions:
https://docs.microsoft.com/en-us/powershell/scripting/install/install-alpine?view=powershell-7.2
I have no any issue so far. Matt Thalman (@mthalman) - try to add all packages from this guide.
As a side note - I'm looking forward to see official ps7.2 image for alpine 3.15
mthalman commentedon Dec 16, 2021
So you're installing directly from the tarball? Yes, that works. What doesn't work is installing as a global tool from the .NET SDK. The PowerShell deployment types are different between the two. The tarball contains a self-contained deployment of PowerShell while installing as a global tool is a framework-dependent deployment.
mthalman commentedon Jan 12, 2022
Aditya Patwardhan (@adityapatwardhan) - We'd like to be able to ship .NET official container images for Alpine 3.15 for the February servicing release. But that depends on this being fixed. Is there enough time to get this addressed by then?
heapifyman commentedon Jan 12, 2022
I get the same error message as Matt Thalman (@mthalman) on Manjaro Linux when installing pwsh as a global dotnet tool.
Steps to reproduce
dotnet tool install --global powershellpwshResult
adityapatwardhan commentedon Jan 18, 2022
The loading issue is related to .NET 6 missing RID for Alpine 3.15. Issue tracking it: dotnet/runtime#62938
the change needs to go back to .NET 6.
heapifyman commentedon Jan 19, 2022
Aditya Patwardhan (@adityapatwardhan) I'm not using alpine but manjaro, and still get the same error. How does dotnet/runtime#62938 help me then?
Should I open a separate issue?
adityapatwardhan commentedon Jan 19, 2022
Could be related. What specific version of manjaro do you see a problem with.
heapifyman commentedon Jan 19, 2022
That would be the current Manjaro Gnome edition - as a rolling release there's no real version number.
See also my previous comment
jonstelly commentedon Mar 4, 2022
I'm getting the same error on Manjaro KDE. Notes:
dotnet tool install of pwsh (7.2.1) = the above error
aur powershell building from source (7.2.1) = failed test about base64 encoding
aur powershell-bin (7.2.1-2) = pwsh works as expected