Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

kpm restore fails to restore System.Console: "The specified archive is invalid" #242

Closed
akoeplinger opened this issue May 25, 2014 · 5 comments

Comments

@akoeplinger
Copy link
Contributor

While testing the new kvmsetup script from dotnet/aspnetcore#48 on Ubuntu 14.04 with latest Mono master I got the following exception:

alexander@ubuntu-desktop:~/dev/Home/samples/ConsoleApp$ kpm restore
Restoring packages for /home/alexander/dev/Home/samples/ConsoleApp/project.json
Attempting to resolve dependency ConsoleApp >= 1.0.0
Attempting to resolve dependency System.Console >= 4.0.0.0
  GET https://www.myget.org/F/aspnetvnext/FindPackagesById()?Id='System.Console'
  GET https://nuget.org/api/v2/FindPackagesById()?Id='System.Console'
Attempting to resolve dependency mscorlib >= 
Attempting to resolve dependency System >= 
Attempting to resolve dependency System.Core >= 
Attempting to resolve dependency Microsoft.CSharp >= 
Attempting to resolve dependency ConsoleApp >= 1.0.0
Attempting to resolve dependency System.Console >= 4.0.0.0
  OK https://nuget.org/api/v2/FindPackagesById()?Id='System.Console' 1649ms
  OK https://www.myget.org/F/aspnetvnext/FindPackagesById()?Id='System.Console' 1886ms
  GET https://www.myget.org/F/aspnetvnext/api/v2/package/System.Console/4.0.0.0
  OK https://www.myget.org/F/aspnetvnext/api/v2/package/System.Console/4.0.0.0 715ms
----------
System.AggregateException:  ---> System.IO.FileFormatException: The specified archive is invalid.
  at System.IO.Packaging.Package.OpenCore (System.IO.Stream stream, FileMode packageMode, FileAccess packageAccess, Boolean ownsStream) [0x00000] in <filename unknown>:0 
  at System.IO.Packaging.Package.Open (System.IO.Stream stream, FileMode packageMode, FileAccess packageAccess, Boolean ownsStream) [0x00000] in <filename unknown>:0 
  at System.IO.Packaging.Package.Open (System.IO.Stream stream, FileMode packageMode, FileAccess packageAccess) [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.PackageManager.Restore.NuGet.PackageFeed+<OpenNuspecStreamAsync>d__1.MoveNext () [0x00000] in <filename unknown>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.PackageManager.RemoteWalkProvider+<GetDependencies>d__1.MoveNext () [0x00000] in <filename unknown>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.PackageManager.RestoreOperations+<FindLibraryEntry>d__1.MoveNext () [0x00000] in <filename unknown>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.PackageManager.RestoreOperations+<CreateGraphNode>d__1.MoveNext () [0x00000] in <filename unknown>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.PackageManager.RestoreOperations+<CreateGraphNode>d__1.MoveNext () [0x00000] in <filename unknown>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.PackageManager.RestoreCommand+<RestoreForProject>d__1.MoveNext () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Threading.Tasks.Task.Wait (Int32 millisecondsTimeout, CancellationToken cancellationToken) [0x00000] in <filename unknown>:0 
  at System.Threading.Tasks.Task.Wait () [0x00000] in <filename unknown>:0 
  at System.Threading.Tasks.Task`1[System.Boolean].get_Result () [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.PackageManager.RestoreCommand.ExecuteCommand () [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.PackageManager.Program+<>c__DisplayClass1.<Main>b__8 () [0x00000] in <filename unknown>:0 
 --> (Inner exception 0) System.IO.FileFormatException: The specified archive is invalid.
  at System.IO.Packaging.Package.OpenCore (System.IO.Stream stream, FileMode packageMode, FileAccess packageAccess, Boolean ownsStream) [0x00000] in <filename unknown>:0 
  at System.IO.Packaging.Package.Open (System.IO.Stream stream, FileMode packageMode, FileAccess packageAccess, Boolean ownsStream) [0x00000] in <filename unknown>:0 
  at System.IO.Packaging.Package.Open (System.IO.Stream stream, FileMode packageMode, FileAccess packageAccess) [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.PackageManager.Restore.NuGet.PackageFeed+<OpenNuspecStreamAsync>d__1.MoveNext () [0x00000] in <filename unknown>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.PackageManager.RemoteWalkProvider+<GetDependencies>d__1.MoveNext () [0x00000] in <filename unknown>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
  at System.Runtime.Co
@akoeplinger
Copy link
Contributor Author

This was a problem with how I built/setup Mono. It couldn't find libMonoPosixHelper.so when unzipping the nupkg. Workaround was specifiying LD_LIBRARY_PATH=/usr/local/lib.

@mgutz
Copy link

mgutz commented Jun 20, 2014

I'm having same issue, setting LD_LIBRARY_PATH didn't help on OS X Mavericks. kpm restores spits out the same errors.

@davidfowl
Copy link
Member

@mgutz did you set it to the right path?

@mgutz
Copy link

mgutz commented Jun 20, 2014

Since you phrased it that way, I had to triple check. You were right. find -iname "linuxMono*" was the prefix directory

I built to ~/.local/mono-HEAD so I had to prefix all commands, I thought it needed to be set for make

LD_LIBRARY_PATH=~/.local/mono-HEAD/lib:$LD_LIBRARY_PATH kpm restore
LD_LIBRARY_PATH=~/.local/mono-HEAD/lib:$LD_LIBRARY_PATH k run

@akoeplinger
Copy link
Contributor Author

FYI we have a pull request pending that will make the workaround unnecessary: mono/mono#1064

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants