runtime: dotnet restore fails

@tristan957 commented on Wed Jun 06 2018

These are the errors I received after running dotnet-sdk.dotnet restore:

/snap/dotnet-sdk/18/sdk/2.1.300/NuGet.targets(114,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [/home/tristan957/Projects/full-stack-forum/full-stack-forum.csproj]
/snap/dotnet-sdk/18/sdk/2.1.300/NuGet.targets(114,5): error :   The SSL connection could not be established, see inner exception. [/home/tristan957/Projects/full-stack-forum/full-stack-forum.csproj]
/snap/dotnet-sdk/18/sdk/2.1.300/NuGet.targets(114,5): error :   The remote certificate is invalid according to the validation procedure. [/home/tristan957/Projects/full-stack-forum/full-stack-forum.csproj]

This was after I ran dotnet-sdk.dotnet new reactredux


@leecow commented on Thu Jun 07 2018

Hi @tristan957 - This is an issue on a few distros that I haven’t gotten to the bottom of yet. Let me shake some bushes around here and figure out what conditions can lead to the errors.


@tristan957 commented on Thu Jun 07 2018

Sorry if this is a duplicate. Thanks for the response. Let me know if I can provide you with any information


@leecow commented on Thu Jun 07 2018

Don’t know yet if it’s related but found this - https://github.com/dotnet/corefx/issues/29942


@Petermarcu commented on Tue Jun 12 2018

@leecow should we move this to the nuget repo to track it to start?


@leecow commented on Wed Jun 20 2018

Chasing another issue has lead me to a possible solution for this one 😉 Looks like this is related to the switch to SocketsHttpHandler (see the 2.1 Preview 2 blog post).

@tristan957 - I was able to get restore working on my Solus box by first running export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0. Once I did that, dotnet restore worked.


@tristan957 commented on Thu Jun 21 2018

Interesting. Is there something special about Solus that I should bring up to my distro maintainers, or is this solely a .NET Core issue? Would I experience this issue on other distros?


@leecow commented on Thu Jun 21 2018

I think it may have more to do with Ubuntu Core which is the root of the Snap environment where snaps really run. Still need to poke around a bit more.


@tristan957 commented on Thu Jun 21 2018

No rush. If you need me to test things on my end, let me know

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (7 by maintainers)

Most upvoted comments

@tristan957 - We’ve finally gotten to the bottom of this (thanks to @bartonjs ). There’s a bit of openssl which has been dormant forever which we are tripping over in some scenarios and we’re working through the best fix. In the meantime, you can workaround this by setting the SSL_CERT_FILE to the host OS cert. Setting it to the Snap subsystem also works but that feels funny to me.

export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
export SSL_CERT_DIR=/dev/null

@tristan957 - We’ve finally gotten to the bottom of this (thanks to @bartonjs ). There’s a bit of openssl which has been dormant forever which we are tripping over in some scenarios and we’re working through the best fix. In the meantime, you can workaround this by setting the SSL_CERT_FILE to the host OS cert. Setting it to the Snap subsystem also works but that feels funny to me.

export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
export SSL_CERT_DIR=/dev/null

I am just now encountering these certificate errors on a new install of .NET 2.2 SDK on Ubuntu 19.04. The above resolved my issues - thank you!

@mclang - setting a couple environment variables as noted up in the thread should get you unblocked. We thought we had this one fixed but apparently not. For anyone else reading along, the cert location is distro-specific. The below value is good for Solus.

export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
export SSL_CERT_DIR=/dev/null

I am running Solus on two machines.

I tried to use snap package but it gave following error:

/snap/dotnet-sdk/25/sdk/2.2.100/NuGet.targets(114,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [/home/<user>/Projects/dotnet-core-test/dotnet-core-test.fsproj]
/snap/dotnet-sdk/25/sdk/2.2.100/NuGet.targets(114,5): error :   The SSL connection could not be established, see inner exception. [/home/<user>/Projects/dotnet-core-test/dotnet-core-test.fsproj]
/snap/dotnet-sdk/25/sdk/2.2.100/NuGet.targets(114,5): error :   The remote certificate is invalid according to the validation procedure. [/home/<user>/Projects/dotnet-core-test/dotnet-core-test.fsproj]

I did manual installation using .NET Core 2.2.0 SDK Binary and got dotnet new and dotnet restore working on my Solus Budgie PC, but not on the Solus Plasma laptop.

After doing export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0 on the laptop, dotnet restore started to work also in that computer.

Maybe this helps you to solve the issue. I can provide more information if needed, provided you tell me how to get it.