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

Couldn't find a valid ICU package installed on the system? #2186

Closed
olavt opened this issue Dec 26, 2018 · 24 comments
Closed

Couldn't find a valid ICU package installed on the system? #2186

olavt opened this issue Dec 26, 2018 · 24 comments

Comments

@olavt
Copy link

olavt commented Dec 26, 2018

I have been running a .NET Core 2.2 application in a Docker container fine on Raspberry PI 3 (using Raspbian Stretch Lite November 2018) with no problems for several weeks.

But, today when trying to run a newly built container I get:

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.CreateAppDomainManager()
at System.AppDomain.Setup(System.Object)

This is my Dockerfile:

FROM microsoft/dotnet:2.2-runtime-stretch-slim-arm32v7
WORKDIR /app
COPY bin/Debug/netcoreapp2.2/linux-arm/publish .
ENTRYPOINT ["dotnet", "NesoyaController.dll"]

@karelz
Copy link
Member

karelz commented Dec 26, 2018

Looks like this documented problem based on quick internet search: https://github.com/dotnet/core/blob/master/Documentation/build-and-install-rhel6-prerequisites.md#troubleshooting

@karelz karelz closed this as completed Dec 26, 2018
@olavt
Copy link
Author

olavt commented Dec 26, 2018

How can the article you quoted be relevant to running .NET Core 2.2 in a Docker container using the Microsoft provided base image? Shouldn't the Docker image run with all the dependencies included on the Docker host? As I understand the above article is relevant for installing directly on the OS.

@karelz
Copy link
Member

karelz commented Dec 26, 2018

Does the Docket image contain the libraries referenced in the article? Given that Docker images try to be as small as possible (esp. --slim variants - see Docker repo), I wouldn't be surprised if that's the case ...
Either way, I assumed, the docs are enough to point in the right direction. Is that not the case? If not, what is unclear or missing?

@olavt
Copy link
Author

olavt commented Dec 26, 2018

I have been running .NET Core application in Docker images over the past 12 months without this kind of problems. Why should it surface out of the blue?

@olavt
Copy link
Author

olavt commented Dec 27, 2018

The image runs fine one another Raspberry PI 3 (using the OS image and components), so I suspect that something have went wrong with the platform the Docker image runs on.

@karelz
Copy link
Member

karelz commented Dec 27, 2018

I was about to suggest that I can see 4 possible reasons:

  1. Change in OS,
  2. Change in Docker image used,
  3. Change in the app, or
  4. The app took different code path.

Looks like you narrowed it down to option 1.

@andrewwebber
Copy link

I have just experienced this issue when trying to run a self contained dotnet core application on CoreOS Container Linux, without a Docker container.

E.g.

dotnet publish -c Release -o out -r linux-x64
tar -xcvzf out.gz ./out
scp ...
extract ...
run binary

For me this means that self contained publish output still has some dependencies which might need clarification.

@denniske
Copy link

Same issue here. Deployed self contained application into google/cloud-sdk:slim.

@andrewwebber
Copy link

andrewwebber commented Mar 13, 2019

My workaround was to edit the generated runtimeconfig.json after following this documentation
https://github.com/dotnet/core/blob/master/Documentation/build-and-install-rhel6-prerequisites.md

{
    "runtimeOptions": {
        "configProperties": {
            "System.Globalization.Invariant": true
        },
    }
}

@denniske
Copy link

This solved my problem. Instead of modifying the generated runtimeconfig.json, I created a runtimeconfig.template.json in the project folder which is used automatically by dotnet publish to generate the runtimeconfig.json:

{
    "configProperties": {
        "System.Globalization.Invariant": true
    }
}

@WimTenBrink
Copy link

A bit late but I tried my first Linux console application using the Linux subsystem for Windows. Using Debian, Ubuntu and Arch Linux, I discovered that one of these had exactly the same issue! Adding configProperties made it work for all three! Thanks!

@ClientIco
Copy link

ClientIco commented Dec 16, 2019

I can also confirm that the runtimeconfig.template.json when compiling fixes the problem. But it ain't Ideal. I ran unto above mentioned problem while creating my own alpine docker container.

@tmtiwari
Copy link

tmtiwari commented Dec 31, 2019

But it ain't Ideal.

When running on Linux, ICU is used to get the time zone display name. In Invariant Mode, the standard time zone names are returned instead. It appears that CentOS 7 is not including "libicu" as well which is required to run dotnetcore.

@alabrashJr
Copy link

Derviş Kayımbaşıoğlu's solution is also working.

@jabbalaci
Copy link

I had the same issue on Ubuntu 20.04. This trick worked for me:

$ export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1

Tip from here.

AntonioND added a commit to lsds/sgx-lkl that referenced this issue Sep 15, 2020
When trying to run the dotnet sample the following error happened:

```
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.
```

By adding this file, the configuration flag mentioned in the error
message is set to true, and the sample works again. [1]

[1] dotnet/core#2186 (comment)
AntonioND added a commit to lsds/sgx-lkl that referenced this issue Sep 18, 2020
When trying to run the dotnet sample the following error happened:

```
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.
```

By adding this file, the configuration flag mentioned in the error
message is set to true, and the sample works again. [1]

[1] dotnet/core#2186 (comment)
AntonioND added a commit to lsds/sgx-lkl that referenced this issue Sep 23, 2020
When trying to run the dotnet sample the following error happened:

```
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.
```

By adding this file, the configuration flag mentioned in the error
message is set to true, and the sample works again. [1]

[1] dotnet/core#2186 (comment)
@petrsvihlik
Copy link

adding <RuntimeHostConfigurationOption Include="System.Globalization.Invariant" Value="true" /> to the csproj worked for me

@RyanLiu99
Copy link

My .net core 3.1 Console app is doing Console.WriteLine("HI") and gave me this error in a windows container.
Why not set System.Globalization.Invariant": true automatically by default if no setting.

Such a basic thing like Console.WriteLine("") should always work with some defaults if necessary!

@javidsho
Copy link

I had the same problem on alpine and fixed it by installing the icu package:

apk add icu

@mcallaghan-geotab
Copy link

mcallaghan-geotab commented May 18, 2021

It looks like, since Ubuntu 20.04, I see two workarounds:

  1. Couldn't find a valid ICU package installed on the system? #2186 (comment)
export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
  1. Couldn't find a valid ICU package installed on the system? #2186 (comment)
<RuntimeHostConfigurationOption Include="System.Globalization.Invariant" Value="true" />

--
but what is the SOLUTION here? - we can't have users installing .NET core 3.1 on the latest Ubuntu LTS with missing dependencies.

--
is the dotnet sdk missing dependency requirements in the apt package management system?

consider documentation that exists today:

Viir added a commit to pine-vm/pine that referenced this issue Jun 16, 2021
Viir added a commit to pine-vm/pine that referenced this issue Jun 16, 2021
Fix the `ICU package` error discovered in c2f034b

Work around the issue described at dotnet/core#2186 and https://github.com/dotnet/core/issues/5019

Integrate the fix shared by @petrsvihlik at dotnet/core#2186 (comment)
@sayajin101
Copy link

What sorted this error out for me on CentOS 7 was running the following command yum install icu

@toralf
Copy link

toralf commented Jun 20, 2022

export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1

You make my day.
Thx !

This but suddenly occurred at Gentoo Linux after icu update.

@scegg
Copy link

scegg commented Jan 12, 2023

To be noted: with DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1, sqlclient cannot be made.

@ievgennaida
Copy link

ievgennaida commented Jan 3, 2024

Do we have any solution to pack ICU library as a part of the self contained .NET package?

For me setting invariant culture is not an option, while not all libraries support it.

@CantSeeSharp
Copy link

Do we have any solution to pack ICU library as a part of the self contained .NET package?

For me setting invariant culture is not an option, while not all libraries support it.

I was having a similar issue when trying to build my .net 8 project in a Jenkins docker container, what I ended up doing was creating an image and and running the following command

USER root
RUN apt-get update && apt-get install -y libicu-dev && rm -rf /var/lib/apt/lists/* 

You could try it in your Dockerfile?

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

No branches or pull requests