0
votes

Getting mono/nuget to work properly, I can't make it happen on CentOS 6.4 w/ mono.

bash-4.1$ mono buildsupport/NuGet.exe install src/OurApp/packages.config -OutputDirectory src/packages
p1%{8}%<%t33%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;3%;mWARNING: libMonoPosixHelper.so
p1%{8}%<%t37%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;7%;mp1%{8}%<%t31%e%p1%{16}%<%t9%p1    {8}%-%d%e38;5;1%;m
Unable to find version '2.0.2' of package 'EventStore.Client'.

packages.config:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="EventStore.Client" version="2.0.2" targetFramework="net45" />
  <package id="NodaTime" version="1.1.1" targetFramework="net45" />
</packages>

How do you do it?

Appendix info:

-bash-4.1$ mono --version
Mono JIT compiler version 3.2.3 (tarball Mon Sep 30 10:21:16 UTC 2013)
Copyright (C) 2002-2012 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           __thread
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    LLVM:          supported, not enabled.
    GC:            sgen

I have also imported the certificates:

  Exec {
    user    => 'root',
    path    => '/usr/bin:/bin',
    require => [
      Anchor['mono::start'],
      Package['mono']
    ],
    before  => Anchor['mono::end'],
  }

  # http://www.mono-project.com/FAQ:_Security
  exec {
    'yes | certmgr -ssl -m https://nuget.org && touch /etc/.certs-nuget.org':
      creates => '/etc/.certs-nuget.org';
    'yes | certmgr -ssl -m https://packages.nuget.org/v1/FeedService.svc/ && touch /etc/.certs-packages.nuget.org':
      creates => '/etc/.certs-packages.nuget.org';
    'yes | certmgr -ssl -m https://go.microsoft.com && touch /etc/.certs-go.microsoft.com':
      creates => '/etc/.certs-go.microsoft.com';
    'yes | certmgr -ssl -m https://nugetgallery.blob.core.windows.net && touch /etc/.certs-nugetgallery.blob.core.windows.net':
      creates => '/etc/.certs-nugetgallery.blob.core.windows.net';
  }

About the NuGet.exe file

-bash-4.1$ mono buildsupport/NuGet.exe 
NuGet Version: 2.7.41115.310
usage: NuGet <command> [args] [options] 
Type 'NuGet help <command>' for help on a specific command.

Available commands:

[snip]

~/.config/NuGet/NuGet.config

<configuration>
  <packageSources>
      <add key="https://nuget.org/api/v2/" value="https://nuget.org/api/v2/" />
      <add key="https://www.nuget.org/api/v2/" value="https://www.nuget.org/api/v2/" />
  </packageSources>
  <disabledPackageSources>
      <add key="https://www.nuget.org/api/v2/" value="true" />
  </disabledPackageSources>
</configuration>

I've run:

# mozroots --import --sync
$ mozroots --import --sync
# mozroots --import --sync --machine

At a loss right now. Any help greatly appreciated.


EDIT 2:

Another try with explicit '-Source nuget':

-bash-4.1$ mono buildsupport/NuGet.exe install src/OurApp/packages.config -Source nuget
p1%{8}%<%t31%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;1%;mlibMonoPosixHelper.so
p1%{8}%<%t37%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;7%;m-bash-4.1$ echo $?
1

With config:

<packageSources>
  <add key="nuget" value="http://nuget.org/api/v2/" />

EDIT 3:

While playing around, I was running tcpdump like was suggested:

