RealOrko
RealOrko

Reputation: 31

Cannot install .NET Core 3.1 using Fedora 31

I followed the documentation for installing .NET Core 3.1 using Fedora 31 with the following link: https://learn.microsoft.com/en-us/dotnet/core/install/linux-package-manager-fedora30

The commands I ran was:

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo wget -q -O /etc/yum.repos.d/microsoft-prod.repo https://packages.microsoft.com/config/fedora/30/prod.repo

Followed by:

sudo dnf install dotnet-sdk-3.1

It keeps reporting the package as not found. See terminal output:

Last metadata expiration check: 1:14:48 ago on Thu 05 Dec 2019 15:44:56 GMT.
No match for argument: dotnet-sdk-3.1
Error: Unable to find a match: dotnet-sdk-3.1

Are the docs wrong?

Upvotes: 2

Views: 2725

Answers (6)

Stefan_9461
Stefan_9461

Reputation: 1

The problem caused by the location where the SDK is installed. When you run the command: dnf rq -l dotnet-sdk-3.1 It states that the sdk is installed under /usr/share/dotnet/ and not under /usr/lib64/dotnet/ the location where the actual executable is installed.

When you inspect the location you find that more is installed there, like they want to move the location of the software but did half a job. So what I did ... moved everything to /usr/lib64/dotnet/ and then replaced the folder /usr/share/dotnet with a link to /usr/lib64/dotnet.

Upvotes: 0

Hjelmen
Hjelmen

Reputation: 91

I tried installing dotnet-sdk-3.1 on Fedora 32 without having dotnet installed before. But, I was not able to make it work with dnf, I always got:

It was not possible to find any installed .NET Core SDKs.

The solution for me was to download the Linux x64 Binaries from https://dotnet.microsoft.com/download/dotnet-core, unzip the tar.gz to a directory, and add the directory to the path.

Upvotes: 0

Alexandru Năstase
Alexandru Năstase

Reputation: 31

Since Fedora 32 the dotnet SDK repository comes build-in :

What worked for me was :

  1. Remove old repository from package manager
sudo rm -rf /etc/yum.repos.d/microsoft-prod.repo
  1. Clean dnf cache
sudo dnf clean all
  1. Remove all dotnet packages
sudo dnf remove dotnet*

Hint: If you're using fish or zsh as your regular shell run the command in bash

  1. And reinstall the SDK :
sudo dnf install dotnet-sdk-3.1

Upvotes: 3

mruether
mruether

Reputation: 1

After upgrading my system from Fedora 31 to Fedora 32 my dotnet command was broken with the error message.

It was not possible to find any installed .NET Core SDKs

The dotnet core package was installed before the upgrade itself with the method descibed in the question.

After inspecting what dotnet packages I had on my system with

sudo dnf list installed 'dotnet*'

the list showed SDKs 2.1, 2.2 and 3.1 as well.

To solve this, I tried to remove the dotnet-sdk-3.1 via

sudo dnf remove dotnet-sdk-3.1

and cleaned dnf caches with

sudo dnf clean all

but after a re-installation the problem persisted.

My solution was to remove all dotnet packages that were listed with the dnf command from above.

After that, I ran

sudo dnf install dotnet-sdk-3.1

And the problem was fixed.

Upvotes: 0

RealOrko
RealOrko

Reputation: 31

This tends to happen on a system that has been upgraded from fedora 30 to 31 and has had a version of dotnet core previously installed.

I went nuclear and deleted all my dotnet shared folders(warning! you will lose all dotnet references):

sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/bin/dotnet
sudo rm -rf /etc/yum.repos.d/microsoft-prod.repo
sudo wget -q -O /etc/yum.repos.d/microsoft-prod.repo https://packages.microsoft.com/config/fedora/30/prod.repo

I then found https://unix.stackexchange.com/questions/505625/fedora-29-repo-issue.

Then ran the following:

sudo dnf clean all
sudo dnf upgrade

After this I tried the install again and it worked:

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo wget -q -O /etc/yum.repos.d/microsoft-prod.repo https://packages.microsoft.com/config/fedora/30/prod.repo
sudo dnf install dotnet-sdk-3.1

I am not clear on why this worked. Will teach me for treating my fedora system as a pet! :)

Upvotes: 1

Clemente Carlucci
Clemente Carlucci

Reputation: 11

have you typed sudo dnf update before? I just installed in Fedora 31 and gone well.

Upvotes: 1

Related Questions