question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Ubuntu 22.04] dotnet doesn't find installed SDKs

See original GitHub issue

Describe the bug

I’ve followed instructions to install dotnet sdk via the package manager and the microsoft packages repository. dotnet find runtime but not sdk. however it seems that sdk is installed.

I tried previous version (up to 6.0.107-1), it doesn’t work.

To Reproduce

I just copy/paste some instructions from official documentation

  1. add apt repo via packages-microsoft-prod.deb
$ wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
$ sudo dpkg -i packages-microsoft-prod.deb
$ rm packages-microsoft-prod.deb

I removed arm64 and armhf in /etc/apt/sources.list.d/microsoft-prod.list

  1. update info & install desired package (i use apt instead of apt-get)
$ sudo apt update
Get:9 https://packages.microsoft.com/ubuntu/22.04/prod jammy InRelease [10,5 kB]                                                                                                             
[...]
Get:25 https://packages.microsoft.com/ubuntu/22.04/prod jammy/main amd64 Packages [31,7 kB]                                
[...]
Get:27 https://packages.microsoft.com/ubuntu/22.04/prod jammy/main amd64 Contents (deb) [351 kB]                          
[...]
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
$ sudo apt install dotnet-sdk-6.0

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  aspnetcore-runtime-6.0 dotnet-apphost-pack-6.0 dotnet-host dotnet-hostfxr-6.0 dotnet-runtime-6.0 dotnet-targeting-pack-6.0 liblttng-ust-common1 liblttng-ust-ctl5 liblttng-ust1
  libunwind-13
The following NEW packages will be installed:
  aspnetcore-runtime-6.0 dotnet-apphost-pack-6.0 dotnet-host dotnet-hostfxr-6.0 dotnet-runtime-6.0 dotnet-sdk-6.0 dotnet-targeting-pack-6.0 liblttng-ust-common1 liblttng-ust-ctl5
  liblttng-ust1 libunwind-13
