Skip to main content

Install .NET Core 3.1 SDK on Ubuntu 18.04 inside WSL

I’m a big fan of WSL (Windows Subsystem for Linux) to test my .NET Core applications on Linux.

Recently I tried to install the .NET Core 3.1 SDK on my Ubuntu distribution inside WSL:

bawu@ORD02476:~$ sudo apt-get install dotnet-sdk-3.1

Reading package lists... Done

Building dependency tree

Reading state information... Done

E: Unable to locate package dotnet-sdk-3.1

E: Couldn't find any package by glob 'dotnet-sdk-3.1'

E: Couldn't find any package by regex 'dotnet-sdk-3.1'

This didn’t seem to work. He couldn’t find the .NET Core 3.1 SDK inside the package manager.

I first tried to refresh the packages list:

bawu@ORD02476:~$ sudo apt update

0% [Connecting to archive.ubuntu.com] [Connecting to security.ubuntu.com]

Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease

Get:2 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]

Get:3 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]

Get:4 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]

Get:5 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [8570 kB]

Get:6 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [593 kB]

Get:7 http://security.ubuntu.com/ubuntu bionic-security/main Translation-en [194 kB]

Get:8 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [15.1 kB]

Get:9 http://security.ubuntu.com/ubuntu bionic-security/restricted Translation-en [4684 B]

Get:10 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [627 kB]

Get:11 http://security.ubuntu.com/ubuntu bionic-security/universe Translation-en [210 kB]

Get:12 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [6120 B]

Get:13 http://security.ubuntu.com/ubuntu bionic-security/multiverse Translation-en [2600 B]

Get:14 http://archive.ubuntu.com/ubuntu bionic/universe Translation-en [4941 kB]

Get:15 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [151 kB]

Get:16 http://archive.ubuntu.com/ubuntu bionic/multiverse Translation-en [108 kB]

Get:17 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [817 kB]

Get:18 http://archive.ubuntu.com/ubuntu bionic-updates/main Translation-en [288 kB]

Get:19 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [24.1 kB]

Get:20 http://archive.ubuntu.com/ubuntu bionic-updates/restricted Translation-en [6620 B]

Get:21 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1033 kB]

Get:22 http://archive.ubuntu.com/ubuntu bionic-updates/universe Translation-en [319 kB]

Get:23 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [9284 B]

Get:24 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse Translation-en [4508 B]

Get:25 http://archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages [2512 B]

Get:26 http://archive.ubuntu.com/ubuntu bionic-backports/main Translation-en [1644 B]

Get:27 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [4028 B]

Get:28 http://archive.ubuntu.com/ubuntu bionic-backports/universe Translation-en [1856 B]

Fetched 18.2 MB in 27s (661 kB/s)

Reading package lists... Done

Building dependency tree

Reading state information... Done

131 packages can be upgraded. Run 'apt list --upgradable' to see them.

But this didn’t made any difference:

bawu@ORD02476:~$ apt search dotnet-sdk

Sorting... Done

Full Text Search... Done

The trick is to first let the package manager know that it should include packages from ‘packages.microsoft.com’:

bawu@ORD02476:~$ wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb

bawu@ORD02476:~$ sudo dpkg -i packages-microsoft-prod.deb

Selecting previously unselected package packages-microsoft-prod.

(Reading database ... 28645 files and directories currently installed.)

Preparing to unpack packages-microsoft-prod.deb ...

Unpacking packages-microsoft-prod (1.0-ubuntu18.04.2) ...

Setting up packages-microsoft-prod (1.0-ubuntu18.04.2) ...

If we now update the package manager, it reads the packages from Microsoft as well:

bawu@ORD02476:~$ sudo apt-get update

Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease

Hit:2 http://archive.ubuntu.com/ubuntu bionic-updates InRelease

Get:3 https://packages.microsoft.com/ubuntu/18.04/prod bionic InRelease [4003 B]

Hit:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease

Hit:5 http://security.ubuntu.com/ubuntu bionic-security InRelease

Get:6 https://packages.microsoft.com/ubuntu/18.04/prod bionic/main amd64 Packages [85.1 kB]

