Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running pwsh fails, not finding a valid ICU package #33

Closed
farzadmf opened this issue Aug 7, 2019 · 22 comments · Fixed by #42
Closed

Running pwsh fails, not finding a valid ICU package #33

farzadmf opened this issue Aug 7, 2019 · 22 comments · Fixed by #42

Comments

@farzadmf
Copy link

farzadmf commented Aug 7, 2019

Hi,

I have installed PowerShell using snap in Manjaro Linux; here's the output of snap --version:

snap     2.40-1
snapd    2.40-1
series   16
manjaro  -
kernel   5.1.21-1-MANJARO

And my PowerShell version (output of snap list powershell):

Name        Version  Rev  Tracking  Publisher              Notes
powershell  6.2.2    36   stable    microsoft-powershell*  classic

And when I run pwsh, I get this error:

FailFast:
Couldn't find a valid ICU package installed on the system. Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support.

   at System.Environment.FailFast(System.String)
   at System.Globalization.GlobalizationMode.GetGlobalizationInvariantMode()
   at System.Globalization.GlobalizationMode..cctor()
   at System.Globalization.CultureData.CreateCultureWithInvariantData()
   at System.Globalization.CultureData.get_Invariant()
   at System.Globalization.CultureInfo..cctor()
   at System.StringComparer..cctor()
   at System.AppDomain.InitializeCompatibilityFlags()
   at System.AppDomain.Setup(System.Object)
[1]    27195 abort (core dumped)  pwsh

I'm not sure what's happening here because I have package [email protected] installed on Manjaro.

There's a discussion on PowerShell/PowerShell#9522, and also I saw from dotnet/core#2186 that apparently you can configure runtimeOptions for a dotnet app to disable globalization,

I think it would be great if we didn't need to force a configuration to disable globalization, but anyway, even if I want to do it, I don't know where I can configure that option for the snap version of PowerShell.

Thank you

@farzadmf farzadmf changed the title PowerShell fails, not finding a valid ICU package Running pwsh fails, not finding a valid ICU package Aug 7, 2019
@jasper-zanjani
Copy link

jasper-zanjani commented Aug 22, 2019

I was about to post a bug report, I am getting the exact same error running on Manjaro as well. But after researching the issue and finding this article, I got PowerShell Core to run by setting an environment variable DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 in bash

@ultraviolet-1986
Copy link

Same on fresh install of Fedora 30. Can run it with export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 ; powershell (thanks @jasper-zanjani) but when ran using just powershell I get the following:

FailFast:
Couldn't find a valid ICU package installed on the system. Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support.

   at System.Globalization.GlobalizationMode.GetGlobalizationInvariantMode()
   at System.Globalization.GlobalizationMode..cctor()
   at System.Globalization.CultureData.CreateCultureWithInvariantData()
   at System.Globalization.CultureData.get_Invariant()
   at System.Globalization.CultureInfo..cctor()
   at System.StringComparer..cctor()
   at System.AppDomain.InitializeCompatibilityFlags()
Aborted (core dumped)

@SteveL-MSFT
Copy link
Member

@TravisEz13 can we include the required ICU pkg as part of the snap pkg?

@TravisEz13
Copy link
Member

The message is a red herring. The ICU package is already included, otherwise the package just won't work.

@phillipsj
Copy link

I can confirm that I am getting the same error running the PowerShell 6.2.3 Snap on Manjaro.

OS: Manjaro 18.1.0
Kernel: x86_64 Linux 5.3.6.1
Shell: bash 5.0.11

TravisEz13 added a commit to TravisEz13/PowerShell-Snap that referenced this issue Oct 15, 2019
@TravisEz13
Copy link
Member

I have a test snap to fix this issue.
https://powershell.visualstudio.com/_apis/resources/Containers/1740216?itemPath=artifacts%2Fpowershell-preview_7.0.0-preview.4_amd64.snap
sudo snap install ~/Downloads/powershell-preview_7.0.0-preview.4_amd64.snap --classic --dangerous

@verchalent
Copy link

Just updated to Ubuntu 19.10 and I am seeing this issue as well with both the PowerShell and PowerShell-Preview snaps.

