Core: .NET Core SDK 2.2 on Linux Ubuntu 18.04: Unable to locate package

Created on 13 Dec 2018  路  64Comments  路  Source: dotnet/core

.NET Core SDK 2.2 on Linux Ubuntu 18.04: Unable to locate package

The install instructions here don't work on Ubuntu 18.04.1.

sudo apt-get install dotnet-sdk-2.2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package dotnet-sdk-2.2
E: Couldn't find any package by glob 'dotnet-sdk-2.2'
E: Couldn't find any package by regex 'dotnet-sdk-2.2'

I'm aware of issue #1522 pertaining to the earlier release. What is the correct/current guidance for .NET Core SDK on Ubuntu 18.04?

needs-more-info

Most helpful comment

It seems that the packages-microsoft-prod.deb tool doesn't properly handle third-party Bionic-based distributions. I use PopOS! from System76 and I have no issues installing any packages for Bionic.

I copied the list manually and it worked:

wget -q https://packages.microsoft.com/config/ubuntu/18.04/prod.list
sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list
sudo apt update

All 64 comments

@rickrain I don't have linux myself, but could you try the instructions here? https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script

@tristanbarcelon, those instructions are to install the .NET Core CLI tools. This issue is with installing the SDK.

I've confirmed on a clean 18.04 box that the sdk is available and installs correctly.

@rickrain - have you registered the feed as detailed at https://dotnet.microsoft.com/download/linux-package-manager/ubuntu18-04/sdk-current? This will properly register the feed with apt-get and enable installation from the native installers. If you're not sure, let me know what the output of the following command is for you.

ls /etc/apt/sources.list.d/

I have the same issue and I am sure I completed all steps from the referenced page. I get the following error:

~/ $ sudo apt-get install dotnet-sdk-2.2

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package dotnet-sdk-2.2
E: Couldn't find any package by glob 'dotnet-sdk-2.2'
E: Couldn't find any package by regex 'dotnet-sdk-2.2'

The output of ls /etc/apt/sources.list.d/ is:

azure-cli.list           kubernetes.list            skype-stable.list  sublime-text.list                     vscode.list
google-chrome.list       mono-official-stable.list  slack.list         system76-ubuntu-pop-bionic.list       vscode.list.save
google-chrome.list.save  nodesource.list            spotify.list       system76-ubuntu-pop-bionic.list.save  yarn.list

It seems that the packages-microsoft-prod.deb tool doesn't properly handle third-party Bionic-based distributions. I use PopOS! from System76 and I have no issues installing any packages for Bionic.

I copied the list manually and it worked:

wget -q https://packages.microsoft.com/config/ubuntu/18.04/prod.list
sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list
sudo apt update

@rickrain Hmm.. my apologies. I could have sworn the link I sent you could be used to install the sdk, esp. when you omit the --runtime flag and specify --version of 2.2 or 2.2.101

@tristanbarcelon and @leecow, I observed the exact same thing that @alexeyzimarev mentioned above. Installing the packages-microsoft-prod.deb file as explained in the instructions did not result in /etc/apt/sources.list.d/microsoft-prod.list getting created.

However, after manually copying the file as @alexeyzimarev showed above, I'm able to get the SDK installed.

My Ubuntu image is the image from the Windows 10 (v1809) Hyper-V Quick Create image repository.

I'm seeing this issue too and @alexeyzimarev's suggestion doesn't work

@schotime , while problem related to packages-microsoft-prod.deb has been identified as per this issue. Can you please share below details to further diagnose the issue you are encountering ?

  1. List the feeds runtime package is configured.
    apt-cache policy dotnet-sdk-2.2
    apt-cache policy dotnet-runtime-2.2
  2. OS details
    cat /etc/os-release
  3. List which system package is failing to install
    sudo apt-get install dotnet-runtime-deps-2.2
  4. List which all libicu packages are available
    apt-cache search libicu

Obviously the failures are unexpected, thanks for bringing them to our attention. For those experiencing failures, could you respond back with the following.

  1. OS (specifically if it is a derivative of Ubuntu, not stock Ubuntu).
  2. Output of dpkg -l | grep "packages-microsoft-prod"
  3. Output of dpkg -L packages-microsoft-prod

There is a preinst script which checks for existence of the files, and that could certainly hit an error causing the package install to fail. But the .list file itself is just a file in the package, there's no magic that it uses to install.

I'm unable to repro the issue in PopOS. The .list file installs successfully and the dotnet-sdk-2.2 package is discovered.

