Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chocolatey aborting shutdown causes Boxstarter to report failed install #148

Closed
sevenzsu opened this issue Feb 1, 2016 · 10 comments
Closed
Labels
No Response / Stale Used on issues when additional information is requested, and no response has been given

Comments

@sevenzsu
Copy link

sevenzsu commented Feb 1, 2016

I am using boxstarter.org\package\url?c:\myscript.ps1 to run the script and after the package is installed successfully, boxstarter report exit code 1 in the log as below. Did some google and found something here, hope this help: chocolatey-archive/chocolatey#387

Chocolatey installed 1/1 package(s). 0 package(s) failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
  The install of msbuild.communitytasks was successful.
 Chocolatey installed 1/1 package(s). 0 package(s) failed.
[2016-01-28T15:02:11.3840953-05:00:::PID 3176] Boxstarter: restoring current directory location to C:\Users\my.name\AppData\Local\Apps\2.0\XC8NK5GZ.L63\6O7WKR61.DR3\boxs..tion_4b037e62ccd024b7_0002.0006_d4dfbce912b5d99f\boxstarter.chocolatey\chocolatey
[2016-01-28T15:02:11.3840953-05:00:::PID 3176] Boxstarter: Exit Code: 1
 chocolatey : Chocolatey reported an unsuccessful exit code of 1. See C:\Users\m
[2016-01-28T15:02:11.3840953-05:00:::PID 3176] + Boxstarter finished Calling Chocolatey to install msbuild.communitytasks. This may take several minutes to complete... 00:00:14.0598503
 y.name\AppData\Local\Boxstarter\boxstarter.log for details.
[2016-01-28T15:02:11.3840953-05:00:::PID 3176] + Boxstarter finished Calling Chocolatey to install msbuild.communitytasks. This may take several minutes to complete... 00:00:14.0598503
 At C:\Users\my.name\AppData\Local\Apps\2.0\XC8NK5GZ.L63\6O7WKR61.DR3\boxs..
 tion_4b037e62ccd024b7_0002.0006_d4dfbce912b5d99f\Boxstarter.chocolatey\Chocolat
 ey.ps1:58 char:15
-     chocolatey <<<<  Install @PSBoundParameters @args
  - CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorExcep 
- Boxstarter finished Calling Chocolatey to install msbuild.communitytasks. This may take several minutes to complete... 00:00:14.0598503
  [2016-01-28T15:02:11.3997263-05:00:::PID 3176] Boxstarter: Installing 1 packages
  tion
  - FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio 
    n,chocolatey
@mwrock
Copy link
Member

mwrock commented Feb 2, 2016

please provide a gist of the boxstarter log found at $env:localappdata\boxstarter Thanks!

@bill-long
Copy link
Contributor

I've seen this a few times as well. Just grabbed a boxstarter.log from a user who saw this:

https://gist.github.com/bill-long/e282332d86011a03d95f

@mwrock
Copy link
Member

mwrock commented Feb 4, 2016

Boxstarter checks the environment's exitcode immediately after running a chocolatey package. Its certainly possible to have a script that ends up with a non zero exit code even though things seemed to have gone ok. I'm certainly not saying there could be something wrong on boxstarter's end, but especially if you are seeing this happen consistently with a particular script, try printing out the $LASTEXITCODE variable at the end of the script. If it is not 0 then that indicates something in the script triped that code.

@bill-long
Copy link
Contributor

In the gist above, the user reported that they had seen the error when they only installed Beyond Compare 4. Looking at the gist, I see that Beyond Compare 4 did indeed succeed - but after that, something runs a shutdown /a command. That command is what returned a nonzero exit code.

That command is not in the boxstarter script, but it looks like Chocolatey itself issues a shutdown /a in this file: /~https://github.com/chocolatey/choco/blob/4d37117c926ae02fd57e35c06355e4aca729fd7d/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs

if (powerShellRan)
{
    // we don't care about the exit code
    if (config.Information.PlatformType == PlatformType.Windows) CommandExecutor.execute_static("shutdown", "/a", config.CommandExecutionTimeoutSeconds, _fileSystem.get_current_directory(), (s, e) => { }, (s, e) => { }, false, false);
}

Testing on my own machine, this returns the exit code we see in the gist if it is run when no shutdown is in progress:

C:\> shutdown /a
Unable to abort the system shutdown because no shutdown was in progress.(1116)

So it appears that sometimes choco will issue a shutdown abort when no shutdown is in progress. The nonzero exit code from that is what makes Boxstarter report a failure. I'm opening an issue in the choco repo.

@riezebosch
Copy link
Contributor

I've got this extensive log where I draw the following conclusion from:

  • chocolatey always invokes a shutdown /a
  • for me this always results in exit code 1116 because no shutdown was scheduled
  • sometimes chocolatey exits with exit code 1 for no apparent reason
  • but boxstarter (or chocolatey) indicates the package install has failed
  • this only happens when a reboot was indeed required

I have no workaround as of yet. Most installs are just fine after a reboot when the package is idempotent but for one package I have the workaround to install it a second time with -n to not execute the install script but still mark it as installed.

@riezebosch riezebosch mentioned this issue Jan 2, 2017
@pauby pauby changed the title exit code 1 after install package successfully Chocolatey aborting shutdown causes Boxstarter to report failed install Mar 18, 2019
@pauby
Copy link
Member

pauby commented Mar 18, 2019

Keeping this open until chocolatey/choco#610 is resolved.

@pauby pauby added Blocked - External The issue or pull request is not fixable without a change in a upstream/external library and removed Chocolatey Issue labels Dec 21, 2023
@pauby
Copy link
Member

pauby commented Sep 18, 2024

@mwallner @flcdrg is this still an issue? I don't think I've ever come across this when using Boxstarter.

@pauby pauby added 0 - _Triaging Issue is accepted, but a milestone has yet to be added for the issue 0 - Waiting on User Insufficient information for issue or PR, issue may be closed if no response from user labels Sep 18, 2024
@mwallner
Copy link
Member

I doubt that this is still relevant (especially since Boxstarter v3 looking at the given output above, the way Boxstarter used to hijack the session of choco made it probably more sensible to stderr/write-error problems than necessary).

I'd vote to close the issue and link a new one here if it ever happens again.

Copy link

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue will be closed in 14 days if it continues to be inactive.

@github-actions github-actions bot added the Pending Closure This issue has been marked as having no response or is stale and will soon be closed. label Oct 19, 2024
Copy link

github-actions bot commented Nov 2, 2024

Dear contributor,

As this issue seems to have been inactive for quite some time now, it has been automatically closed.
If you feel this is a valid issue, please feel free to re-open the issue if / when a pull request
has been added.
Thank you for your contribution.

@github-actions github-actions bot added the No Response / Stale Used on issues when additional information is requested, and no response has been given label Nov 2, 2024
@github-actions github-actions bot closed this as completed Nov 2, 2024
@pauby pauby removed 0 - _Triaging Issue is accepted, but a milestone has yet to be added for the issue 0 - Waiting on User Insufficient information for issue or PR, issue may be closed if no response from user Blocked - External The issue or pull request is not fixable without a change in a upstream/external library Pending Closure This issue has been marked as having no response or is stale and will soon be closed. labels Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
No Response / Stale Used on issues when additional information is requested, and no response has been given
Projects
None yet
Development

No branches or pull requests

6 participants