0 upgraded, 11 newly installed, 0 to remove and 0 not upgraded.
Need to get 125 MB of archives.
After this operation, 475 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://fr.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 dotnet-targeting-pack-6.0 amd64 6.0.108-0ubuntu1~22.04.1 [2 238 kB]
Get:2 https://packages.microsoft.com/ubuntu/22.04/prod jammy/main amd64 dotnet-sdk-6.0 amd64 6.0.400-1 [86,4 MB] 
Get:3 http://fr.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 dotnet-host amd64 6.0.108-0ubuntu1~22.04.1 [156 kB]
Get:4 http://fr.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 dotnet-hostfxr-6.0 amd64 6.0.108-0ubuntu1~22.04.1 [154 kB]
Get:5 http://fr.archive.ubuntu.com/ubuntu jammy/main amd64 libunwind-13 amd64 1:13.0.1-2ubuntu2 [20,8 kB]
Get:6 http://fr.archive.ubuntu.com/ubuntu jammy/main amd64 liblttng-ust-common1 amd64 2.13.1-1ubuntu1 [27,1 kB]
Get:7 http://fr.archive.ubuntu.com/ubuntu jammy/main amd64 liblttng-ust-ctl5 amd64 2.13.1-1ubuntu1 [77,9 kB]
Get:8 http://fr.archive.ubuntu.com/ubuntu jammy/main amd64 liblttng-ust1 amd64 2.13.1-1ubuntu1 [190 kB]
Get:9 http://fr.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 dotnet-runtime-6.0 amd64 6.0.108-0ubuntu1~22.04.1 [23,7 MB]
Get:10 http://fr.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 aspnetcore-runtime-6.0 amd64 6.0.108-0ubuntu1~22.04.1 [8 090 kB]
Get:11 http://fr.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 dotnet-apphost-pack-6.0 amd64 6.0.108-0ubuntu1~22.04.1 [3 735 kB]                                                    
Fetched 125 MB in 14s (8 918 kB/s)                                                                                                                                                           
Selecting previously unselected package dotnet-targeting-pack-6.0.
(Reading database ... 260872 files and directories currently installed.)
Preparing to unpack .../00-dotnet-targeting-pack-6.0_6.0.108-0ubuntu1~22.04.1_amd64.deb ...
Unpacking dotnet-targeting-pack-6.0 (6.0.108-0ubuntu1~22.04.1) ...
Selecting previously unselected package dotnet-host.
Preparing to unpack .../01-dotnet-host_6.0.108-0ubuntu1~22.04.1_amd64.deb ...
Unpacking dotnet-host (6.0.108-0ubuntu1~22.04.1) ...
Selecting previously unselected package dotnet-hostfxr-6.0.
Preparing to unpack .../02-dotnet-hostfxr-6.0_6.0.108-0ubuntu1~22.04.1_amd64.deb ...
Unpacking dotnet-hostfxr-6.0 (6.0.108-0ubuntu1~22.04.1) ...
Selecting previously unselected package libunwind-13:amd64.
Preparing to unpack .../03-libunwind-13_1%3a13.0.1-2ubuntu2_amd64.deb ...
Unpacking libunwind-13:amd64 (1:13.0.1-2ubuntu2) ...
Selecting previously unselected package liblttng-ust-common1:amd64.
Preparing to unpack .../04-liblttng-ust-common1_2.13.1-1ubuntu1_amd64.deb ...
Unpacking liblttng-ust-common1:amd64 (2.13.1-1ubuntu1) ...
Selecting previously unselected package liblttng-ust-ctl5:amd64.
Preparing to unpack .../05-liblttng-ust-ctl5_2.13.1-1ubuntu1_amd64.deb ...
Unpacking liblttng-ust-ctl5:amd64 (2.13.1-1ubuntu1) ...
Selecting previously unselected package liblttng-ust1:amd64.
Preparing to unpack .../06-liblttng-ust1_2.13.1-1ubuntu1_amd64.deb ...
Unpacking liblttng-ust1:amd64 (2.13.1-1ubuntu1) ...
Selecting previously unselected package dotnet-runtime-6.0.
Preparing to unpack .../07-dotnet-runtime-6.0_6.0.108-0ubuntu1~22.04.1_amd64.deb ...
Unpacking dotnet-runtime-6.0 (6.0.108-0ubuntu1~22.04.1) ...
Selecting previously unselected package aspnetcore-runtime-6.0.
Preparing to unpack .../08-aspnetcore-runtime-6.0_6.0.108-0ubuntu1~22.04.1_amd64.deb ...
Unpacking aspnetcore-runtime-6.0 (6.0.108-0ubuntu1~22.04.1) ...
Selecting previously unselected package dotnet-apphost-pack-6.0.
Preparing to unpack .../09-dotnet-apphost-pack-6.0_6.0.108-0ubuntu1~22.04.1_amd64.deb ...
Unpacking dotnet-apphost-pack-6.0 (6.0.108-0ubuntu1~22.04.1) ...
Selecting previously unselected package dotnet-sdk-6.0.
Preparing to unpack .../10-dotnet-sdk-6.0_6.0.400-1_amd64.deb ...
Unpacking dotnet-sdk-6.0 (6.0.400-1) ...
Setting up dotnet-host (6.0.108-0ubuntu1~22.04.1) ...
update-alternatives: using /usr/lib/dotnet/dotnet6-6.0.108/dotnet to provide /usr/bin/dotnet (dotnet) in auto mode
update-alternatives: warning: skip creation of /usr/share/bash-completion/completions/dotnet because associated file /usr/lib/dotnet/dotnet6-6.0.108/bash-completion/completions/dotnet (of li
nk group dotnet) doesn't exist
Setting up dotnet-apphost-pack-6.0 (6.0.108-0ubuntu1~22.04.1) ...
Setting up liblttng-ust-common1:amd64 (2.13.1-1ubuntu1) ...
Setting up dotnet-targeting-pack-6.0 (6.0.108-0ubuntu1~22.04.1) ...
Setting up libunwind-13:amd64 (1:13.0.1-2ubuntu2) ...
Setting up liblttng-ust-ctl5:amd64 (2.13.1-1ubuntu1) ...
Setting up dotnet-hostfxr-6.0 (6.0.108-0ubuntu1~22.04.1) ...
Setting up liblttng-ust1:amd64 (2.13.1-1ubuntu1) ...
Setting up dotnet-runtime-6.0 (6.0.108-0ubuntu1~22.04.1) ...
Setting up aspnetcore-runtime-6.0 (6.0.108-0ubuntu1~22.04.1) ...
Setting up dotnet-sdk-6.0 (6.0.400-1) ...
This software may collect information about you and your use of the software, and send that to Microsoft.
Please visit http://aka.ms/dotnet-cli-eula for more information.
Welcome to .NET!
---------------------
Learn more about .NET: https://aka.ms/dotnet-docs
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs

Telemetry
---------
The .NET tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_
CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

Configuring...
--------------
A command is running to populate your local package cache to improve restore speed and enable offline access. This command takes up to one minute to complete and only runs once.
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...

At this point, sdk && runtime should be installed

$ 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

dotnet found runtimes but not sdks. Listing files in filesystem seems to show that sdk is installed

$ ls -lah /usr/lib/dotnet/
total 20K
drwxr-xr-x   3 root root 4,0K août  10 17:06 .
drwxr-xr-x 134 root root  12K août  10 17:06 ..
lrwxrwxrwx   1 root root   25 août  10 17:06 dotnet6 -> /etc/alternatives/dotnet6
drwxr-xr-x   6 root root 4,0K août  10 17:06 dotnet6-6.0.108

