8

I'm currently using the net core 3.1 and want to upgrade it to 5.0. I tried following this guide from Install the .NET SDK or the .NET Runtime on Ubuntu

wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb

sudo apt-get update;
sudo apt-get install -y apt-transport-https &&
sudo apt-get update &&
sudo apt-get install -y dotnet-sdk-5.0

but looks like the dotnet-sdk-5.0 is not found

E: Unable to locate package dotnet-sdk-5.0
E: Couldn't find any package by glob 'dotnet-sdk-5.0'
E: Couldn't find any package by regex 'dotnet-sdk-5.0'

A quick cache dump only returns old versions:

➜  ~ sudo apt-cache dump | grep dotnet-sdk
Package: dotnet-sdk-2.2
Package: dotnet-sdk-3.1

It works just fine for my laptop also running 20.04, but not on this desktop. Weird. Did I miss anything?

tab87vn
  • 203
  • What does uname -m; cat /etc/apt/sources.list.d/microsoft-prod.list return? Did you encounter any error while running sudo apt-get update? – Kulfy Mar 27 '21 at 15:42
  • It was `x86_64

    deb [arch=amd64] https://packages.microsoft.com/ubuntu/19.04/prod disco main # disabled on upgrade to focal`

    From this I could guess that my problem was probably due to the fact that I upgraded to 20.04 from 19.04. So I manually add one for 20.04 by sudo apt-add-repository https://packages.microsoft.com/ubuntu/20.04/prod

    – tab87vn Mar 27 '21 at 21:53

4 Answers4

10

I had the same error on Ubuntu. Running these solved the problem:

wget https://packages.microsoft.com/config/ubuntu/21.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update; \
sudo apt-get install -y apt-transport-https && \
sudo apt-get update && \
sudo apt-get install -y aspnetcore-runtime-5.0
1

So, I was able to, finally, install version 5 by adding the repo for 20.04

sudo apt-add-repository https://packages.microsoft.com/ubuntu/20.04/prod

While the installation successful, there were still some errors

E: The repository 'https://packages.microsoft.com/ubuntu/20.04/prod disco Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
N: Skipping acquisition of configured file 'main/binary-i386/Packages', as repository 'https://packages.microsoft.com/ubuntu/20.04/prod focal InRelease' doesn't support architecture 'i386'
tab87vn
  • 203
0

You may be a case listed under APT troubleshooting, and that is a possible difference between your laptop and desktop.

Try for instance the instructions to Install the .NET SDK or the .NET Runtime with Snap.

It is also useful if you post details on your laptop and desktop (brand, model, etc.)

Related:

  1. https://www.youtube.com/watch?v=XZh2O8IVb7U
0

I had the same problem with Ubuntu Jammy 22.04.

You need to install .Net version 6 in Ubuntu Jammy, because version 5 is not present in the repository:

sudo apt-get install dotnet-sdk-6.0