Core: Unable to install .NET Core SDK 2.1 on WSL Linux Ubuntu 18.04

Created on 24 Aug 2018  路  16Comments  路  Source: dotnet/core

When I run the last step of the procedure
sudo apt-get install dotnet-sdk-2.1.4 I get

E: Unable to locate package dotnet-sdk-2.1
E: Couldn't find any package by glob 'dotnet-sdk-2.1'
E: Couldn't find any package by regex 'dotnet-sdk-2.1

It seems to be the similar problem like by #1522.

akalcik@WIN-928NLGZOIY:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.1 LTS
Release:        18.04
Codename:       bionic

akalcik@WIN-928NLGZOIY:~$ wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
akalcik@WIN-928NLGZOIY:~$ sudo dpkg -i packages-microsoft-prod.deb
[sudo] password for akalcik:
(Reading database ... 32670 files and directories currently installed.)
Preparing to unpack packages-microsoft-prod.deb ...
Unpacking packages-microsoft-prod (1.0-ubuntu18.04.1) over (1.0-ubuntu18.04.1) ...
Setting up packages-microsoft-prod (1.0-ubuntu18.04.1) ...

akalcik@WIN-928NLGZOIY:~$ sudo apt-get install apt-transport-https
Reading package lists... Done
Building dependency tree
Reading state information... Done
apt-transport-https is already the newest version (1.6.3ubuntu0.1).
The following package was automatically installed and is no longer required:
  libfreetype6
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

akalcik@WIN-928NLGZOIY:~$ sudo apt-get update
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://security.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB]
Hit:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Get:5 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [302 kB]
Get:6 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [172 kB]
Get:7 http://archive.ubuntu.com/ubuntu bionic-updates/universe Translation-en [79.6 kB]
Get:8 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [56.9 kB]
Get:9 http://security.ubuntu.com/ubuntu bionic-security/universe Translation-en [33.4 kB]
Fetched 815 kB in 4s (201 kB/s)
Reading package lists... Done

akalcik@WIN-928NLGZOIY:~$ sudo apt-get install dotnet-sdk-2.1
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package dotnet-sdk-2.1
E: Couldn't find any package by glob 'dotnet-sdk-2.1'
E: Couldn't find any package by regex 'dotnet-sdk-2.1'

However .NET Core Runtime was installed without any issues.

Most helpful comment

I had the same problem on a fresh installed Ubuntu 18.04 LTS. What helped was the entry:

sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic main" > /etc/apt/sources.list.d/dotnetdev.list'

and after
sudo apt-get update
sudo apt-get install dotnet-sdk-2.1
works fine.

Please complete the documentation on the page:
https://www.microsoft.com/net/download/linux-package-manager/ubuntu18-04/sdk-current

All 16 comments

Hi @akalcik - the 2.1.4 SDK was not released for 18.04. If you want the latest then apt install dotnet-sdk-2.1 will get you going.

Thx @leecow! Pretty confusing. Here is no mention about not released yet.

But the error remains the same

akalcik@WIN-928NLGZOIY:~$ sudo apt install dotnet-sdk-2.1
[sudo] password for akalcik:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package dotnet-sdk-2.1
E: Couldn't find any package by glob 'dotnet-sdk-2.1'
E: Couldn't find any package by regex 'dotnet-sdk-2.1'
sudo apt-key adv --keyserver packages.microsoft.com --recv-keys EB3E94ADBE1229CF
sudo apt-key adv --keyserver packages.microsoft.com --recv-keys 52E16F86FEE04B979B07E28DB02C46DF417A0893
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic main" > /etc/apt/sources.list.d/dotnetdev.list
sudo apt-get update
sudo apt-get installdotnet-sdk-2.1.105

Worked for me.

Note: Freezing did occur for me on the first two commands. I could still install even after skipping them.

sudo apt-get install dotnet-sdk-2.1.105

That installs an SDK that can only target .NET Core runtime 2.0 (see here for the sdk version to runtime version mapping for SDK 2.1.105). You should install SDK version 2.1.300 or later to get support for .NET Core runtime 2.1.

@akalcik - can what is returned by apt search donet-sdk?

@omajid Fair enough. sudo apt-get install dotnet-sdk-2.1.300 worked for me too.

@leecow Nothing

akalcik@WIN-928NLGZOIY:~$ apt search dotnet-sdk
Sorting... Done
Full Text Search... Done

@wickedlizerd @omajid Here the output. Should I say that this is installation of Ubuntu is from Microsoft Store and is running on Windows 10?

akalcik@WIN-928NLGZOIY:~$ sudo apt-key adv --keyserver packages.microsoft.com --recv-keys EB3E94ADBE1229CF
Executing: /tmp/apt-key-gpghome.yTfAapPM4U/gpg.1.sh --keyserver packages.microsoft.com --recv-keys EB3E94ADBE1229CF
gpg: connecting dirmngr at '/tmp/apt-key-gpghome.yTfAapPM4U/S.dirmngr' failed: IPC connect call failed
gpg: keyserver receive failed: No dirmngr

akalcik@WIN-928NLGZOIY:~$ sudo apt-key adv --keyserver packages.microsoft.com --recv-keys 52E16F86FEE04B979B07E28DB02C46DF417A0893
Executing: /tmp/apt-key-gpghome.YcGXj1cAkO/gpg.1.sh --keyserver packages.microsoft.com --recv-keys 52E16F86FEE04B979B07E28DB02C46DF417A0893
gpg: connecting dirmngr at '/tmp/apt-key-gpghome.YcGXj1cAkO/S.dirmngr' failed: IPC connect call failed
gpg: keyserver receive failed: No dirmng

