sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Installed .NET 6.0 SDKs not showing with dotnet --info or dotnet --list-sdks and commands depeding on SDK fail (Linux/Ubuntu)

Open cspwizard opened this issue 1 year ago • 10 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the bug

[Ubuntu] After upgrade to latest dotnet sdk stopped working. Clean reinstall of latest version doesn't help.

dotnet-sdk-6.0/jammy,now 6.0.400-1 amd64 [installed]

dotnet --info output:

global.json file:
  Not found

Host:
  Version:      6.0.8
  Architecture: x64
  Commit:       55fb7ef977

.NET SDKs installed:
  No SDKs were found.

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.8 [/usr/lib/dotnet/dotnet6-6.0.108/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.8 [/usr/lib/dotnet/dotnet6-6.0.108/shared/Microsoft.NETCore.App]

Download .NET:
  https://aka.ms/dotnet-download

Learn about .NET Runtimes and SDKs:
  https://aka.ms/dotnet/runtimes-sdk-info

dotnet tools list

  * You intended to execute a .NET application:
      The application 'tools' does not exist.
  * You intended to execute a .NET SDK command:
      No .NET SDKs were found.

Download a .NET SDK:
https://aka.ms/dotnet-download

Learn about SDK resolution:
https://aka.ms/dotnet/sdk-not-found

Expected Behavior

dotnet SDK expected to be working after install or upgrade

Steps To Reproduce

Installed according to instruction for the ubuntu 22.04: https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#2204

Exceptions (if any)

No response

.NET Version

The command could not be loaded, possibly because: * You intended to execute a .NET application: The application '--version' does not exist. * You intended to execute a .NET SDK command: No .NET SDKs were found. Download a .NET SDK: https://aka.ms/dotnet-download Learn about SDK resolution: https://aka.ms/dotnet/sdk-not-found

Anything else?

dotnet-sdk-6.0/jammy,now 6.0.400-1 amd64 [installed]

cspwizard avatar Aug 12 '22 10:08 cspwizard

I've had the same issues as well ever since I updated my .NET SDK to the latest version. I'm on Pop!_OS 22.04 (based on Ubuntu 22.04).

ghost avatar Aug 12 '22 11:08 ghost

Hello folks, please check https://github.com/dotnet/core/issues/7699 for more details about this.

baronfel avatar Aug 12 '22 13:08 baronfel

Tried the steps but to no avail. Ubuntu 22.04

$ dn --info

global.json file:
  Not found

Host:
  Version:      6.0.8
  Architecture: x64
  Commit:       55fb7ef977

.NET SDKs installed:
  No SDKs were found.

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.8 [/usr/lib/dotnet/dotnet6-6.0.108/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.8 [/usr/lib/dotnet/dotnet6-6.0.108/shared/Microsoft.NETCore.App]

Download .NET:
  https://aka.ms/dotnet-download

Learn about .NET Runtimes and SDKs:
  https://aka.ms/dotnet/runtimes-sdk-info

khteh avatar Aug 13 '22 04:08 khteh

Same here


global.json file:
  Not found

Host:
  Version:      6.0.8
  Architecture: x64
  Commit:       55fb7ef977

.NET SDKs installed:
  No SDKs were found.

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.8 [/usr/lib/dotnet/dotnet6-6.0.108/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.8 [/usr/lib/dotnet/dotnet6-6.0.108/shared/Microsoft.NETCore.App]

Download .NET:
  https://aka.ms/dotnet-download

Learn about .NET Runtimes and SDKs:
  https://aka.ms/dotnet/runtimes-sdk-info```

owenholloway avatar Aug 13 '22 04:08 owenholloway

hello folks, after I had updated, the issue appeared to me too. dotnet worked but when I tried to execute with build arg or other few except --verion it showed me the error. what helped me, open link provided by baronfel, and do two steps: 'Use .NET 6 Package via PMC' and 'Scenario 1: Use native Jammy packages after installing a previous .NET release from PMC'

wizzardcl avatar Aug 13 '22 17:08 wizzardcl

Same issue here. Ubuntu 22.04.

$ dotnet --info

global.json file:
  Not found

Host:
  Version:      6.0.8
  Architecture: x64
  Commit:       55fb7ef977

.NET SDKs installed:
  No SDKs were found.

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.8 [/usr/lib/dotnet/dotnet6-6.0.108/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.8 [/usr/lib/dotnet/dotnet6-6.0.108/shared/Microsoft.NETCore.App]

Download .NET:
  https://aka.ms/dotnet-download

Learn about .NET Runtimes and SDKs:
  https://aka.ms/dotnet/runtimes-sdk-info

apt purge with a reinstall does not fix the issue.

Edit: I am using the dotnet-sdk-6.0 package, version 6.0.400-1, from the official Microsoft Debian repository:

$ cat /etc/apt/sources.list.d/microsoft-prod.list 
deb [arch=amd64,arm64,armhf] https://packages.microsoft.com/ubuntu/22.04/prod jammy main

It was working fine until I updated yesterday. I think I was on 6.0.300 before.

jroeber avatar Aug 13 '22 18:08 jroeber

I updated the document to make it clear when you are intended to use of the "scenarios".

https://github.com/dotnet/core/issues/7699

richlander avatar Aug 13 '22 18:08 richlander

Thanks, Rich! I followed the instructions in "Mixed state scenario 1" and am back up and running. It's nice to be able to install the SDK without an extra sources entry now.

jroeber avatar Aug 13 '22 18:08 jroeber

For sure. I'm glad the instructions helped.

install the SDK without an extra sources

Indeed. This is the plan going forward.

richlander avatar Aug 13 '22 19:08 richlander

Why is there this sudden change of installation steps? Is this going to be the one used moving forward?

khteh avatar Aug 14 '22 00:08 khteh

I'm seeing this too

olfek avatar Aug 14 '22 11:08 olfek

I have a fix !

  1. Run sudo apt remove --purge --autoremove *dotnet*

  2. create or modify /etc/apt/preferences and add (you'll need sudo)

    Package: *net*
    Pin: origin packages.microsoft.com
    Pin-Priority: 1001
    

    Run man apt_preferences for more info about this config.

  3. Run sudo apt install dotnet-sdk-6.0

  4. Enjoy !


Output of cat /etc/*release:

DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=21
DISTRIB_CODENAME=vanessa
DISTRIB_DESCRIPTION="Linux Mint 21 Vanessa"
NAME="Linux Mint"
VERSION="21 (Vanessa)"
ID=linuxmint
ID_LIKE="ubuntu debian"
PRETTY_NAME="Linux Mint 21"
VERSION_ID="21"
HOME_URL="https://www.linuxmint.com/"
SUPPORT_URL="https://forums.linuxmint.com/"
BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/"
PRIVACY_POLICY_URL="https://www.linuxmint.com/"
VERSION_CODENAME=vanessa
UBUNTU_CODENAME=jammy

olfek avatar Aug 14 '22 12:08 olfek

@olfek Great, this fix solved my issue. Thanks!

pietervdheijden avatar Aug 18 '22 08:08 pietervdheijden

@pietervdheijden Did you need to quote the whole post? A reaction would have been enough :P

olfek avatar Aug 18 '22 11:08 olfek

My bad... I updated the comment!

pietervdheijden avatar Aug 19 '22 04:08 pietervdheijden

@olfek great! It works for me! Thanx!!!

ferneyvanegas avatar Aug 19 '22 21:08 ferneyvanegas

Thanks @olfek. This works for me as well. :-)

Johnny-Tommy avatar Aug 22 '22 16:08 Johnny-Tommy

How is this not a breaking change? A minor version update shouldn't nuke a previously functioning installation! This breaks local dev, but it probably breaks a bunch of CI pipelines etc.

EDIT: https://github.com/dotnet/sdk/issues/27129#issuecomment-1214358108 is the correct fix at the moment.

Following the steps here: https://github.com/dotnet/core/issues/7699 will leave you with an outdated SDK and stuck with an old dependency of libunwind which can prevent other software installation / cause dependency conflicts.

seanamos avatar Aug 29 '22 09:08 seanamos

This breaks my dev env on Linux machine. Rider just suddenly not working anymore. Although I fixed it temperarily by https://github.com/dotnet/sdk/issues/27129#issuecomment-1214358108 (Thanks!) It's a very bad issue.

jinweijie avatar Sep 11 '22 03:09 jinweijie

Fix worked for me on the second attempt. Rider also broke for me.

0xStuart avatar Dec 11 '22 19:12 0xStuart

I encountered this problem after installing .net7 on ubuntu 22.04. I also needed the .net6 SDK and runtimes which were already installed, but after the .net7 installation, they did not show up.

.NET SDKs installed:
  7.0.101 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 7.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

a couple of uninstall/purge/clean/remove steps yielded the same result; thus, for a quick workaround, I basically moved .net6 related directories from /usr/lib/dotnet to /usr/share/dotnet, which the latter path is configured to work with dotnet cli.

after moving .net6 SDK and runtime folders under /usr/share/dotnet; they started to list, and no issues with build & run

.NET SDKs installed:
  6.0.404 [/usr/share/dotnet/sdk]
  7.0.101 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.11 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.11 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

ozgend avatar Dec 29 '22 14:12 ozgend

can anybody pls tell me how to ''add'' something to /etc/preferences ???

Mansour-Hz avatar Feb 02 '23 13:02 Mansour-Hz

There is more detail here: https://github.com/dotnet/core/issues/7699

richlander avatar Feb 02 '23 21:02 richlander

can anybody pls tell me how to ''add'' something to /etc/preferences ???

cd /etc ls -> if preferences (not preferences.d) is available skip next step sudo touch preferences sudo gedit preferences paste fix and save

HossamElwahsh avatar Feb 16 '23 20:02 HossamElwahsh

Don't use /etc/apt/preferences. Create a new file in /etc/apt/preferences.d instead!

sudo nano /etc/apt/preferences.d/dotnet

With content:

Package: dotnet*
Pin: origin packages.microsoft.com
Pin-Priority: 1001

and

sudo nano /etc/apt/preferences.d/aspnet

With content:

Package: aspnet*
Pin: origin packages.microsoft.com
Pin-Priority: 1001

EDIT: Or more easy with heredoc:

sudo sh -c "cat > /etc/apt/preferences.d/dotnet <<'EOF'
Package: dotnet*
Pin: origin packages.microsoft.com
Pin-Priority: 1001
EOF"
sudo sh -c "cat > /etc/apt/preferences.d/aspnet <<'EOF'
Package: aspnet*
Pin: origin packages.microsoft.com
Pin-Priority: 1001
EOF"

kitingChris avatar Feb 17 '23 14:02 kitingChris

I have a fix !

  1. Run sudo apt remove --purge --autoremove *dotnet*

  2. create or modify /etc/apt/preferences and add (you'll need sudo)

    Package: *net*
    Pin: origin packages.microsoft.com
    Pin-Priority: 1001
    

    Run man apt_preferences for more info about this config.

  3. Run sudo apt install dotnet-sdk-6.0

  4. Enjoy !

Output of cat /etc/*release:

DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=21
DISTRIB_CODENAME=vanessa
DISTRIB_DESCRIPTION="Linux Mint 21 Vanessa"
NAME="Linux Mint"
VERSION="21 (Vanessa)"
ID=linuxmint
ID_LIKE="ubuntu debian"
PRETTY_NAME="Linux Mint 21"
VERSION_ID="21"
HOME_URL="https://www.linuxmint.com/"
SUPPORT_URL="https://forums.linuxmint.com/"
BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/"
PRIVACY_POLICY_URL="https://www.linuxmint.com/"
VERSION_CODENAME=vanessa
UBUNTU_CODENAME=jamm

pantcr7 avatar Jun 08 '23 05:06 pantcr7

@olfek tip of the hat for you sir, it worked 🎩👌

epomatti avatar Jun 11 '23 12:06 epomatti

Why don't you just fix this?

aradalvand avatar Jun 24 '23 14:06 aradalvand

It's not straightforward to fix.

For folks that don't register the Microsoft feeds, there is no problem. It is the mixing and matching of the Ubuntu and Microsoft feeds that cause issues and require special handling.

Documented at https://learn.microsoft.com/en-us/dotnet/core/install/linux-package-mixup?pivots=os-linux-ubuntu#whats-going-on

richlander avatar Jul 28 '23 23:07 richlander

the best solution for this problem and others that Ubuntu has with versions is to use ASDF which has support for dotnet among others.

TalesPalma avatar Sep 07 '23 23:09 TalesPalma