boxstarter icon indicating copy to clipboard operation
boxstarter copied to clipboard

Invoke-BoxstarterBuild errors out with "Can not access a closed Stream"

Open seanamosw opened this issue 8 years ago • 14 comments

I have a package I am trying to create with a few files, some large (50mb).

New-BoxstarterPackage -Name MyPackage -Description "MyDescription" -Path "c:\files"
A new Chocolatey package has been created at C:\Users\sean.amos\AppData\Roaming\Boxstarter\BuildPackages\MyPackage.
You may now edit the files in this package and build the final .nupkg using Invoke-BoxstarterBuild.

Invoke-BoxstarterBuild MyPackage
Invoke-Command : Exception calling "Run" with "1" argument(s): "Can not access a closed Stream."
At C:\Users\sean.amos\AppData\Roaming\Boxstarter\Boxstarter.Common\Enter-DotNet4.ps1:38 char:9
+         Invoke-Command -ScriptBlock $ScriptBlock -argumentlist $Argum ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Invoke-Command], MethodInvocationException
    + FullyQualifiedErrorId : ObjectDisposedException,Microsoft.PowerShell.Commands.InvokeCommandCommand

It seems to be the call in the chocolatey wrapper invoke-chocolatey.ps1 that is blowing up, _choco.RunConsole(args);

seanamosw avatar Oct 18 '16 17:10 seanamosw

@seanamosw is this still an issue?

pauby avatar Mar 18 '19 21:03 pauby

I have encountered the same issue today when I include a SQL database of 190MB in a package dependency folder.

aaronralls avatar Mar 22 '19 14:03 aaronralls

@aaronralls Just to be clear, that 190MB is inside the package or the package has a dependency on that 190MB package?

pauby avatar Mar 22 '19 14:03 pauby

I have a dependency folder where I keep other items that need to get installed or supporting scripts. One of the items is a SQL Server database backup. That file is 190MB and I had the same issue with a smaller database base backup of 93MB. The largest file in that folder that did not have an issue was 5.6MB.

aaronralls avatar Mar 22 '19 15:03 aaronralls

To be clear I am trying to include the database backups as part of the package.

aaronralls avatar Mar 22 '19 15:03 aaronralls

@aaronralls I need the Boxstarter log for this. I can't reproduce.

pauby avatar Apr 24 '19 11:04 pauby

Got this today while trying to include a 73MB zip file. Log attached. Below is the output that was not in the log.

Retrying this with a much smaller 2K file worked just fine.

PS C:\Users\rpresser> Invoke-BoxStarterBuild -name ARI.teamcityagent -Verbose
VERBOSE: Loading module from path 'C:\ProgramData\Boxstarter\Boxstarter.chocolatey\Boxstarter.chocolatey.psd1'.
VERBOSE: Importing function 'Enable-BoxstarterClientRemoting'.
VERBOSE: Importing function 'Enable-BoxstarterCredSSP'.
VERBOSE: Importing function 'Export-BoxstarterVars'.
VERBOSE: Importing function 'Get-BoxStarterConfig'.
VERBOSE: Importing function 'Get-PackageRoot'.
VERBOSE: Importing function 'Install-BoxstarterPackage'.
VERBOSE: Importing function 'Install-ChocolateyInstallPackageOverride'.
VERBOSE: Importing function 'Invoke-BoxStarterBuild'.
VERBOSE: Importing function 'Invoke-BoxstarterFromTask'.
VERBOSE: Importing function 'Invoke-Chocolatey'.
VERBOSE: Importing function 'Invoke-ChocolateyBoxstarter'.
VERBOSE: Importing function 'New-BoxstarterPackage'.
VERBOSE: Importing function 'New-PackageFromScript'.
VERBOSE: Importing function 'Resolve-VMPlugin'.
VERBOSE: Importing function 'Set-BoxStarterConfig'.
VERBOSE: Importing function 'Set-BoxstarterShare'.
VERBOSE: Importing function 'Write-HostOverride'.
VERBOSE: Importing alias 'Enable-BoxstarterVM'.
VERBOSE: Importing alias 'Install-ChocolateyInstallPackage'.
VERBOSE: Importing alias 'Write-Host'.
Attempting to build package from 'ARI.teamcityagent.nuspec'.
tools\instantclient-basic-windows.x64-12.2.0.1.0.zip
Invoke-Command : Exception calling "Run" with "1" argument(s): "Can not access a closed Stream."
At C:\ProgramData\Boxstarter\Boxstarter.Common\Enter-DotNet4.ps1:38 char:9
+         Invoke-Command -ScriptBlock $ScriptBlock -argumentlist $Argum ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Invoke-Command], MethodInvocationException
    + FullyQualifiedErrorId : ObjectDisposedException,Microsoft.PowerShell.Commands.InvokeCommandCommand
PS C:\Users\rpresser>

boxstarter.log

rpresser avatar Oct 17 '19 15:10 rpresser

Hi, I am new to Boxstarter and I'm encountering the same issue.

CGPEBM avatar Nov 14 '19 16:11 CGPEBM

This sounds similiar to an issue we had with cChoco - can you try this fix and confirm if it works or not?

pauby avatar Nov 15 '19 09:11 pauby

Hi, I have tried the fix but it did not worked for me.

I still have the same issue for a .exe of 40mo, while the issue did not occured for a .exe of 7mo.

CGPEBM avatar Nov 15 '19 09:11 CGPEBM

Hi, I went back to a previous version from 2015, and it works perfectly again.

I asked one of my colleague who have a working version if he could send me this file C:\ProgramData\Boxstarter\Boxstarter.Common\Enter-DotNet4.ps1 so I could compare his and mine, and this file did not existed back in 2015.

CGPEBM avatar Nov 19 '19 15:11 CGPEBM

Having the same issue with a file of 33MB

Had to make a really strange workaround where i split the zip file into multiple files and then joined them together on installation.

This actually just prompted me to convert the package to a pure chocolatey package and drop boxstarter altogether

mbrankintrintech avatar May 08 '20 10:05 mbrankintrintech

Still waiting for this to be fixed. Our biggest use case for creating packages is so that we can use chocolatey on machines with no internet access; therefore we need to include large files like MSIs within the package. This obstacle remains quite annoying. Any chance this is being worked on?

rpresser avatar Aug 18 '20 19:08 rpresser

@rpresser I will try to look at this soon.

pauby avatar Aug 20 '20 10:08 pauby