diff --git a/docs/core/install/linux-centos.md b/docs/core/install/linux-centos.md index bc4182dd31fd1..afdefacbaa8ee 100644 --- a/docs/core/install/linux-centos.md +++ b/docs/core/install/linux-centos.md @@ -71,6 +71,10 @@ This section provides information on common errors you may get while using the p [!INCLUDE [package-manager-failed-to-fetch-rpm](includes/package-manager-failed-to-fetch-rpm.md)] +### Errors about missing `fxr`, `libhostfxr.so` or `FrameworkList.xml` + +See how to [Troubleshoot Package Mixups](linux-package-mixup.md) + ## Dependencies [!INCLUDE [linux-rpm-install-dependencies](includes/linux-rpm-install-dependencies.md)] diff --git a/docs/core/install/linux-fedora.md b/docs/core/install/linux-fedora.md index 0842449a9e4ec..abcac71aad5ab 100644 --- a/docs/core/install/linux-fedora.md +++ b/docs/core/install/linux-fedora.md @@ -102,6 +102,10 @@ For more information on installing .NET without a package manager, see one of th [!INCLUDE [package-manager-failed-to-fetch-rpm](includes/package-manager-failed-to-fetch-rpm.md)] +### Errors about missing `fxr`, `libhostfxr.so` or `FrameworkList.xml` + +See how to [Troubleshoot Package Mixups](linux-package-mixup.md) + ## Next steps - [How to enable TAB completion for the .NET CLI](../tools/enable-tab-autocomplete.md) diff --git a/docs/core/install/linux-package-mixup.md b/docs/core/install/linux-package-mixup.md new file mode 100644 index 0000000000000..bfbf36ec9f89b --- /dev/null +++ b/docs/core/install/linux-package-mixup.md @@ -0,0 +1,99 @@ +--- +title: Troubleshoot Package Mixup +description: Learn about how to troubleshoot strange .NET packae errors on Linux. +author: omajid +ms.date: 05/12/2021 +--- + +# Troubleshoot `fxr`, `libhostfxr.so` or `FrameworkList.xml` errors + +Users trying to use .NET and .NET Core may run into .NET commands (`dotnet new`, `dotnet build`, `dotnet run`) failing. The exact error messages can vary. Some example error messages: + +- [SDK #12075](https://github.com/dotnet/sdk/issues/12075), [SDK #15785](https://github.com/dotnet/sdk/issues/15785), [SDK #15863](https://github.com/dotnet/sdk/issues/15863) and [SDK #17411](https://github.com/dotnet/sdk/issues/17411): + + ``` + System.IO.FileNotFoundException: Could not find file '/usr/share/dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0/data/FrameworkList.xml'.` + ``` + +- [SDK #17570](https://github.com/dotnet/sdk/issues/17570): + + ``` + A fatal error occurred. The required library libhostfxr.so could not be found. + ``` + +- [Core #5746](https://github.com/dotnet/core/issues/5746) and [SDK #15476](https://github.com/dotnet/sdk/issues/15476): + + ``` + A fatal error occurred. The folder [/usr/share/dotnet/host/fxr] does not exist + ``` + +- [Installer #9254](https://github.com/dotnet/installer/issues/9254) and [StackOverflow](https://stackoverflow.com/questions/65422998/): + + ``` + A fatal error occurred, the folder [/usr/share/dotnet/host/fxr] does not contain any version-numbered child folders + ``` + +And some symptoms without clear error messages: + +- [Core #4605](https://github.com/dotnet/core/issues/4605), [Core #4644](https://github.com/dotnet/core/issues/4655) and [Runtime #49375](https://github.com/dotnet/runtime/issues/49375): + + SDK is installed, but `dotnet` complains it isn't. + +Another common symptom of this problem is that you have both `/usr/lib64/dotnet` and `/usr/share/dotnet` on your machine. + +## What's going on? + +This generally happens when two Linux package repositories provide .NET packages. Often .NET packages are provided by the Linux distribution (eg, Arch, CentOS, Fedora, RHEL), in addition to Microsoft. + +Mixing .NET packages from two different sources will most likely lead to issues since they packages may place things at different paths, and may be compiled differently. + +## Some fixes + +The fix is to use .NET from one package repository only. Which repository to pick and how to do it varies by use-case and the Linux distribution. + +The first fix is probably the simplest (and best in the very long term) but there are some known issues that may lead to better outcomes for the user right now if they pick another option. + +**Use case 1**: I only want to install/use .NET. I dont want to use any other packages - such as `mdatp`, `powershell` and `mssql` - from the Microsoft repository. + +In this case, remove the Microsoft repository, the .NET packages and then re-install the .NET packages from the Linux distribution repository. + +For Fedora, CentOS >= 8, and RHEL >=8: + +```bash +sudo dnf remove package-microsoft-prod +sudo dnf remove 'dotnet*' 'aspnet*' 'netstandard*' +sudo dnf install dotnet-sdk-5.0 +``` + +**Use case 2**: I want to install and use .NET but also need other packages from Microsoft's repository, such as `mdatp`, `powershell` or `mssql`. + +In this case, keep the Microsoft repository, but configure it so that it doesn't provide any the .NET packages, remove the already-installed .NET packages and then re-install the .NET packages from the Linux distribution repository. + +For Fedora, CentOS >= 8, and RHEL >=8: + +```bash +echo 'excludepkgs=dotnet*,aspnet*,netstandard*' | sudo tee -a /etc/yum.repos.d/microsoft-prod.repo +sudo dnf remove 'dotnet*' 'aspnet*' 'netstandard*' +sudo dnf install dotnet-sdk-5.0 +``` + +**Use case 3**: I need a recent version of .NET that's not available if I go with option 1 or 2. + +In this case, keep the Microsoft repository, and configure it so .NET packages from the Microsoft repository are considered a higher priority. Then remove the already-installed .NET packages and then re-install the .NET packages from the Microsoft repository. + +For Fedora, CentOS >= 8, and RHEL >=8: + +```bash +echo 'priority=50' | sudo tee -a /etc/yum.repos.d/microsoft-prod.repo +sudo dnf remove 'dotnet*' 'aspnet*' 'netstandard*' +sudo dnf install dotnet-sdk-5.0 +``` + +**Use case 4** I dont care about the vendor of .NET but the version of .NET from the Linux distribution has bugs that are showstoppers for me and those bugs are fixed in the Microsoft packages. + +Follow the same steps as Use case 3. + +## Next steps + +- [Tutorial: Create a new app with Visual Studio Code](../tutorials/with-visual-studio-code.md). +- [Tutorial: Containerize a .NET app](../docker/build-container.md). diff --git a/docs/core/install/linux-rhel.md b/docs/core/install/linux-rhel.md index d378c84b562e4..71ef29b87c5d8 100644 --- a/docs/core/install/linux-rhel.md +++ b/docs/core/install/linux-rhel.md @@ -139,6 +139,14 @@ As an alternative to the ASP.NET Core Runtime, you can install the .NET Core Run Consult the [Red Hat documentation for .NET](https://access.redhat.com/documentation/net/5.0/) on the steps required to install other releases of .NET. +## Troubleshoot the package manager + +This section provides information on common errors you may get while using the package manager to install .NET or .NET Core. + +### Errors about missing `fxr`, `libhostfxr.so` or `FrameworkList.xml` + +See how to [Troubleshoot Package Mixups](linux-package-mixup.md) + ## Next steps - [How to enable TAB completion for the .NET CLI](../tools/enable-tab-autocomplete.md)