4

I have two Ubuntu 22.04 systems with Dotnet 6.0. The one that has been continuously upgraded from older versions of Ubuntu runs my Dotnet Core 3.1 app without any trouble -- because it still has the old runtime (and libssl1.1) that are no longer available for 22.04.

The one running in WSL (i.e., Ubuntu under Windows) has the dotnet6.0 package, libssl1.1 downloaded from packages.ubuntu.com/focus, and aspnetcore-runtime-3.1 from microsoft .

But dotnet --info:

.NET SDK (reflecting any global.json):
 Version:   6.0.108
 Commit:    4e3a463d2b

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  22.04
 OS Platform: Linux
 RID:         ubuntu.22.04-x64
 Base Path:   /usr/lib/dotnet/dotnet6-6.0.108/sdk/6.0.108/

global.json file:
  Not found

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

.NET SDKs installed:
  6.0.108 [/usr/lib/dotnet/dotnet6-6.0.108/sdk]

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

Even though the runtime shows at /usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.28/

2

3 Answers 3

4

I couldn't get 3.1 working on ubuntu 22 using any package repos. With the microsoft package repo I could find the package but it couldn't get the dependencies:

sudo apt-get install dotnet-sdk-3.1
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies.
 dotnet-sdk-3.1 : Depends: dotnet-targeting-pack-3.1 (>= 3.1.0) but it is not installable
                  Depends: netstandard-targeting-pack-2.1 (>= 2.1.0)
                  Depends: aspnetcore-targeting-pack-3.1 (>= 3.1.10) but it is not installable
E: Unable to correct problems, you have held broken packages

I think it's because 3.1 is now unsupported.

What seemed to work was uninstalling all my dotnet packages

sudo apt remove dotnet*

and then getting the binaries direct from https://dotnet.microsoft.com/en-us/download/dotnet/3.1

When you click the link for your architecture it gives you the following instructions:

install by running this from ~/Downloads (or wherever you have the tar.gz)

mkdir -p $HOME/dotnet && tar zxf dotnet-sdk-3.1.426-linux-x64.tar.gz -C $HOME/dotnet

then add the following lines to your bash startup file (.profile/.bashrc/whatever)

export DOTNET_ROOT=$HOME/dotnet
export PATH=$PATH:$HOME/dotnet

you'll then need to resource your profile in any open terminals and dotnet run should do it's thing again

4
  • 1
    It's odd that it would find the sdk, but not the other packages, but I think you're right that they'll have been removed if they're out-of-support. If they're still available in the binaries, this is the way to go. It also removes the problems associated with pinning, which is always a royal pain!
    – Auspex
    Commented Aug 17, 2023 at 12:13
  • @Auspex Yeah I was surprised that you get to see the package but can't install it, seems a bit pointless but maybe there is a way that is useful still - my understanding of the packages is very limited and it's possible that you can still get useful parts of 3.1 out of the package repo. I don't really use dotnet as a developer these days but use it to run some services in my (Haskell) dev environment
    – JonnyRaa
    Commented Aug 21, 2023 at 17:27
  • If you want the SDK to be automatically recongnized, then cp $HOME/dotnet/sdk/3.1.426/ /usr/lib/dotnet/sdk/
    – pgampe
    Commented Apr 10 at 14:16
  • @JonnyRaa could you help me here? stackoverflow.com/questions/78322704/… Commented Apr 14 at 4:14
4

**EDIT: Probably obsolete: See Johny Raa's answer: **

It turns out the Ubuntu choices for SDK and runtime location are incompatible with Microsoft's. So, it's nice to have the dotnet6 package to pull in all the packages, but the ones you want are actually Microsoft's! The key is to first create an apt preferences file:

derbro@L21PS773:~$ cat /etc/apt/preferences.d/dotnet.pref
Package: dotnet* aspnet* netstandard*
Pin: release o=Ubuntu,l=Ubuntu
Pin-Priority: -10

(which my working system already had based on instructions for making Dotnet 6.0 work, at Why don't any of these methods work for installing .Net Core SDK & runtime on 22.04 (Jammy Jellyfish)?. I actually didn't have a problem getting Dotnet 6 to work on this WSL installation, I just couldn't make it find the 3.1 runtime)

Now, install the 3.1 runtime or SDK per MS instructions:

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
rm packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y aspnetcore-runtime-3.1
#or
sudo apt-get install -y dotnet-sdk-3.1

(if either fail to install because you're missing libssl1.1, you'll have to get that from https://packages.ubuntu.com/focal/libssl1.1 and install with dpkg --install)

Then upgrade your MS sources:

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
sudo apt-get update

and install (or reinstall) dotnet 6

sudo apt install dotnet-sdk-6.0
1
-1

In the file /etc/ssl/openssl.cnf, comment this line:

#openssl_conf = openssl_init

So, try to install the sdk 3.1:

sudo 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 rm packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y dotnet-sdk-3.1

And now, go to the terminal and type this comand:

dotnet --info

if everything is fine, you will see the path of instalation of dotnet 3.1

2
  • I think you're trying to solve two different problems there. First, an openssl issue (my openssl.cnf does not have that commented, anyway, but dotnet-sdk-3.1 depends on libssl1.1 which your solution doesn't provide); and secondly the 3.1 sdk. However, the issue I had is that I had apt-installed dotnet-sdk-3.1 and it still doesn't work because you will have Ubuntu's version of 6.0, which is incompatible (perhaps Ubuntu has fixed this by now). Otherwise, your answer is a subset of mine.
    – Auspex
    Commented Oct 10, 2022 at 13:05
  • @Auspex for me, this solution work. I follow this exacly steps and dotnet 3.1 and 6.0 is running on ubuntu 22.04.
    – Paulo
    Commented Oct 22, 2022 at 0:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .