Core: Cannot install .NET Core SDK 2.1 on Fedora 32

Created on 7 May 2020  路  2Comments  路  Source: dotnet/core

Cannot install .NET Core SDK 2.1 on Fedora 21

General

Upgrading from Fedora 31 to 32 dotnet stopped working giving the following error:

[georgi@localhost-home ~]$ dotnet --info
A fatal error occurred, the folder [/usr/lib64/dotnet/host/fxr] does not contain any version-numbered child folders

Package seems to be installed:

[georgi@localhost-home ~]$ rpm -qa | grep dotnet
dotnet-runtime-2.1-2.1.17-1.x86_64
dotnet-hostfxr-2.1-2.1.17-1.x86_64
dotnet-runtime-deps-2.1-2.1.17-1.x86_64
dotnet-sdk-2.1-2.1.805-1.x86_64
dotnet-host-3.1.3-1.fc32.x86_64

dotnet-sdk-3.1 was successfully installed and running indeed:

[georgi@localhost-home ~]$ dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.103
 Commit:    6f74c4a1dd

Runtime Environment:
 OS Name:     fedora
 OS Version:  32
 OS Platform: Linux
 RID:         fedora.32-x64
 Base Path:   /usr/lib64/dotnet/sdk/3.1.103/

Host (useful for support):
  Version: 3.1.3
  Commit:  4a9f85e9f8

.NET Core SDKs installed:
  3.1.103 [/usr/lib64/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.3 [/usr/lib64/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.3 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]

Also tried to remove package and install it again, but that didn't changed anything.

Most helpful comment

I think I know why this happens.

Fedora 32 includes .NET Core 3.1 in the default repositories. You can dnf install dotnet-sdk-3.1 and it will work out of the box.

On Fedora 31, you had installed the .NET Core 2.1 packages, using the Microsoft repository.

When you upgraded, all the .NET Core packages were upgraded. Now you have a mix of packages. the packages with .fc32 are from the Fedora repository. The packages without that are from the Microsoft repository:

dotnet-runtime-2.1-2.1.17-1.x86_64
dotnet-hostfxr-2.1-2.1.17-1.x86_64
dotnet-runtime-deps-2.1-2.1.17-1.x86_64
dotnet-sdk-2.1-2.1.805-1.x86_64
dotnet-host-3.1.3-1.fc32.x86_64

The dotnet-host package, is from the Fedora repository. It is installed at /usr/lib64/dotnet. The other packages are installed at /usr/share/dotnet. Those two installations are, unfortunately, not compatible with each other.

I think you have a couple of options on how to fix this.

  1. If you dont need .NET Core 2.1, you can simply remove the .NET Core 2.1 packages, disable the Microsoft repository and continue.

  2. If you need the .NET Core 2.1 packages, you can remove all .NET Core packages, block the packages from the Fedora repository, then install only the Microsoft packages.

    Add this line

    excludepkgs=dotnet* aspnet* netstandard*
    

    to the end of the [fedora] section in /etc/yum.repos.d/fedora.repo and at the end of the [updates] section in /etc/yum.repos.d/fedora-updates.repo. Then dnf remove '*dotnet*' and dnf install dotnet-sdk-2.1 should leave you with only Microsoft packages.

  3. You can also download and run the .NET Core 2.1 SDK from a tarball: https://dotnet.microsoft.com/download/dotnet-core/thank-you/sdk-2.1.805-linux-x64-binaries. This would leave the existing packages on the system.

  4. Most dangerous: You can download and extract the contents of the tarball into /usr/lib64/dotnet/ as suggested on https://github.com/dotnet/docs/pull/18070#issuecomment-620680909.

All 2 comments

I think I know why this happens.

Fedora 32 includes .NET Core 3.1 in the default repositories. You can dnf install dotnet-sdk-3.1 and it will work out of the box.

On Fedora 31, you had installed the .NET Core 2.1 packages, using the Microsoft repository.

When you upgraded, all the .NET Core packages were upgraded. Now you have a mix of packages. the packages with .fc32 are from the Fedora repository. The packages without that are from the Microsoft repository:

dotnet-runtime-2.1-2.1.17-1.x86_64
dotnet-hostfxr-2.1-2.1.17-1.x86_64
dotnet-runtime-deps-2.1-2.1.17-1.x86_64
dotnet-sdk-2.1-2.1.805-1.x86_64
dotnet-host-3.1.3-1.fc32.x86_64

The dotnet-host package, is from the Fedora repository. It is installed at /usr/lib64/dotnet. The other packages are installed at /usr/share/dotnet. Those two installations are, unfortunately, not compatible with each other.

I think you have a couple of options on how to fix this.

  1. If you dont need .NET Core 2.1, you can simply remove the .NET Core 2.1 packages, disable the Microsoft repository and continue.

  2. If you need the .NET Core 2.1 packages, you can remove all .NET Core packages, block the packages from the Fedora repository, then install only the Microsoft packages.

    Add this line

    excludepkgs=dotnet* aspnet* netstandard*
    

    to the end of the [fedora] section in /etc/yum.repos.d/fedora.repo and at the end of the [updates] section in /etc/yum.repos.d/fedora-updates.repo. Then dnf remove '*dotnet*' and dnf install dotnet-sdk-2.1 should leave you with only Microsoft packages.

  3. You can also download and run the .NET Core 2.1 SDK from a tarball: https://dotnet.microsoft.com/download/dotnet-core/thank-you/sdk-2.1.805-linux-x64-binaries. This would leave the existing packages on the system.

  4. Most dangerous: You can download and extract the contents of the tarball into /usr/lib64/dotnet/ as suggested on https://github.com/dotnet/docs/pull/18070#issuecomment-620680909.

@omajid thanks for the quick reply! As I needed 2.1 for the current project went with option 2 without any problems. Many thanks again :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ugurcemozturk picture ugurcemozturk  路  3Comments

omerlh picture omerlh  路  4Comments

AxxlForce picture AxxlForce  路  3Comments

mmacneil picture mmacneil  路  3Comments

wq807319473 picture wq807319473  路  3Comments