akalcik@WIN-928NLGZOIY:~$ sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic main" > /etc/apt/sources.list.d/dotnetdev.list'

akalcik@WIN-928NLGZOIY:~$ cat /etc/apt/sources.list.d/dotnetdev.list
deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic main

akalcik@WIN-928NLGZOIY:~$ sudo apt-get update
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://security.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:5 https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic InRelease [2846 B]
Get:6 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [303 kB]
Get:7 http://archive.ubuntu.com/ubuntu bionic-updates/main Translation-en [114 kB]
Get:8 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [172 kB]
Get:9 http://archive.ubuntu.com/ubuntu bionic-updates/universe Translation-en [79.8 kB]
Get:10 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [158 kB]
Get:11 http://security.ubuntu.com/ubuntu bionic-security/main Translation-en [60.5 kB]
Err:5 https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF
Reading package lists... Done
W: GPG error: https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF
E: The repository 'https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details

akalcik@WIN-928NLGZOIY:~$ sudo apt-get install dotnet-sdk-2.1.105
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package dotnet-sdk-2.1.105
E: Couldn't find any package by glob 'dotnet-sdk-2.1.105'
E: Couldn't find any package by regex 'dotnet-sdk-2.1.105'

akalcik@WIN-928NLGZOIY:~$ sudo apt-get install dotnet-sdk-2.1.300
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package dotnet-sdk-2.1.300
E: Couldn't find any package by glob 'dotnet-sdk-2.1.300'
E: Couldn't find any package by regex 'dotnet-sdk-2.1.300'

akalcik@WIN-928NLGZOIY:~$ sudo apt-get install dotnet-sdk-2.1.400
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package dotnet-sdk-2.1.400
E: Couldn't find any package by glob 'dotnet-sdk-2.1.400'
E: Couldn't find any package by regex 'dotnet-sdk-2.1.400'

Thanks for the additional info. Looks like you're not validating the package feed signature and are therefore not reading any packages from the repo.

Err:5 https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF
Reading package lists... Done
W: GPG error: https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF

I have confirmed this works fine on 16.04 install on WSL so there's just something configured incorrectly on your system. The AZLinux team has recently add a configuration installer for 18.04 which takes care of repo registration and key installation in a single command. I just ran the following on an 18.04 on WSL install and the SDK installed correctly and 'hello world' built and ran.

  1. wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
  2. sudo dpkg -i packages-microsoft-prod.deb
  3. sudo apt-get install apt-transport-https
  4. sudo apt-get update
  5. apt search dotnet-sdk-2.1

@leecow Well, I installed the Ubuntu twice, and had all time the same problem. Any suggestion what I should do?

The suggestion is to complete steps 1 - 5 in my last reply.

Well I tried now a lot of things I was able to install the latest SDK (2.1.401-1). That's the good message,. The bad message is that I don't know what the exactly the problem was. What I tried:

Removed /etc/resolv.conf and restarted the Ubuntu by killing LxssManager in Windows

I've made this because there were some suggestion that the error below has something to do with nameserver

gpg: connecting dirmngr at '/tmp/apt-key-gpghome.YcGXj1cAkO/S.dirmngr' failed: IPC connect call failed
gpg: keyserver receive failed: No dirmng

Disabled and enabled resolved service

sudo systemctl disable systemd-resolved.service
sudo systemctl enable systemd-resolved.service

Tried to install dirmngr and grg

There was suppose that dirmngr or grg aren't installed but they were.

Tried to install VS Code

curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'

sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install code # or code-insiders

This was only to get some editor to edit some config file when necessary*. But after this step I was able to install latest SDK.

  • VS Code isn't running on Ubuntu WSL at this time :-(

I had the same problem on a fresh installed Ubuntu 18.04 LTS. What helped was the entry:

sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic main" > /etc/apt/sources.list.d/dotnetdev.list'

and after
sudo apt-get update
sudo apt-get install dotnet-sdk-2.1
works fine.

Please complete the documentation on the page:
https://www.microsoft.com/net/download/linux-package-manager/ubuntu18-04/sdk-current

I had the same problem on a fresh installed Ubuntu 18.04 LTS. What helped was the entry:

sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic main" > /etc/apt/sources.list.d/dotnetdev.list'

and after
sudo apt-get update
sudo apt-get install dotnet-sdk-2.1
works fine.

Please complete the documentation on the page:
https://www.microsoft.com/net/download/linux-package-manager/ubuntu18-04/sdk-current

Thank you! After trying everything else suggested on this page and elsewhere to install dotnet on a fresh Ubuntu install from the Windows store, your suggestion worked straight away. I don't know why it was so hard and convoluted, it should just work(!), but it is working now and I've stored your comments and shell output just in case I need to do this again another day. Thanks legend... :)

What does the line do?
Do we still need to update any docs?

sudo apt-key adv --keyserver packages.microsoft.com --recv-keys EB3E94ADBE1229CF
sudo apt-key adv --keyserver packages.microsoft.com --recv-keys 52E16F86FEE04B979B07E28DB02C46DF417A0893
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic main" > /etc/apt/sources.list.d/dotnetdev.list
sudo apt-get update
sudo apt-get installdotnet-sdk-2.1.105

Worked for me.

Note: Freezing did occur for me on the first two commands. I could still install even after skipping them.

The above enabled me to successfully install .NET Core 2.1 run-time.

Was this page helpful?
0 / 5 - 0 ratings