Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
cspwizard opened this issue Aug 12, 2022 · 31 comments

Comments

@cspwizard
Copy link

Is there an existing issue for this?

  • 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 cspwizard changed the title Installed .NET 6.0 SDKs not showing with dotnet --info or dotnet --list-sdks and command depeding on SDK failes (Linux/Ubuntu) Installed .NET 6.0 SDKs not showing with dotnet --info or dotnet --list-sdks and commands depeding on SDK faile (Linux/Ubuntu) Aug 12, 2022
@cspwizard cspwizard changed the title Installed .NET 6.0 SDKs not showing with dotnet --info or dotnet --list-sdks and commands depeding on SDK faile (Linux/Ubuntu) Installed .NET 6.0 SDKs not showing with dotnet --info or dotnet --list-sdks and commands depeding on SDK fail (Linux/Ubuntu) Aug 12, 2022
@ghost
Copy link

ghost commented Aug 12, 2022

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).

@javiercn javiercn transferred this issue from dotnet/aspnetcore Aug 12, 2022
@baronfel
Copy link
Member

Hello folks, please check dotnet/core#7699 for more details about this.

@khteh
Copy link

khteh commented Aug 13, 2022

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

@owenholloway
Copy link

owenholloway commented Aug 13, 2022

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```

@wizzardcl
Copy link

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'

@jroeber
Copy link

jroeber commented Aug 13, 2022

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.

@richlander
Copy link
Member

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

dotnet/core#7699

@jroeber
Copy link

jroeber commented Aug 13, 2022

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.

@richlander
Copy link
Member

For sure. I'm glad the instructions helped.

install the SDK without an extra sources

Indeed. This is the plan going forward.

@khteh
Copy link

khteh commented Aug 14, 2022

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

@olfek
Copy link

olfek commented Aug 14, 2022

I'm seeing this too

@olfek
Copy link

olfek commented Aug 14, 2022

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

@pietervdheijden
Copy link

pietervdheijden commented Aug 18, 2022

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

@olfek
Copy link

olfek commented Aug 18, 2022

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

@pietervdheijden
Copy link

My bad... I updated the comment!

@ferneyvanegas
Copy link

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

@Johnny-Tommy
Copy link

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

@seanamos
Copy link

seanamos commented Aug 29, 2022

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:
#27129 (comment) is the correct fix at the moment.

Following the steps here: dotnet/core#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.

@jinweijie
Copy link

jinweijie commented Sep 11, 2022

This breaks my dev env on Linux machine. Rider just suddenly not working anymore. Although I fixed it temperarily by #27129 (comment) (Thanks!) It's a very bad issue.

@0xStuart
Copy link

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

@ozgend
Copy link

ozgend commented Dec 29, 2022

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]

@Mansour-Hz
Copy link

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

@richlander
Copy link
Member

There is more detail here: dotnet/core#7699

@HossamElwahsh
Copy link

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

@kitingChris
Copy link

kitingChris commented Feb 17, 2023

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"

@pantcr7
Copy link

pantcr7 commented Jun 8, 2023

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

@epomatti
Copy link

epomatti commented Jun 11, 2023

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

@aradalvand
Copy link

Why don't you just fix this?

@richlander
Copy link
Member

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

@TalesPalma
Copy link

TalesPalma commented Sep 7, 2023

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

@gleison1986CEO
Copy link

Solution for ubuntu 22.04
#============================>

  • sudo apt remove dotnet* // REMOVE ALL INSTALATION DOTNET
  • sudo rm /etc/apt/sources.list.d/microsoft-prod.list
  • sudo apt-get update && apt-get upgrade
  • sudo apt install -y dotnet6 && sudo apt install -y dotnet7 && sudo apt install -y dotnet8 && sudo apt install -y dotnet5 && sudo apt install -y dotnet3 && dotnet --list-sdks
    #============================>

AND DONE!

"JESUS IS LORD FOREVER!!"

andreriesco added a commit to andreriesco/vscode-torizon-templates that referenced this issue Apr 22, 2024
On Ubuntu, for dotnet-sdk-6.0 and dotnet-sdk-7.0 it is necessary
to enforce the preference for the packages comming from Microsoft,
to ensure the correct installation
Links: dotnet/sdk#27129 (comment)
https://learn.microsoft.com/en-us/dotnet/core/install/linux-package-mixup?pivots=os-linux-ubuntu#i-need-a-version-of-net-that-isnt-provided-by-my-linux-distribution

Signed-off-by: Andre Riesco <[email protected]>
andreriesco added a commit to andreriesco/vscode-torizon-templates that referenced this issue Apr 22, 2024
On Ubuntu, for dotnet-sdk-6.0 and dotnet-sdk-7.0 it is necessary
to enforce the preference for the packages comming from Microsoft,
to ensure the correct installation
Links: dotnet/sdk#27129 (comment)
https://learn.microsoft.com/en-us/dotnet/core/install/linux-package-mixup?pivots=os-linux-ubuntu#i-need-a-version-of-net-that-isnt-provided-by-my-linux-distribution

Signed-off-by: Andre Riesco <[email protected]>
andreriesco added a commit to andreriesco/vscode-torizon-templates that referenced this issue Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests