Choco: Exit when reboot is detected - w/350 for pending & w/1604 on dependency package requiring reboot

Created on 3 Nov 2016  路  13Comments  路  Source: chocolatey/choco

As per https://groups.google.com/forum/#!topic/chocolatey/jP4cv8TDUcU, it's probably a good idea to add a switch so that install/upgrade will halt if a dependency requires a reboot. For example, I have a package that has a dependency on PowerShell 3+ - chocolately installed PowerShell v5 but then logged this and then continued to install packages with PowerShell 2 (and subsequently failed):

2016-11-02 12:05:55,829 [INFO ] - PowerShell.5.0 has been installed.
2016-11-02 12:05:55,829 [INFO ] -
2016-11-02 12:05:55,844 [WARN ] - WARNING: PowerShell.5.0 requires a reboot to complete the installation.
2016-11-02 12:05:55,844 [DEBUG] - Built-in PowerShell host called with ['[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name 'C:ProgramDatachocolateyhelperschocolateyInstaller.psm1'; & 'C:ProgramDatachocolateyhelperschocolateyScriptRunner.ps1' -packageScript 'C:ProgramDatachocolateylibPowerShelltoolsChocolateyInstall.ps1' -installArguments '' -packageParameters '''] exited with '3010'.
2016-11-02 12:05:55,844 [DEBUG] - Calling command ['"C:WindowsSystem32shutdown.exe" /a']
2016-11-02 12:05:55,870 [DEBUG] - Command ['"C:WindowsSystem32shutdown.exe" /a'] exited with '1116'

3 - Done Enhancement Priority_HIGH

Most helpful comment

No worries. We have identified two codes - 350 for exit without doing anything, and 1604 for exit if some work has been completed, but not finished. Both mean reboot and then run again.

All 13 comments

Thanks!

Release Notes

To turn on this feature, please run choco feature enable --name="'exitOnRebootDetected'"

When Package Exit codes are turned on (#512), we'll exit indicating reboot necessary but not complete:

  • Pending Reboot discovered prior to running - 350 (ERROR_FAIL_NOACTION_REBOOT - "No action was taken as a system reboot is required.")
  • Some work completed - 1604 (ERROR_INSTALL_SUSPEND - "Installation suspended, incomplete.")

Both mean reboot and then run again.

Similar to #913, would probably share most of the implementation.

When finding a pending reboot before doing anything, we will fail with 350 - https://docs.microsoft.com/en-us/windows/desktop/debug/system-error-codes--0-499-

~~~
ERROR_FAIL_NOACTION_REBOOT

350 (0x15E)

No action was taken as a system reboot is required.
~~~

Currently we are looking for what exit code to use when we've installed some dependencies, but have not installed everything because there is a reboot required in the middle. We've come to 3011, 3017, and a couple of others, but none are ideal in the definition.

https://docs.microsoft.com/en-us/windows/desktop/debug/system-error-codes--1700-3999-

~~~
ERROR_SUCCESS_REBOOT_REQUIRED

3010 (0xBC2)

The requested operation is successful. Changes will not be effective until the system is rebooted.

ERROR_SUCCESS_RESTART_REQUIRED

3011 (0xBC3)

The requested operation is successful. Changes will not be effective until the service is restarted.

ERROR_FAIL_REBOOT_REQUIRED

3017 (0xBC9)

The requested operation failed. A system reboot is required to roll back changes made.

ERROR_FAIL_REBOOT_INITIATED

3018 (0xBCA)

The requested operation failed. A system reboot has been initiated to roll back changes made.
~~~

1602 could be an option, but it could also be indicative of other areas where a user cancels the install.

https://docs.microsoft.com/en-us/windows/desktop/debug/system-error-codes--1300-1699-
~~~
ERROR_INSTALL_USEREXIT

1602 (0x642)

User cancelled installation.

ERROR_INSTALL_FAILURE

1603 (0x643)

Fatal error during installation.

ERROR_INSTALL_SUSPEND

1604 (0x644)

Installation suspended, incomplete.
~~~

1604 looks like a Winner here

See above, we've already identified 350

Sorry, I missed that one.

No worries. We have identified two codes - 350 for exit without doing anything, and 1604 for exit if some work has been completed, but not finished. Both mean reboot and then run again.

This has been completed and will be released with 0.10.12.

Was this page helpful?
0 / 5 - 0 ratings