[root@tc ~]# tcpdump -c 10000 -s 0 -i eth0 -A tcp port http
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
19:28:08.560782 IP 10.0.2.15.33636 > 65.52.233.252.http: Flags [S], seq 832564500, win 14600, options [mss 1460,sackOK,TS val 44192757 ecr 0,nop,wscale 5], length 0
E..<..@[email protected].
...A4...d.P1.........9............
..S.........
19:28:08.682894 IP 65.52.233.252.http > 10.0.2.15.33636: Flags [S.], seq 1247496705, ack 832564501, win 65535, options [mss 1460], length 0
E..,[[email protected]..
....P.dJ[J.1...`...*.........
19:28:08.682933 IP 10.0.2.15.33636 > 65.52.233.252.http: Flags [.], ack 1, win 14600, length 0
E..(..@[email protected].
...A4...d.P1...J[J.P.9.....
19:28:08.689440 IP 10.0.2.15.33636 > 65.52.233.252.http: Flags [P.], seq 1:94, ack 1, win 14600, length 93
E.....@[email protected]
...A4...d.P1...J[J.P.9.7...GET /api/v2/ HTTP/1.0
User-Agent: NuGet/2.7.41115.310 (Unix 2.6.32.358)
Host: nuget.org


19:28:08.689633 IP 65.52.233.252.http > 10.0.2.15.33636: Flags [.], ack 94, win 65535, length 0
E..([[email protected]..
....P.dJ[J.1..rP...Aq........
19:28:08.812013 IP 65.52.233.252.http > 10.0.2.15.33636: Flags [P.], seq 1:545, ack 94, win 65535, length 544
E..H[[email protected]..
....P.dJ[J.1..rP.......HTTP/1.1 301 Moved Permanently
Content-Type: text/html; charset=UTF-8
Location: http://www.nuget.org/api/v2/
Server: Microsoft-IIS/8.0
X-Powered-By: ASP.NET
X-Frame-Options: deny
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Strict-Transport-Security: maxage=31536000; includeSubDomains
Date: Tue, 26 Nov 2013 19:28:08 GMT
Connection: close
Content-Length: 151

<head><title>Document Moved</title></head>
<body><h1>Object Moved</h1>This document may be found <a HREF="http://www.nuget.org/api/v2/">here</a></body>
19:28:08.812063 IP 10.0.2.15.33636 > 65.52.233.252.http: Flags [.], ack 545, win 15232, length 0
E..(..@[email protected].
...A4...d.P1..rJ[L"P.;.....
19:28:08.812132 IP 65.52.233.252.http > 10.0.2.15.33636: Flags [F.], seq 545, ack 94, win 65535, length 0
E..([[email protected]..
....P.dJ[L"1..rP...?P........
19:28:08.818738 IP 10.0.2.15.33636 > 65.52.233.252.http: Flags [F.], seq 94, ack 546, win 15232, length 0
E..(..@[email protected].
...A4...d.P1..rJ[L#P.;.....
19:28:08.818996 IP 65.52.233.252.http > 10.0.2.15.33636: Flags [.], ack 95, win 65535, length 0
E..([[email protected]..
....P.dJ[L#1..sP...?O........
19:28:08.828885 IP 10.0.2.15.33637 > 65.52.233.252.http: Flags [S], seq 1326131624, win 14600, options [mss 1460,sackOK,TS val 44193026 ecr 0,nop,wscale 5], length 0
E..<|.@.@...
...A4...e.PO.).......9............
..U.........
19:28:08.956672 IP 65.52.233.252.http > 10.0.2.15.33637: Flags [S.], seq 1247560705, ack 1326131625, win 65535, options [mss 1460], length 0
E..,[[email protected]..
....P.eJ\D.O.).`.............
19:28:08.956727 IP 10.0.2.15.33637 > 65.52.233.252.http: Flags [.], ack 1, win 14600, length 0
E..(|.@.@...
...A4...e.PO.).J\D.P.9.....
19:28:08.957092 IP 10.0.2.15.33637 > 65.52.233.252.http: Flags [P.], seq 1:98, ack 1, win 14600, length 97
E...|.@.@...
...A4...e.PO.).J\D.P.9.7...GET /api/v2/ HTTP/1.0
User-Agent: NuGet/2.7.41115.310 (Unix 2.6.32.358)
Host: www.nuget.org


19:28:08.957319 IP 65.52.233.252.http > 10.0.2.15.33637: Flags [.], ack 98, win 65535, length 0
E..([[email protected]..
....P.eJ\D.O.*
P....k........
19:28:09.088644 IP 65.52.233.252.http > 10.0.2.15.33637: Flags [P.], seq 1:759, ack 98, win 65535, length 758
E...[[email protected]..
....P.eJ\D.O.*
P...y...HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Length: 302
Content-Type: application/xml;charset=utf-8
Server: Microsoft-IIS/8.0
X-Content-Type-Options: nosniff
DataServiceVersion: 1.0;
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Frame-Options: deny
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Strict-Transport-Security: maxage=31536000; includeSubDomains
Date: Tue, 26 Nov 2013 19:28:08 GMT
Connection: close

<?xml version="1.0" encoding="utf-8"?><service xml:base="http://www.nuget.org/api/v2/" xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom"><workspace><atom:title>Default</atom:title><collection href="Packages"><atom:title>Packages</atom:title></collection></workspace></service>
19:28:09.088684 IP 10.0.2.15.33637 > 65.52.233.252.http: Flags [.], ack 759, win 15918, length 0
E..(|.@.@...
...A4...e.PO.*
J\F.P.>..G..
19:28:09.088745 IP 65.52.233.252.http > 10.0.2.15.33637: Flags [F.], seq 759, ack 98, win 65535, length 0
E..([[email protected]..
....P.eJ\F.O.*
P....t........
19:28:09.089109 IP 10.0.2.15.33637 > 65.52.233.252.http: Flags [F.], seq 98, ack 760, win 15918, length 0
E..(|.@.@...
...A4...e.PO.*
J\F.P.>..E..
19:28:09.089246 IP 65.52.233.252.http > 10.0.2.15.33637: Flags [.], ack 99, win 65535, length 0
E..([[email protected]..
....P.eJ\F.O.*.P....s........
19:28:09.182818 IP 10.0.2.15.33638 > 65.52.233.252.http: Flags [S], seq 3627833592, win 14600, options [mss 1460,sackOK,TS val 44193380 ecr 0,nop,wscale 5], length 0
E..<..@.@...
...A4...f.P.<X.......9............
..Vd........
19:28:09.308623 IP 65.52.233.252.http > 10.0.2.15.33638: Flags [S.], seq 1247688705, ack 3627833593, win 65535, options [mss 1460], length 0
E..,[[email protected]..
....P.fJ^8..<X.`...).........
19:28:09.308676 IP 10.0.2.15.33638 > 65.52.233.252.http: Flags [.], ack 1, win 14600, length 0
E..(..@.@...
...A4...f.P.<X.J^8.P.9..@..
19:28:09.308972 IP 10.0.2.15.33638 > 65.52.233.252.http: Flags [P.], seq 1:333, ack 1, win 14600, length 332
E..t..@.@...
...A4...f.P.<X.J^8.P.9.8...GET /api/v2/Packages(Id=%27EventStore.Client%27,Version=%272.0.2%27) HTTP/1.1
DataServiceVersion: 1.0;NetFx
MaxDataServiceVersion: 2.0;NetFx
User-Agent: NuGet Command Line/2.7.41115.310 (Unix 2.6.32.358)
Accept: application/atom+xml,application/xml
Accept-Charset: UTF-8
Host: www.nuget.org
Accept-Encoding: gzip, deflate


19:28:09.309151 IP 65.52.233.252.http > 10.0.2.15.33638: Flags [.], ack 333, win 65535, length 0
E..([[email protected]..
....P.fJ^8..<ZEP...?.........
19:28:09.461263 IP 65.52.233.252.http > 10.0.2.15.33638: Flags [.], seq 1:1421, ack 333, win 65535, length 1420
E...[[email protected]..
....P.fJ^8..<ZEP...}...HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Type: application/atom+xml;type=entry;charset=utf-8
Content-Encoding: gzip
Vary: Accept-Encoding
Server: Microsoft-IIS/8.0
X-Content-Type-Options: nosniff
DataServiceVersion: 2.0;
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Frame-Options: deny
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Strict-Transport-Security: maxage=31536000; includeSubDomains
Date: Tue, 26 Nov 2013 19:28:09 GMT
Content-Length: 1302

.............`.I.%&/m.{.J.J..t...`[email protected]#).*..eVe]f.@......{....{....;.N'...?\fd.l..J...!....?~|.?".....ez..MQ-?.hw..Q./...X^|...=.>...8z./..:...&Y.....mW......./..y;.......{.w.#.[6A..{.bog.....Zh.G3.....E..........O...lV...ww......./.i...._........GG............o....:.}...%Q.u[....,...G?...xo.3.........4k...h..5!.b.y.~..e^_..r.Y....G)c.h...~ ....=z\...i...}......-...v.....g......w....zEP..]..Q...w....f.Xd.....]....zE..gG{;...ww..>}.{....G.;?.....q.n.U}.x.-r.,....._>...>.k....^...7K....eV..u"..Z..H...VeA.N....X...S;.Q.ZI.w{........U]...-.......s.-..u..w/.z...........E.O..u]\..#.[J...M..K.+....x..1C.....t..?.O....2.;..;{ovw..<|....s...{..4_...)...}.~...i][email protected].<.2y...g.yU.-}..9NI..C..2m.u=.....g...".z.I.sn...B..:=..E..F3..E...C..a.$..eYe..jM.|r.-.{{......S~.o.7U.<%MT..Wu.WC.'....v...?#...
[email protected].&....*.l..Q[.s~/l,..O..\.y..Mp./    ..uN......9..F...x.y..X......$...X.f.^.'e....
19:28:09.461298 IP 10.0.2.15.33638 > 65.52.233.252.http: Flags [.], ack 1421, win 17040, length 0
E..(..@.@...
...A4...f.P.<ZEJ^=.P.B.....
19:28:09.461338 IP 65.52.233.252.http > 10.0.2.15.33638: Flags [P.], seq 1421:1449, ack 333, win 65535, length 28
E..D[[email protected]..
....P.fJ^=..<ZEP...,'..;.7......f~...O.....n....]..
19:28:09.461344 IP 10.0.2.15.33638 > 65.52.233.252.http: Flags [.], ack 1449, win 17040, length 0
E..(..@.@...
...A4...f.P.<ZEJ^=.P.B.....
19:28:09.461579 IP 65.52.233.252.http > 10.0.2.15.33638: Flags [P.], seq 1449:1804, ack 333, win 65535, length 355
E...[[email protected]..
....P.fJ^=..<ZEP....9...}....o_._,..O..z...p~..r.6[|g.}...O.~.....&u..{...w~...........xyvr..u1.<......S......lN...G..}|..y#..{.5 _..#.=.|.]4..a.b_.P.J..9.h..}....Z....E..:i.....y...dP...>..#....T.$w...Qs..&i.....1.xo:8/......O..m......T.t../..k...Z...T}}...9...  ...
19:28:09.461587 IP 10.0.2.15.33638 > 65.52.233.252.http: Flags [.], ack 1804, win 19880, length 0
E..(..@.@...
P.M..H..f.P.<ZEJ^?
19:28:09.463985 IP 10.0.2.15.33638 > 65.52.233.252.http: Flags [R.], seq 333, ack 1804, win 19880, length 0
E..(..@.@...
P.M..D..f.P.<ZEJ^?


wire^C
32 packets captured
34 packets received by filter

Same error. Then I ran it again a couple of minutes later:

-bash-4.1$ mono buildsupport/NuGet.exe  install src/OurApp/packages.config -Source nuget
Installing 'EventStore.Client 2.0.2'.
Successfully installed 'EventStore.Client 2.0.2'.
Installing 'NodaTime 1.1.1'.
Successfully installed 'NodaTime 1.1.1'.

This time tcpdump said:

[root@tc ~]# tcpdump -c 10000 -s 0 -i eth0 -A tcp port http -w nuget.pcap
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
^C1586 packets captured
1787 packets received by filter
201 packets dropped by kernel

So now I have a ASCII-representation of when it doesn't work (unfortunately the final reply was gzipped as you can read from the dump above, so I installed wireshark that can read pcap files and ungzip it), and a pcap of when it works...

What was the difference...? I uninstalled wireshark to make sure it wasn't that, but it's still working now... Hmm, maybe this tweet was the difference?

1
What is your ~/.config/NuGet/NuGet.config file? Might also be worth switching to the non-ssl NuGet feed - nuget.org/api/v2 and then snoop the network traffic to see what is being sent to NuGet. You could also try specifying the -Source parameter so NuGet.exe will definitely be using the nuget.org feed. - Matt Ward
I added the NuGet.config file as I found it on disk. - Henrik
The NuGet.config file defines where NuGet.exe will go to to find NuGet packages by default. So that is why I wondered what was in that file. - Matt Ward
I edited after writing the initial comment. There was such a file around, see updated thread at stackoverflow. - Henrik
Sorry, I misunderstood what you meant by "added NuGet.config file". The NuGet.config looks like it should work. I would try explicitly passing nuget.org/api/v2 as the -Source parameter to NuGet.exe. Then see if you can switch to the non-SSL version nuget.org/api/v2 and see if you can snoop the network traffic. - Matt Ward

1 Answers

1
votes

On an Ubuntu trusty/14.04 using Mono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-4ubuntu1)

I was getting the same error and found it was due to the version of Nuget.exe

3.3.0.212 was failing but a older version 2.8.1.0 was working fine.

Also updating to nuget version via:

nuget.exe update -self

updated my nuget.exe to 3.4.4-rtm-final which caused a different problem.

So the my solution for me was to use an older nuget.exe.