54

I'm trying to run NuGet on Linux (Ubuntu 12). I have Mono 3.0.6 (compiled from source).

$ mono --runtime=v4.0.30319 .nuget/NuGet.exe update -self
Checking for updates from https://nuget.org/api/v2/.
Error getting response stream (Write: The authentication or decryption has failed.): SendFailure

The error is due to some certificate (the nuget.org one most likely) not being trusted, I gather. This blog post has more details.

So I've run:

$ mozroots --import --sync
$ certmgr -ssl https://go.microsoft.com
$ certmgr -ssl https://nugetgallery.blob.core.windows.net
$ certmgr -ssl https://nuget.org

... to no avail.

NuGet Version is 2.3.0.0 (although I started out with some older version that also did not work either).

How can I fix this error?

Scott Weldon
  • 9,673
  • 6
  • 48
  • 67
friism
  • 19,068
  • 5
  • 80
  • 116

1 Answers1

112

I was able to get this working by importing the certificates into the machine store and not the user store, which is the default:

$ sudo mozroots --import --machine --sync
$ sudo certmgr -ssl -m https://go.microsoft.com
$ sudo certmgr -ssl -m https://nugetgallery.blob.core.windows.net
$ sudo certmgr -ssl -m https://nuget.org

I verified that before I did this — even after having done the original user store-based commands — the tlstest.exe tool failed, and after importing into the machine store it succeeded.

And, most important to me of course, nuget started working then too. :)

Aaron Lerch
  • 1,981
  • 1
  • 16
  • 17
  • If you get an error on the first command - please see this answer: http://askubuntu.com/questions/331519/mozroots-command-fails-with-unsupported-hash-error – Sergiy Belozorov Sep 25 '13 at 10:36
  • Thanks, this helped me get nuget working on cloud9. :-) – Jonathan DeMarks Aug 15 '14 at 12:03
  • This helped me to install OmniSharp (for Mono) on Ubuntu 14.04/Trusty, which otherwise fails with an obtuse error.... – EdwardG Dec 11 '14 at 18:17
  • @EdwardGarson glad to hear it! if appropriate, you could post the error message here to give this answer some more google-fu – Aaron Lerch Dec 12 '14 at 04:12
  • 1
    @AaronLerch you are right: [...].nuget/NuGet.targets: error : Command 'mono --runtime=v4.0.30319 [...]/NuGet.exe install "packages.config" -source "" -o "/opt/OmniSharpServer/packages"' exited with code: 1. – EdwardG Dec 13 '14 at 22:12
  • First command fails with: Downloading from 'http://mxr.mozilla.org/seamonkey/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1'... Couldn't retrieve the file using the supplied information. – trampster May 07 '15 at 03:05
  • 4
    When running the last command, the output ends with: "*** WARNING: Certificate signature is INVALID *** Import this certificate into the CA store ?". Is this normal? This is a bit scary. – John Smith Optional May 12 '15 at 09:18
  • First command failed for me too, but I did a `nuget restore` afterwards and it worked like a charm. – Eric Fossum Jul 27 '16 at 00:04
  • mozroots is deprecated now - can we get an updated fix? – Dagrooms Jun 06 '17 at 17:30
  • I don't use mono or .NET anymore, so I'm not equipped to update it. Hopefully someone else solves any current problems and can either update my answer or add a new one. – Aaron Lerch Jul 18 '17 at 19:27