$ ls -lah /usr/share/dotnet/
total 28K
drwxr-xr-x   5 root root 4,0K août  10 17:06 .
drwxr-xr-x 338 root root  12K août  10 17:06 ..
drwxr-xr-x   3 root root 4,0K août  10 17:06 sdk
drwxr-xr-x   3 root root 4,0K août  10 17:06 sdk-manifests
drwxr-xr-x   3 root root 4,0K août  10 17:06 templates

$ ls -lah /usr/share/dotnet/sdk
total 32K
drwxr-xr-x  3 root root 4,0K août  10 17:06 .
drwxr-xr-x  5 root root 4,0K août  10 17:06 ..
drwxr-xr-x 30 root root  20K août  10 17:06 6.0.400

$ ls -lah /usr/share/dotnet/sdk-manifests/
total 12K
drwxr-xr-x  3 root root 4,0K août  10 17:06 .
drwxr-xr-x  5 root root 4,0K août  10 17:06 ..
drwxr-xr-x 10 root root 4,0K août  10 17:06 6.0.300

$ ls -lah /usr/share/dotnet/templates/
total 12K
drwxr-xr-x 3 root root 4,0K août  10 17:06 .
drwxr-xr-x 5 root root 4,0K août  10 17:06 ..
drwxr-xr-x 2 root root 4,0K août  10 17:06 6.0.8

Edit: more list/tests

$ ls -lah /usr/bin/dotnet
lrwxrwxrwx 1 root root 24 août  10 17:35 /usr/bin/dotnet -> /etc/alternatives/dotnet

$ ls -lah /etc/alternatives/dotnet
lrwxrwxrwx 1 root root 38 août  10 17:35 /etc/alternatives/dotnet -> /usr/lib/dotnet/dotnet6-6.0.108/dotnet

$ dpkg -l | grep dotnet
ii  dotnet-apphost-pack-6.0                    6.0.108-0ubuntu1~22.04.1                                                        amd64        Internal - targeting pack for Microsoft.NETCore.App 6.0
ii  dotnet-host                                6.0.108-0ubuntu1~22.04.1                                                        amd64        dotNET host command line
ii  dotnet-hostfxr-6.0                         6.0.108-0ubuntu1~22.04.1                                                        amd64        dotNET host resolver
ii  dotnet-runtime-6.0                         6.0.108-0ubuntu1~22.04.1                                                        amd64        dotNET runtime
ii  dotnet-sdk-6.0                             6.0.400-1                                                                       amd64        Microsoft .NET SDK 6.0.400
ii  dotnet-targeting-pack-6.0                  6.0.108-0ubuntu1~22.04.1                                                        amd64        Internal - targeting pack for Microsoft.NETCore.App 6.0

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:18 (2 by maintainers)

github_iconTop GitHub Comments

86reactions
Unicron2kcommented, Aug 10, 2022

Just encountered the same problem on Kubuntu 22.04.

Not sure if this applies to you, but when listing the versions for the dependencies I noticed jammy-updates 6.0.108-0ubuntu1~22.04.1 were listed as the latest for all but dotnet-sdk-6.0 (which is 6.0.400-1, or 6.0.8).

Manually specifying the package-versions solved the issue for me:

$ sudo apt install aspnetcore-runtime-6.0=6.0.8-1 dotnet-apphost-pack-6.0=6.0.8-1 dotnet-host=6.0.8-1 dotnet-hostfxr-6.0=6.0.8-1 dotnet-runtime-6.0=6.0.8-1 dotnet-sdk-6.0=6.0.400-1 dotnet-targeting-pack-6.0=6.0.8-1

Looks like it’s a version mismatch between the Ubuntu repos and Microsoft repos.

15reactions
KubaSzostakcommented, Dec 12, 2022

For me solution provided by Microsoft resolved the issue (Ubuntu 18.04.6 LTS):

sudo apt remove 'dotnet*' 'aspnet*' 'netstandard*'
sudo rm /etc/apt/sources.list.d/microsoft-prod.list
sudo apt update
sudo apt install dotnet-sdk-6.0
Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet sdk is installed but not recognized - Linux Ubuntu ...
Here is what happens when I try to do an apt install of the sdk(It shows already installed): sudo apt install dotnet-sdk-6.0 [sudo]...
Read more >
Why don't any of these methods work for installing .Net ...
sudo apt update sudo apt install dotnet-sdk-6.0. And I got the last version of the SDK: $ dotnet --list-sdks 6.0.400 [/usr/share/dotnet/sdk].
Read more >
Install .NET SDK or .NET Runtime on Ubuntu 22.04
Demonstrates the various ways to install .NET SDK and .NET Runtime on Ubuntu 22.04.
Read more >
How to Install the .NET Runtime (or SDK) on Ubuntu 22.04
Learn how to install the .NET 6 SDK or runtime on Ubuntu and understand its limitations, requirements, and security implications.
Read more >
Install the .NET SDK or the .NET Runtime on Ubuntu
Demonstrates the various ways to install .NET SDK and .NET Runtime on Ubuntu.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found