Repository navigation
Closed
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
Similar issue to #16532. Build and run the following Dockerfile:
FROM alpine:3.19
ENV \
# Enable detection of running in a container
DOTNET_RUNNING_IN_CONTAINER=true \
# Set the invariant mode since ICU package isn't included (see https://github.com/dotnet/announcements/issues/20)
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true
RUN apk add --upgrade --no-cache \
ca-certificates \
\
# .NET dependencies
krb5-libs \
libgcc \
libintl \
libssl3 \
libstdc++ \
zlib
# Install .NET SDK
RUN wget -O dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/6.0.417/dotnet-sdk-6.0.417-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 --version 7.2.17
ENTRYPOINT [ "/root/.dotnet/tools/pwsh" ]
Expected behavior
PowerShell starts and runsActual behavior
PowerShell 7.2.17
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)Error details
No response
Environment data
Cannot get $PSVersionTable because PowerShell is not functional.Visuals
No response
Reacted by Bruno Juchli
Metadata
Metadata
Assignees
Labels
No labels
Activity
lbussell commentedon Dec 18, 2023
/cc Aditya Patwardhan (@adityapatwardhan)
Given the issue in the past was apparently the .NET RID not being available yet, I went ahead and filed some issues for that:
lbussell commentedon Jan 9, 2024
rhubarb-geek-nz I appreciate your investigation, but we aren't interested in using the Alpine-built .NET SDK or PowerShell for the official .NET container images. Your findings could be useful for someone who is interested in just getting things working though.
/cc Aditya Patwardhan (@adityapatwardhan), according to the issues I filed (dotnet/core#9013, dotnet/runtime#96155) adding the RID to .NET isn't the fix since RIDs are all portable now. I'm not sure how that affects this issue, but can you take a look? This issue will block moving .NET SDK's floating tags to Alpine 3.19 since excluding PowerShell from Alpine x64 is a regression in functionality.
lbussell commentedon Jan 29, 2024
Aditya Patwardhan (@adityapatwardhan) Any update on this issue investigation?
lbussell commentedon Feb 13, 2024
I confirmed that this is still an issue with PowerShell v7.2.18.
lbussell commentedon Mar 6, 2024
I was looking at this again today and I found that adding the environment variable
DOTNET_RUNTIME_ID=linux-musl-x64allows PowerShell to start using a .NET 6 runtime!alpine-x64andalpine.3.18-x64also work.However there is a strange issue with the interactive terminal, it repeats all of the characters you type, as you type. For example, if I typed
hello, the terminal would show:PS /> hhehelhellhello. The extra text does not have an effect on command output - if I typedotnet --list-runtimesand press enter, no matter what shows in the terminal, I will get the correct output. This is using .NET 6.0.27, Alpine 3.19, and PowerShell 7.2.18.lbussell commentedon Apr 25, 2024
This should be checked again since dotnet/runtime#96155 is complete.
lbussell commentedon May 14, 2024
Confirmed this is fixed now.
microsoft-github-policy-service commentedon May 14, 2024
📣 Hey Logan Bussell (@lbussell), how did we do? We would love to hear your feedback with the link below! 🗣️
🔗 https://aka.ms/PSRepoFeedback