mbearup@pop-os:~$ sudo dpkg -i packages-microsoft-prod.deb
Selecting previously unselected package packages-microsoft-prod.
(Reading database ... 199115 files and directories currently installed.)
Preparing to unpack packages-microsoft-prod.deb ...
Unpacking packages-microsoft-prod (1.0-ubuntu18.04.1) ...
Setting up packages-microsoft-prod (1.0-ubuntu18.04.1) ...
mbearup@pop-os:~$ dpkg -l | grep packages-microsoft
ii  packages-microsoft-prod                          1.0-ubuntu18.04.1 
mbearup@pop-os:~$ dpkg -L packages-microsoft-prod
/etc
/etc/apt
/etc/apt/sources.list.d
/etc/apt/sources.list.d/microsoft-prod.list
/etc/apt/trusted.gpg.d
/etc/apt/trusted.gpg.d/microsoft-prod.gpg
/usr
/usr/share
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/packages-microsoft-prod
/usr/share/doc
/usr/share/doc/packages-microsoft-prod
/usr/share/doc/packages-microsoft-prod/changelog.Debian.gz
/usr/share/doc/packages-microsoft-prod/copyright
mbearup@pop-os:~$ ll /etc/apt/sources.list.d
total 20
drwxr-xr-x 2 root root 4096 Dec 18 11:36 ./
drwxr-xr-x 6 root root 4096 Dec 18 11:27 ../
-rw-r--r-- 1 root root   78 May  8  2018 microsoft-prod.list
-rw-r--r-- 1 root root  126 Dec 17 11:18 system76-ubuntu-pop-bionic.list
-rw-r--r-- 1 root root  126 Dec 17 11:18 system76-ubuntu-pop-bionic.list.save
mbearup@pop-os:~$ sudo apt-get update -qq
mbearup@pop-os:~$ sudo apt-get install dotnet-sdk-2.2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  aspnetcore-runtime-2.2 dotnet-host dotnet-hostfxr-2.2 dotnet-runtime-2.2 dotnet-runtime-deps-2.2 liblttng-ust-ctl4 liblttng-ust0 liburcu6
The following NEW packages will be installed:
  aspnetcore-runtime-2.2 dotnet-host dotnet-hostfxr-2.2 dotnet-runtime-2.2 dotnet-runtime-deps-2.2 dotnet-sdk-2.2 liblttng-ust-ctl4 liblttng-ust0 liburcu6
0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
Need to get 133 MB of archives.
After this operation, 387 MB of additional disk space will be used.
Do you want to continue? [Y/n]

Same for Hyper-V Quick Create 18.04. The .list file gets created successfully and the dotnet-sdk-2.2 package is discovered. Your responses to the earlier question will be helpful in diagnosing this further.

Same problems here. Using the Ubuntu 18.04.1 LTS that is available through Hyper-V quick create:

~$ apt-cache policy dotnet-sdk-2.2
N: Unable to locate package dotnet-sdk-2.2
N: Couldn't find any package by glob 'dotnet-sdk-2.2'
N: Couldn't find any package by regex 'dotnet-sdk-2.2'

~$ apt-cache policy dotnet-runtime-2.2
N: Unable to locate package dotnet-runtime-2.2
N: Couldn't find any package by glob 'dotnet-runtime-2.2'
N: Couldn't find any package by regex 'dotnet-runtime-2.2'

~$ sudo apt-get install dotnet-runtime-deps-2.2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package dotnet-runtime-deps-2.2
E: Couldn't find any package by glob 'dotnet-runtime-deps-2.2'
E: Couldn't find any package by regex 'dotnet-runtime-deps-2.2'

~$ apt-cache search libicu
icu-devtools - Development utilities for International Components for Unicode
libicu-dev - Development files for International Components for Unicode
libicu-le-hb-dev - ICU Layout Engine API on top of HarfBuzz shaping library (development)
libicu-le-hb0 - ICU Layout Engine API on top of HarfBuzz shaping library
libicu60 - International Components for Unicode
libiculx60 - International Components for Unicode
libicu4j-4.2-java - Library for Unicode support and internationalization
libicu4j-4.4-java - Library for Unicode support and internationalization
libicu4j-49-java - Library for Unicode support and internationalization
libicu4j-java - Library for Unicode support and internationalization
libicu4j-java-doc - Library for Unicode support and internationalization - Docs

$ dpkg -l | grep "packages-microsoft-prod"
ii  packages-microsoft-prod                    1.0-ubuntu18.04.1                   all          Apt configuration for packages.microsoft.com
$ dpkg -L packages-microsoft-prod
/etc
/etc/apt
/etc/apt/sources.list.d
/etc/apt/sources.list.d/microsoft-prod.list
/etc/apt/trusted.gpg.d
/etc/apt/trusted.gpg.d/microsoft-prod.gpg
/usr
/usr/share
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/packages-microsoft-prod
/usr/share/doc
/usr/share/doc/packages-microsoft-prod
/usr/share/doc/packages-microsoft-prod/changelog.Debian.gz
/usr/share/doc/packages-microsoft-prod/copyright


This is truly confusing. I simply cannot repro what you're seeing....

  1. Out of curiosity, could you do a sha256sum of the deb package? I get 54fb378267b8492f697a4d4f4ce3b339da750da00173f154d95701d81399aa6c
  2. Try getting the relevant logs via $ grep "packages-microsoft-prod" /var/log/dpkg.log. The package status is ii which means it's installed successfully, but maybe there's something in the logs?
  3. The only other thing that comes to mind is that the .list and .gpg file are marked as conffiles which get special treatment from dpkg. But that should only come into play for upgrade scenarios. Even then, preinst removes old copies of the files (which I just confirmed), and if preinst was failing then the package would not have ii status. And none of that should impact fresh installs at all.

Here's what I got for the sha:

$ sha256sum packages-microsoft-prod.deb 
54fb378267b8492f697a4d4f4ce3b339da750da00173f154d95701d81399aa6c  packages-microsoft-prod.deb

