boxstarter icon indicating copy to clipboard operation
boxstarter copied to clipboard

Boxstarter reports package install failure when installing from Windows Features returns exit code 3010

Open KZeronimo opened this issue 6 years ago • 6 comments

My question is regarding Boxstarter catching exit code 3010 from dism and presenting that as an error - is there anyway to let Boxstarter know this is a valid exit code and not report it as an error?

Repro

From elevated PS prompt exectute

$(. { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; $?) -and $(Get-Boxstarter -Force | Out-Host; $?) -and $([Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"; Install-BoxstarterPackage -PackageName "https://gist.github.com/KZeronimo/1b188ebc542ec4c3c4247bd5323a6dfd/raw/package-enable-hyperv.ps1" -DisableReboots | Out-Host; $?) -and $(pause; Restart-Computer)

The gist contains the following

cinst Microsoft-Hyper-V-All -source windowsFeatures

In the boxstarter.log you will see the following snippet

Installing the following packages: Microsoft-Hyper-V-All By installing you accept licenses for the packages. Calling command ['"C:\Windows\System32\dism.exe" /Online /English /LogLevel=3 /NoRestart /Enable-Feature /FeatureName:Microsoft-Hyper-V-All /All'] Microsoft-Hyper-V-All has been installed successfully. Command ['"C:\Windows\System32\dism.exe" /Online /English /LogLevel=3 /NoRestart /Enable-Feature /FeatureName:Microsoft-Hyper-V-All /All'] exited with '3010' Chocolatey installed 1/1 packages. 0 packages failed. . . . [2018-03-16T13:37:33.8153289-04:00:::PID 5320] Boxstarter: Exit Code: 3010

Finally the output to the user is

Errors: {Chocolatey reported an unsuccessful exit code of 3010. See C:\Users\Mesh Admin\AppData\Local\Boxstarter\boxstarter.log for details.} ComputerName : localhost Completed : True FinishTime : 3/16/2018 1:37:34 PM StartTime : 3/16/2018 1:36:56 PM

KZeronimo avatar Mar 16 '18 17:03 KZeronimo

I've tried to look at this @KZeronimo but the gist you listed is no longer there. Appreciate this was March when it was logged however.

Rather than using dism to install Hyper-V use choco install Microsoft-Hyper-V-All -source windowsFeatures - I've used this many times and have not come across the exit code you mentioned so it looks like Chocolatey is handling that.

pauby avatar Aug 06 '18 21:08 pauby

It looks like exit code 3010 is "The requested operation is successful. Changes will not be effective until the system is rebooted."

Interesting as I've used Boxstarter to enable HyperV via the windowsfeatures source and don't remember that causing a problem.

@pauby looking at the earlier comment, I read that dism command as a logging output from Chocolatey from running the command you suggested. This does sounds like something that either Chocolatey should handle better (and maybe more recent versions of Chocolatey do), or that Boxstarter should intercept?

flcdrg avatar Aug 07 '18 03:08 flcdrg

Interesting as I've used Boxstarter to enable HyperV via the windowsfeatures source and don't remember that causing a problem.

I've done the same and was surprised there was no issue with a reboot either

This does sounds like something that either Chocolatey should handle better (and maybe more recent versions of Chocolatey do), or that Boxstarter should intercept?

I agree. @gep13 Can you shed some light on this and suggest where you think this is best handled?

pauby avatar Aug 08 '18 02:08 pauby

I'm wondering if Boxstarter will report any non-zero exit code from Chocolatey as a failure.

pauby avatar Mar 18 '19 23:03 pauby

I'm running into the same problem installing package dotnetfx version 4.7.2 which requires a reboot.

jeremygaither avatar Mar 18 '20 18:03 jeremygaither

@jeremygaither if you add --ignorepackagecodes to choco install command, itwill treat 3080 exit code as valid. 3080 exit code if i remember correctly stands for "everything went fine, package asks for reboot". But any non-zero exit code will crash powershell scripts. Thats why you have to do this trick.

Notice: im not familiar with boxstarter, stumbled upon this while searching for other solution to my chocolatey install script. Someone may find this helpful :)

jareqpl avatar Jan 03 '21 10:01 jareqpl