Fetched 89.1 kB in 14s (6320 B/s)

Reading package lists... Done

And finally we find the .NET Core SDK when searching for packages:

bawu@ORD02476:~$ apt search dotnet-sdk

Sorting... Done

Full Text Search... Done

dotnet-sdk-2.1/bionic 2.1.802-1 amd64

  Microsoft .NET Core SDK 2.1.802

dotnet-sdk-2.1.105/bionic 2.1.105-1 amd64

  Microsoft .NET Core SDK - 2.1.105

dotnet-sdk-2.1.200/bionic 2.1.200-1 amd64

  Microsoft .NET Core SDK - 2.1.200

dotnet-sdk-2.1.201/bionic 2.1.201-1 amd64

  Microsoft .NET Core SDK - 2.1.201

dotnet-sdk-2.1.202/bionic 2.1.202-1 amd64

  Microsoft .NET Core SDK - 2.1.202

dotnet-sdk-2.1.300-preview2-008533/bionic 2.1.300-preview2-008533-1 amd64

  Microsoft .NET Core SDK 2.1.300 - Preview

dotnet-sdk-2.1.300-rc1-008673/bionic 2.1.300-rc1-008673-1 amd64

Microsoft .NET Core SDK 2.1.300 - rc1

dotnet-sdk-2.2/bionic 2.2.402-1 amd64

  Microsoft .NET Core SDK 2.2.402

dotnet-sdk-3.0/bionic 3.0.101-1 amd64

  Microsoft .NET Core SDK 3.0.101

dotnet-sdk-3.1/bionic 3.1.100-1 amd64

Microsoft .NET Core SDK 3.1.100

Popular posts from this blog

Podman– Command execution failed with exit code 125

After updating WSL on one of the developer machines, Podman failed to work. When we took a look through Podman Desktop, we noticed that Podman had stopped running and returned the following error message: Error: Command execution failed with exit code 125 Here are the steps we tried to fix the issue: We started by running podman info to get some extra details on what could be wrong: >podman info OS: windows/amd64 provider: wsl version: 5.3.1 Cannot connect to Podman. Please verify your connection to the Linux system using `podman system connection list`, or try `podman machine init` and `podman machine start` to manage a new Linux VM Error: unable to connect to Podman socket: failed to connect: dial tcp 127.0.0.1:2655: connectex: No connection could be made because the target machine actively refused it. That makes sense as the podman VM was not running. Let’s check the VM: >podman machine list NAME         ...

Cache stampede: when our cache turned against us

While investigating some performance issues, we ran into an ASP.NET Core API that cached a fairly expensive aggregation query for 60 seconds. Under normal load, that was fine: one request rebuilds the cache, everyone else reads from it. Under peak load, dozens of requests would arrive in that same expiry window, all see a cache miss, and all fire the same expensive query in parallel. The database didn't like that. That was the moment when our caching layer stopped helping and started hurting. A burst of requests comes in at the same time, all miss the cache, and all go hammer the database or the downstream API at once. That's a cache stampede . The cache was supposed to protect our backend, and for a few hundred milliseconds it did the opposite. Why this happens IMemoryCache.GetOrCreate (and its async sibling) looks like it protects you, but it doesn't add any locking on its own. Look at the naive version: public async Task<Report> GetReportAsync(string key) ...

A complex system designed from scratch never works

A few years ago, I worked as an architect on a big mainframe rewrite. I still count it as one of my failures. Not because the technology was wrong, but because I couldn't convince the management team to simplify the approach. Years later, the organization is still struggling to get the new system up and running. I left the project at the time, because I couldn't put my name behind an approach that would take very long and cost a lot of money without a working system to show for it along the way. Gall’s Law That memory keeps coming back to me, because it's a textbook case of Gall's Law playing out in real life. Gall's Law , from John Gall's Systemantics , states it plainly: A complex system that works is invariably found to have evolved from a simple system that worked. A complex system designed from scratch never works, and it cannot be patched to make it work. You have to start over with a simple system that works. What does that mean in practice,...