Here is the last big block of logs in there. Not sure what "half installed" is all about:

2018-12-18 16:19:28 upgrade packages-microsoft-prod:all 1.0-ubuntu18.04.1 1.0-ubuntu18.04.1
2018-12-18 16:19:28 status half-configured packages-microsoft-prod:all 1.0-ubuntu18.04.1
2018-12-18 16:19:28 status unpacked packages-microsoft-prod:all 1.0-ubuntu18.04.1
2018-12-18 16:19:28 status half-installed packages-microsoft-prod:all 1.0-ubuntu18.04.1
2018-12-18 16:19:28 status half-installed packages-microsoft-prod:all 1.0-ubuntu18.04.1
2018-12-18 16:19:28 status unpacked packages-microsoft-prod:all 1.0-ubuntu18.04.1
2018-12-18 16:19:28 status unpacked packages-microsoft-prod:all 1.0-ubuntu18.04.1
2018-12-18 16:19:28 configure packages-microsoft-prod:all 1.0-ubuntu18.04.1 1.0-ubuntu18.04.1
2018-12-18 16:19:28 status unpacked packages-microsoft-prod:all 1.0-ubuntu18.04.1
2018-12-18 16:19:28 status unpacked packages-microsoft-prod:all 1.0-ubuntu18.04.1
2018-12-18 16:19:28 status unpacked packages-microsoft-prod:all 1.0-ubuntu18.04.1
2018-12-18 16:19:28 status half-configured packages-microsoft-prod:all 1.0-ubuntu18.04.1
2018-12-18 16:19:28 status installed packages-microsoft-prod:all 1.0-ubuntu18.04.1
2018-12-18 16:20:17 upgrade packages-microsoft-prod:all 1.0-ubuntu18.04.1 1.0-ubuntu18.04.1
2018-12-18 16:20:17 status half-configured packages-microsoft-prod:all 1.0-ubuntu18.04.1
2018-12-18 16:20:17 status unpacked packages-microsoft-prod:all 1.0-ubuntu18.04.1
2018-12-18 16:20:17 status half-installed packages-microsoft-prod:all 1.0-ubuntu18.04.1
2018-12-18 16:20:17 status half-installed packages-microsoft-prod:all 1.0-ubuntu18.04.1
2018-12-18 16:20:17 status unpacked packages-microsoft-prod:all 1.0-ubuntu18.04.1
2018-12-18 16:20:17 status unpacked packages-microsoft-prod:all 1.0-ubuntu18.04.1
2018-12-18 16:20:17 configure packages-microsoft-prod:all 1.0-ubuntu18.04.1 1.0-ubuntu18.04.1
2018-12-18 16:20:17 status unpacked packages-microsoft-prod:all 1.0-ubuntu18.04.1
2018-12-18 16:20:17 status unpacked packages-microsoft-prod:all 1.0-ubuntu18.04.1
2018-12-18 16:20:17 status unpacked packages-microsoft-prod:all 1.0-ubuntu18.04.1
2018-12-18 16:20:18 status half-configured packages-microsoft-prod:all 1.0-ubuntu18.04.1
2018-12-18 16:20:18 status installed packages-microsoft-prod:all 1.0-ubuntu18.04.1

The SHA256sum matches mine, which is a good sign.
half-installed and half-configured are regular steps for package installation. As long as they get to installed then it should be fine. Also surprised to see upgrade in your logs, but that would happen if you re-installed the package while it was already present.

  1. Is this a fresh install, or a reinstall/upgrade? I've observed that the prerm removes existing versions of the .list and .gpg file. The intent is to remove these files during package removal (since conffiles are only removed by purge). But if this is an upgrade/reinstall (package state at time of install is ii or rc), then the removal by prerm gets tracked by dpkg, and neither file will get recreated (because dpkg thinks you no longer want them there). This is part of dpkg's conffile logic. In this case the fix is for prerm's file removal only to occur during package removal, not during upgrades. This is the only scenario where I can repro what you're seeing, but it wasn't clear from the thread that anyone was re-installing/upgrading the package.
  2. Try sudo dpkg --purge packages-microsoft-prod && sudo dpkg -i packages-microsoft-prod.deb - this will clear out dpkg's state regarding the .list and .gpg file, which should allow them to get installed. I'm not aware of any dpkg options that would prevent conffiles from getting installed.
  3. If purge does not help, try installing the package with gdebi, to determine if this is a bug with dpkg.
    sudo apt-get install gdebi && sudo gdebi --non-interactive packages-microsoft-prod.deb
  4. If all else fails, here's a test package which installs both files as regular files (not conffiles). This violates Debian package standards but would at least help us understand the nature of the issue. The hashsum is 424d938cdd89fa23502ee28600f54e2236c1988c1dfde14030ce912bf3362293
    https://pkgmscom.blob.core.windows.net/public/packages-microsoft-prod_1.0-ubuntu18.04.2_amd64.deb

Please find below

@schotime , while problem related to packages-microsoft-prod.deb has been identified as per this issue. Can you please share below details to further diagnose the issue you are encountering ?

  1. List the feeds runtime package is configured.
    apt-cache policy dotnet-sdk-2.2