@TravisEz13 The link you provided throws a not-authorized error for me, so couldn't test.

@TravisEz13
Copy link
Member

I have a build in snap now you can try sudo snap install powershell-preview --classic --edge .

@verchalent
Copy link

@TravisEz13 I removed the existing preview and reinstalled from the edge channell. No longer getting the ICU error, but that has been replaced with an immediate segfault.

From syslog:
kernel: [150075.475178] pwsh[15497]: segfault at 0 ip 0000000000000000 sp 00007ffea3d18f48 error 14 in pwsh[3ff000+1000]

kernel: [150425.945008] Code: Bad RIP value.

@TravisEz13
Copy link
Member

I've published a new snap (I don't think it will fix your issue), can you update to that sudo snap refresh powershell-preview --classic --channel=edge/fixpreviewsnap

Can you run ulimit -c unlimited before running and them post the core dump. You can message me on twitter (TravisPlunk) if you prefer to email it. Make sure to post which revision of the snap was used to generate the core dump.

@TravisEz13
Copy link
Member

The latest revision fixed 16.04 and 18.04. Can you test it again using sudo snap refresh powershell-preview --classic --channel=edge/fixpreviewsnap?

I'm going to release this as it addresses a bigger issue.

@verchalent
Copy link

@TravisEz13 I captured dumps from the prior test and pinged you on Twitter. With the prior fix (45 min ago) I was still getting core dumps.
With the latest fix, I am back to the ICU error.

@sguertin
Copy link

Hi, I'm running ubuntu 19.10 and even with your latest update provided I get the following if I don't set the environment variable before launching:
rocess terminated. Couldn't find a valid ICU package installed on the system. Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support.
at System.Environment.FailFast(System.String)
at System.Globalization.GlobalizationMode.GetGlobalizationInvariantMode()
at System.Globalization.GlobalizationMode..cctor()
at System.Globalization.CultureData.CreateCultureWithInvariantData()
at System.Globalization.CultureData.get_Invariant()
at System.Globalization.CultureInfo..cctor()
at System.Globalization.CultureInfo.get_CurrentUICulture()
at Microsoft.PowerShell.NativeCultureResolver.get_UICulture()
at Microsoft.PowerShell.UnmanagedPSEntry.Start(System.String, System.String[], Int32)
at Microsoft.PowerShell.ManagedPSEntry.Main(System.String[])
Aborted (core dumped)

@TravisEz13
Copy link
Member

Okay, I think I have a fix for this sudo snap refresh powershell-preview --classic --channel=edge/fixlibicu

@verchalent
Copy link

Working on Ubuntu 19.10 after that patch. You just made my day!

@jonstelly
Copy link

jonstelly commented Oct 31, 2019

I was about to post a bug report, I am getting the exact same error running on Manjaro as well. But after researching the issue and finding this article, I got PowerShell Core to run by setting an environment variable DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 in bash

I didn't want to switch to the preview just yet so I tried this and it fixed it for me on Ubuntu 19.10. This is the end of my .bashrc (starts pwsh inside tmux)

export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1

if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then
  exec tmux
else
  pwsh -i
  exit
fi

@TravisEz13
Copy link
Member

@jonstelly The changes to fix this were pretty big. I don't want to back port them at this point.

@jonstelly
Copy link

Not a problem, I just wanted to add a bit of detail for the workaround for folks on 19.10 that couldn't move to the powershell preview yet. Thanks for getting it fixed for 7, I'm looking forward to trying out 7 soon.

@TravisEz13
Copy link
Member

Some things regressed in the stable image when I was working on this. I back ported the safe changes. I tested it on 19.10 and it works for me:
sudo snap install powershell --channel=edge/Fixstable --classic

@agnutzmann
Copy link

Okay, I think I have a fix for this sudo snap refresh powershell-preview --classic --channel=edge/fixlibicu

Thanks, worked for me. I just changed to install instead refresh:
sudo snap install powershell-preview --classic --channel=edge/fixlibicu

@TravisEz13
Copy link
Member

@agnutzmann Yeah, depends on your initial state.

@TravisEz13
Copy link
Member

I released the fix for the powershell package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
10 participants