schotime@Linux18:~$ apt-cache policy dotnet-sdk-2.2
N: Unable to locate package dotnet-sdk-2.2
N: Couldn't find any package by glob 'dotnet-sdk-2.2'
N: Couldn't find any package by regex 'dotnet-sdk-2.2'

apt-cache policy dotnet-runtime-2.2

schotime@Linux18:~$ apt-cache policy dotnet-runtime-2.2
N: Unable to locate package dotnet-runtime-2.2
N: Couldn't find any package by glob 'dotnet-runtime-2.2'
N: Couldn't find any package by regex 'dotnet-runtime-2.2'
  1. OS details
    cat /etc/os-release
schotime@Linux18:~$ cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.1 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.1 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
  1. List which system package is failing to install
    sudo apt-get install dotnet-runtime-deps-2.2
schotime@Linux18:~$ sudo apt-get install dotnet-runtime-deps-2.2
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package dotnet-runtime-deps-2.2
E: Couldn't find any package by glob 'dotnet-runtime-deps-2.2'
E: Couldn't find any package by regex 'dotnet-runtime-deps-2.2'
  1. List which all libicu packages are available
    apt-cache search libicu
schotime@Linux18:~$ apt-cache search libicu
icu-devtools - Development utilities for International Components for Unicode
libicu-dev - Development files for International Components for Unicode
libicu-le-hb-dev - ICU Layout Engine API on top of HarfBuzz shaping library (development)
libicu-le-hb0 - ICU Layout Engine API on top of HarfBuzz shaping library
libicu60 - International Components for Unicode
libiculx60 - International Components for Unicode
libicu4j-4.2-java - Library for Unicode support and internationalization
libicu4j-4.4-java - Library for Unicode support and internationalization
libicu4j-49-java - Library for Unicode support and internationalization
libicu4j-java - Library for Unicode support and internationalization
libicu4j-java-doc - Library for Unicode support and internationalization - Docs

Update your current OS with Softwar Updater.After update, sudo apt-get install dotnet-sdk-2.2 is OK.

2\. `sudo dpkg --purge packages-microsoft-prod && sudo dpkg -i packages-microsoft-prod.deb`

I had same problem when i wanted to update SDK. I have executed above instruction and then apt source list was successfully loaded when running sudo apt-get update. Then SDK was reachable and SDK was update. thanks a lot !

@mbearup One of your steps worked but I'm not sure which. I forgot to update apt-get after each one so thought they were failing. Eventually, I remembered and the package installed correctly

@Ludogo 's comment worked by purging the packages

  1. Try sudo dpkg --purge packages-microsoft-prod && sudo dpkg -i packages-microsoft-prod.deb - this will clear out dpkg's state regarding the .list and .gpg file, which should allow them to get installed. I'm not aware of any dpkg options that would prevent conffiles from getting installed.

This is what worked for me. Thank you, @mbearup

I had the same issue. Lost all hope, deleted /usr/share/dotnet and followed steps from
https://dotnet.microsoft.com/download/thank-you/dotnet-sdk-2.2.101-linux-x64-binaries
worked like a charm

Sounds like the issues are due to the package upgrade logic I described earlier. A new client package has been published which corrects the prerm logic during upgrade, and recreates the file if it was deleted by prerm.

There's lots of details here - can someone please help me summarize the problem, what needs to happen and where should we route the issue? Or is it ready to be closed?
In this repo it won't get much more traction I am afraid :(

@rakeshsinghranchi can you please help here?

It sounds like we need to update the instructions on https://dotnet.microsoft.com/download/linux-package-manager/ubuntu18-04/sdk-current. We had a 8 people report an issue on that page thru our in site feedback mechanism. Several pointed to this issue as where they found a way to resolve the problem.

@leecow do you know what the change we need to make is?

Looks like this is the key line if folks encounter the issue sudo dpkg --purge packages-microsoft-prod && sudo dpkg -i packages-microsoft-prod.deb.

Certainly isn't needed if you're not having troubles.

I'll add a note to the step to run that command if needed.

@leecow is there a consistent error message that would suggest this command is needed?

No it's a generic "I can't find what you asked for" message. From the o.p. -

sudo apt-get install dotnet-sdk-2.2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package dotnet-sdk-2.2
E: Couldn't find any package by glob 'dotnet-sdk-2.2'
E: Couldn't find any package by regex 'dotnet-sdk-2.2'

Once the user has ensured packages.microsoft.com was properly registered, this step would be worthwhile.

I've only been able to repro the issue during an upgrade scenario. So my best guess is this what users are encountering - when they go to upgrade dotnet they first re-add the repo package which had the undesired effect of removing the repo.

  • As Lee pointed out, sudo dpkg --purge packages-microsoft-prod && sudo dpkg -i packages-microsoft-prod.deb will ensure the package gets installed properly.
  • On January 2nd I published a new client package which resolves this issue on upgrade. If people still see an issue with this new package we can certainly dig deeper.

I'm having what looks like this problem after resetting my WSL/Ubuntu install on Windows 10.

After resetting Ubuntu using the Windows Settings panel, I followed the instructions at https://dotnet.microsoft.com/download/linux-package-manager/ubuntu18-04/sdk-current, which produced the message:

Reading package lists... Done
Building dependency tree
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-2.2 : Depends: aspnetcore-runtime-2.2 (>= 2.2.1) but it is not going to be installed
                  Depends: dotnet-runtime-2.2 (>= 2.2.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I've run the 'fix' line:
sudo dpkg --purge packages-microsoft-prod && sudo dpkg -i packages-microsoft-prod.deb

... but no dice. I still get the same error message.

I was facing a similar issue and it turned out to be something very local to my system. I'm running Linux in a VM and I found out that my host was running out of disk space halfway through the apt-get install dotnet-sdk-2.2 call. As a result the VM force freezed and I had to forcequit it. This released disk space and it seemed like all is fine before I then started the VM and tried again. Upon restarting and retrying the command I ended up with the same issue as everyone else is mentioning here.

It seems that the partial completion of the command leaves things in a funky state as I have reproduced this several times with new VMs. Only when I eventually realized the disk space issue and cleaned up some files I created a brand new VM and everything worked as intended.

I was running into all kinds of installation issues on Ubuntu 18.04. Following the steps in this tutorial - https://www.ntweekly.com/2018/12/25/install-net-core-2-2-on-ubuntu-18-04-linux/ worked like a charm!

@JuliaLid That worked! Thanks so much.

I had to reset my Ubuntu install again though - the instructions at https://www.ntweekly.com/2018/12/25/install-net-core-2-2-on-ubuntu-18-04-linux/ originally failed with the same error message I'd had previously. The only thing I'd run on that reset was the instructions provided earlier in this thread (https://dotnet.microsoft.com/download/linux-package-manager/ubuntu18-04/sdk-current).

To reiterate:
I ran a fresh reset of WSL/Ubuntu from the Settings panel.
I ran the instructions here: https://www.ntweekly.com/2018/12/25/install-net-core-2-2-on-ubuntu-18-04-linux/
Everything works as expected.

If I ran the instructions posted here: https://dotnet.microsoft.com/download/linux-package-manager/ubuntu18-04/sdk-current after a fresh reset, nothing worked afterwards.

I set up WSL with Ubuntu on my machine (which has never had WSL enabled before) and the Microsoft instructions worked fine: no hiccups, and no need to purge and reinstall.

I reset WSL Ubuntu (Searched for Ubuntu in start menu => clicked App settings option => clicked Reset button) and ran the Microsoft steps again, and they worked fine again. 馃槙

From my understanding of what packages-microsoft-prod.deb is doing, the steps on ntweekly.com are basically doing the same thing, but manually:

wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg
sudo mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/
wget -q https://packages.microsoft.com/config/ubuntu/18.04/prod.list
sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list

(gpg --dearmor catches my eye, but I think (based on a few searches) it just changes the key to a binary format ("de-armor") to save on disk space. Also, the ntweekly.com steps don't include sudo add-apt-repository universe, but the message I get when I execute it tells me 'universe' distribution component is already enabled for all sources..)


@goobering I think it would help to gather the info @mbearup listed above to get a fuller picture:

  1. OS (specifically if it is a derivative of Ubuntu, not stock Ubuntu). [Maybe the version listed in the Ubuntu app settings will be related?]
  2. Output of dpkg -l | grep "packages-microsoft-prod"
  3. Output of dpkg -L packages-microsoft-prod
  1. Out of curiosity, could you do a sha256sum of the deb package? I get ~54fb3782...~
    [now bf47049a5838ac6b7f79063b8908727f2ec2a83d95d3da23333bc3c006016583 for me]
  2. Try getting the relevant logs via $ grep "packages-microsoft-prod" /var/log/dpkg.log. The package status is ii which means it's installed successfully, but maybe there's something in the logs?

Still suffering from this issue. Tried every possible solution mentioned, still get the same error. I'm a noob on package managers, but the packages-microsoft-prod.deb packageversion is 1.0-ubuntu18.04.2. But 18.04.2 is due to come in feb 2019. sha256sum is: bf47049a5838ac6b7f79063b8908727f2ec2a83d95d3da23333bc3c006016583 as mentioned above

I had the same issue but ran the commands on the link below* step by step and it worked for me.
https://dotnet.microsoft.com/download/linux-package-manager/ubuntu16-04/runtime-2.0.5

  • on the last command, instead of dotnet-hosting.... , type dotnet-sdk-2.2

@sweetpants, @betocollin, can you please gather the diag info mentioned in this thread? I'd really like to figure out how to fix this, but I can't figure out how to reproduce (or at least understand) what's going wrong.

Also to any future commenters, this is the list of information that I think will be useful to get any additional problems understood:

  1. OS (specifically if it is a derivative of Ubuntu, not stock Ubuntu).
  2. Output of dpkg -l | grep "packages-microsoft-prod"
  3. Output of dpkg -L packages-microsoft-prod
  4. A sha256sum of the deb package.

    • I get bf47049a58...

  5. Relevant logs via $ grep "packages-microsoft-prod" /var/log/dpkg.log.

@sweetpants regarding the package version (18.04.2), it reflects the second release of the client package for 18.04/bionic. We do not release client packages specifically for each 18.04.* release, though I understand how that would be confusing.
As @dagood indicated, answers to those 5 questions will help us determine the cause of your issue. I'm also curious what error you're getting. Unable to install the packages-microsoft-prod.deb package? Unable to find the dotnet package once this is installed?

@dagood , my OS is Ubuntu 16.04 x64 and I'll come back to you later in relation to 2, 3, 4 and 5 points as I don't have access now.

I had the same issue.
In the end it turned out that the machine I had been dealing with was ubuntu 16.04 rather than 18.04.

I've changed /etc/apt/sources.list.d/microsoft-prod.list from

deb [arch=amd64] https://packages.microsoft.com/ubuntu/18.04/prod bionic main
to
deb [arch=amd64] https://packages.microsoft.com/ubuntu/16.04/prod xenial main

and then it worked.

Thanks for the info. The instructions are specific to a distro version, you shouldn't need to manually change the package's files if you use the right one:

https://dotnet.microsoft.com/download/linux-package-manager/ubuntu14-04/sdk-current
https://dotnet.microsoft.com/download/linux-package-manager/ubuntu16-04/sdk-current
https://dotnet.microsoft.com/download/linux-package-manager/ubuntu18-04/sdk-current

@leecow @rowanmiller Do you think a change to the existing note would make a difference? (Adding a bit about "ensure you selected the version of the instructions matching your distro version"?)

I know that for the packages.microsoft.com repos the folders are structured so that you can programmatically determine the correct path. For instance the following works with Ubuntu, would need some refinement to work on more distros.

$ distro=$(cat /etc/lsb-release  | grep "DISTRIB_ID" | cut -d '=' -f 2)
$ version=$(cat /etc/lsb-release  | grep "DISTRIB_RELEASE" | cut -d '=' -f 2)
$ wget https://packages.microsoft.com/config/${distro,,}/${version}/prod.list

Hi @dagood , sorry for the delay in getting back to you.
(For context to other people, read my short comment above - it's working for me).

I'm pretty new to Linux so I hope I've got the commands right but my interpretation of some would be poor from an investigation perspective so I leave them in here in case it helps anyone.

When running:
dpkg -l | grep "packages-microsoft-prod"
I get:
ii packages-microsoft-prod 1.0-3 all Apt configuration for packages.microsoft.com

When running:
dpkg -L packages-microsoft-prod
I get:

/.
/etc
/etc/apt
/etc/apt/sources.list.d
/etc/apt/sources.list.d/microsoft-prod.list
/etc/apt/trusted.gpg.d
/etc/apt/trusted.gpg.d/microsoft-prod.gpg
/usr
/usr/share
/usr/share/doc
/usr/share/doc/packages-microsoft-prod
/usr/share/doc/packages-microsoft-prod/copyright
/usr/share/doc/packages-microsoft-prod/changelog.Debian.gz

When running:
sha256sum "./packages-microsoft-prod.deb"
I get:
1e2a22f9636980a1bfe08a54fe9b08697b9cd72fc562dd6b29f48a612caee3b9 ./packages-microsoft-prod.deb

When running:
grep "packages-microsoft-prod" /var/log/dpkg.log.1
I get:

2019-01-29 18:57:19 install packages-microsoft-prod:all <none> 1.0-3
2019-01-29 18:57:19 status half-installed packages-microsoft-prod:all 1.0-3
2019-01-29 18:57:19 status unpacked packages-microsoft-prod:all 1.0-3
2019-01-29 18:57:19 status unpacked packages-microsoft-prod:all 1.0-3
2019-01-29 18:57:19 configure packages-microsoft-prod:all 1.0-3 1.0-3
2019-01-29 18:57:19 status unpacked packages-microsoft-prod:all 1.0-3
2019-01-29 18:57:19 status half-configured packages-microsoft-prod:all 1.0-3
2019-01-29 18:57:19 status installed packages-microsoft-prod:all 1.0-3
2019-01-29 19:09:28 upgrade packages-microsoft-prod:all 1.0-3 1.0-3
2019-01-29 19:09:28 status half-configured packages-microsoft-prod:all 1.0-3
2019-01-29 19:09:28 status unpacked packages-microsoft-prod:all 1.0-3
2019-01-29 19:09:28 status half-installed packages-microsoft-prod:all 1.0-3
2019-01-29 19:09:28 status half-installed packages-microsoft-prod:all 1.0-3
2019-01-29 19:09:28 status unpacked packages-microsoft-prod:all 1.0-3
2019-01-29 19:09:28 status unpacked packages-microsoft-prod:all 1.0-3
2019-01-29 19:09:28 configure packages-microsoft-prod:all 1.0-3 1.0-3
2019-01-29 19:09:28 status unpacked packages-microsoft-prod:all 1.0-3
2019-01-29 19:09:28 status half-configured packages-microsoft-prod:all 1.0-3
2019-01-29 19:09:28 status installed packages-microsoft-prod:all 1.0-3

@betocollin The link you posted earlier has the correct steps, and it sounds like it's now working for you, is that correct?

The only error I'm currently aware of is that the bootstrap installer (packages-microsoft-prod.deb) had a bug where upgrades/reinstalls would result in the .list file being removed. I suspect that, since the install directions say to install it, people were reinstalling it (even though they already had it) resulting in their experiencing this issue. Not to imply that this is their fault - the package should have "just worked." There is no reason to upgrade the packages-microsoft-prod - it provides no value.

  • This is detectable by checking for the presence of the package with dpkg -l | grep packages-microsoft-prod, and checking for the presence of the file with ls /etc/apt/sources.list.d/microsoft-prod.list. If the package is present but the .list file is not, you have this issue.
  • This is fixable by purging the package (dpkg --purge packages-microsoft-prod) and reinstalling it.
  • It is also fixable by directly installing the .list file into /etc/apt/sources.list.d/
  • It is also fixable by installing the latest version of the client package, which fixes the bug.

If anyone experiences the above issue on a fresh install I would be interested to know more. I have made several attempts in various environments (VMWare, Hyper-V, Azure VM) and am unable to repro on a fresh install.
If anyone experiences a different error, then it probably belongs in a separate thread.

Hey @mbearup . Thanks a lot for this but it's been working fine for me since my first post above.

@dagood had asked me to give him some info that could help investigate the issue so I just added it in here.

Thanks for clarifying, @betocollin. Will wait to see if anyone else is still having issues.

@dagood, @rowanmiller - folks who upgrade their distro in-place (eg 16.04 -> 18.04) after first setting up .NET Core will hit the problem and not necessarily return to https://dotnet.microsoft.com/download/linux-package-manager/. Likely something that we can add to be of help though.

Same issue on latest version of Linux Mint; this solved it: https://github.com/dotnet/core/issues/2149#issuecomment-447323609

I was running into all kinds of installation issues on Ubuntu 18.04. Following the steps in this tutorial - https://www.ntweekly.com/2018/12/25/install-net-core-2-2-on-ubuntu-18-04-linux/ worked like a charm!

worked for me

I ran into a very similar issue this evening - appeared to be this specific issue; but was ultimately my own mistake. I was updating a Dockerfile built with Ubuntu 18.04 and previously had the following (which worked):

apt-get -y install dotnet-sdk-2.2

Replaced it with a larger, multiline list, which broke it:

apt-get -y install && \
    dotnet-sdk-2.2 \
    ...

Muscle memory added those two ampersands when they should NOT have been there! So I can say that dotnet-sdk-2.2 does still install correctly on a fresh Ubuntu 18.04 image.

@dagood any plans with this issue? There is no update for 1 week.
Is there some real problem hiding here? (disclaimer: I didn't read it all)
Should we move it to other repo?

The original problem seems to be fixed, workarounds are published on the download page, and we don't seem to have enough info to investigate any of the new problems being reported. I'm closing this issue.

@leecow I split out https://github.com/dotnet/core/issues/2362 to track/discuss how we can help correct the Microsoft package feed after an in-place distro upgrade.


If anyone runs into this error message again, it would be really helpful if you have time to help us out by gathering this information and submitting a new issue before trying a workaround:

  1. OS (specifically if it is a derivative of Ubuntu, not stock Ubuntu).

    • Note that the instructions are for the x64 CPU Architecture. You won't find packages for others like ARM64 in the package repository right now.

  2. Output of dpkg -l | grep "packages-microsoft-prod"
  3. Output of dpkg -L packages-microsoft-prod
  4. A sha256sum of the deb package.
  5. Relevant logs via $ grep "packages-microsoft-prod" /var/log/dpkg.log.

Sorry for repeating it yet again. 馃槃 Since we're unable to repro new instances of this problem, we're relying on this info to give us a clue where to look.

@dagood , I've tried everything I found. For example:
https://dotnet.microsoft.com/download/linux-package-manager/ubuntu18-04/sdk-current
https://odan.github.io/2018/07/17/aspnet-core-2-ubuntu-setup.html

Still, I ran into the same error message "Unable to locate package".

Not sure if the following information helpful for investigation:

OS:

root@9390f4d887a4:/# cat etc/*release                                                                                                                                                                                                
DISTRIB_ID=Ubuntu                                                                                                                                                                                                                    
DISTRIB_RELEASE=18.04                                                                                                                                                                                                                
DISTRIB_CODENAME=bionic                                                                                                                                                                                                              
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"                                                                                                                                                                                             
NAME="Ubuntu"                                                                                                                                                                                                                        
VERSION="18.04.1 LTS (Bionic Beaver)"                                                                                                                                                                                                
ID=ubuntu                                                                                                                                                                                                                            
ID_LIKE=debian                                                                                                                                                                                                                       
PRETTY_NAME="Ubuntu 18.04.1 LTS"                                                                                                                                                                                                     
VERSION_ID="18.04"                                                                                                                                                                                                                   
HOME_URL="https://www.ubuntu.com/"                                                                                                                                                                                                   
SUPPORT_URL="https://help.ubuntu.com/"                                                                                                                                                                                               
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"                                                                                                                                                                                  
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"                                                                                                                                                  
VERSION_CODENAME=bionic                                                                                                                                                                                                              
UBUNTU_CODENAME=bionic 

Output of dpkg -l | grep "packages-microsoft-prod" :

dpkg -l | grep "packages-microsoft-prod"
ii  packages-microsoft-prod     1.0-ubuntu18.04.2                 all          Apt configuration for packages.microsoft.com

Output of dpkg -L packages-microsoft-prod :

dpkg -L packages-microsoft-prod                                                                                                                                                                                 
/etc                                                                                                                                                                                                                                 
/etc/apt                                                                                                                                                                                                                             
/etc/apt/sources.list.d                                                                                                                                                                                                              
/etc/apt/sources.list.d/microsoft-prod.list                                                                                                                                                                                          
/etc/apt/trusted.gpg.d                                                                                                                                                                                                               
/etc/apt/trusted.gpg.d/microsoft-prod.gpg                                                                                                                                                                                            
/usr                                                                                                                                                                                                                                 
/usr/share                                                                                                                                                                                                                           
/usr/share/doc                                                                                                                                                                                                                       
/usr/share/doc/packages-microsoft-prod                                                                                                                                                                                               
/usr/share/doc/packages-microsoft-prod/changelog.Debian.gz                                                                                                                                                                           
/usr/share/doc/packages-microsoft-prod/copyright                                                                                                                                                                                     
/usr/share/doc/packages-microsoft-prod/microsoft-prod.gpg                                                                                                                                                                            
/usr/share/doc/packages-microsoft-prod/microsoft-prod.list                                                                                                                                                                           
/usr/share/lintian                                                                                                                                                                                                                   
/usr/share/lintian/overrides                                                                                                                                                                                                         
/usr/share/lintian/overrides/packages-microsoft-prod

Installing .NET Core 3.0 preview version is quite easy though.

@huanlin please file a new issue with all info he asked for - see above. Thanks!

@huanlin please file a new issue with all info he asked for - see above. Thanks!

Got it. However, I found installing ASP.NET Core 3 on my Ubuntu 18.04 is quite easy. So I decide to play with ASP.NET Core 3, rather than struggle with .NET Core 2.x.
Thanks

Interesting, looking at the gist you linked, @huanlin, you're on Ubuntu 18.04 ARM64. That would explain why the package manager isn't working for you, it only applies to x64. I didn't even think to ask about arch before, sorry about that.

Check out the table on https://dotnet.microsoft.com/download?initial-os=linux: package manager instructions are only available for x64, but you can see there are SDK binaries available for x64 | ARM32 | ARM64 | x64 Alpine. Those SDK binaries are the same kind of asset the gist describes using. (Although the download page recommends different steps that don't require sudo to do the install.)

@dagood , Thank you for your reply.
My bad. I don't even aware that I was using an ARM64 machine, which is a NAS device running docker container.
And I don't know how you can tell it's ARM64 from my message (it's amazing).
Anyway, according to your suggestion, I found something useful from this document: Installing .NET Core 3.0 on Linux ARM64.
Although it's about .NET Core 3.0, it's still helpful and I eventually installed .NET Core SDK 2.2 (ARM64) on my Ubuntu with the following commands (no, it's not the end of the story):

apt-get wget
wget -q https://download.visualstudio.microsoft.com/download/pr/2b201001-7074-476a-aa83-b5194c660a59/68233f3c3f16c97767a77216ec1f6e70/dotnet-sdk-2.2.104-linux-arm64.tar.gz
mkdir -p /usr/share/dotnet
tar -zxf dotnet-sdk-2.2.104-linux-arm64.tar.gz -C /usr/share/dotnet
ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet

Then, I ran into more problems, and they are resolved by the following commands:

apt-get install libicu-dev
apt-get install libssl1.0.0

Finally, I can use dotnet new console -o app to create a project, but then again, I see this error when I run my dotnet sample program,:
csc.dll code 139 error when building project on .NET Core 2.1.302 Ubuntu 16.04 ARM64

And I see this message from the issue above: "Agree -- given that ARM64 is not supported in 2.2, I think we should close this."

So I think it's time to give up. End of the story.

Thank you for your time!

You can use .NET Core 3.0 previews to install ARM64, that should get you going.

You can use .NET Core 3.0 previews to install ARM64, that should get you going.

Yes, true. I've already done that. I'd say it's quite easy and happy.
Thanks :)

It seems that the packages-microsoft-prod.deb tool doesn't properly handle third-party Bionic-based distributions. I use PopOS! from System76 and I have no issues installing any packages for Bionic.

I copied the list manually and it worked:

wget -q https://packages.microsoft.com/config/ubuntu/18.04/prod.list
sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list
sudo apt update

Thanks for that, you saved my day right there!

Possibly related to #62936 ?
Ubuntu 18.04 here behind a proxy. The packages-microsoft-prod.deb tool produces the microsoft-prod.list in
/etc/apt/sources.list.d/
as expected, but the link refers to https.
Changing it to http like in the above linked issue allowed me to download without issue. The earlier mentioned purging method didn't work for me.

Could be some proxy mojo, but apt-get update works fine with my http and https proxy settings. (apt.conf + export http_proxy, https_proxy)


Note: Installing aspnet runtime, not sdk, but mostly the same issue here.

Also, the linked issue is locked and does not seem to have been resolved

I followed this link on Microsoft page and it worked for me. https://dotnet.microsoft.com/download/linux-package-manager/ubuntu18-04/sdk-current
I guess Ubunutu 18.4 works well with the current stable version(.net 3).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ffes picture ffes  路  3Comments

omerlh picture omerlh  路  4Comments

ugurcemozturk picture ugurcemozturk  路  3Comments

mmacneil picture mmacneil  路  3Comments

Rand-Random picture Rand-Random  路  4Comments