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

Windows update fails with COMException HRESULT: 0x80240016 #76

Open
pvandervelde opened this issue Aug 14, 2020 · 2 comments
Open

Windows update fails with COMException HRESULT: 0x80240016 #76

pvandervelde opened this issue Aug 14, 2020 · 2 comments

Comments

@pvandervelde
Copy link
Contributor

We have been running Packer (1.6.0) and the windows-update plugin (0.9.0) to build Windows 2019 datacenter VM images. In about 50% of the cases we see the following error:

azure-arm: Searching for Windows updates...
azure-arm: Found Windows update (2018-10-15; 20.72 MB): Update for Adobe Flash Player for Windows Server 2019 (1809) for x64-based Systems (KB4462930)
azure-arm: Found Windows update (2020-05-12; 29.96 MB): Windows Malicious Software Removal Tool x64 - v5.82 (KB890830)
azure-arm: Found Windows update (2020-05-19; 2.34 MB): 2020-01 Update for Windows Server 2019 for x64-based Systems (KB4494174)
azure-arm: Found Windows update (2020-06-09; 21.09 MB): 2020-06 Security Update for Adobe Flash Player for Windows Server 2019 for x64-based Systems (KB4561600)
azure-arm: Skipped (filter) Windows update (2020-07-21; 72.22 MB): 2020-07 Cumulative Update Preview for .NET Framework 3.5, 4.7.2 and 4.8 for Windows Server 2019 for x64 (KB4567327)
azure-arm: Found Windows update (2020-08-11; 110.83 MB): Security Intelligence Update for Microsoft Defender Antivirus - KB2267602 (Version 1.321.1133.0)
azure-arm: Downloading Windows updates (5 updates; 184.94 MB)...
azure-arm: Installing Windows updates...
azure-arm: ERROR: Exception from HRESULT: 0x80240016
azure-arm: ERROR: at <ScriptBlock>, C:\Windows\Temp\packer-windows-update.ps1: line 250
azure-arm: ERROR: at <ScriptBlock>, <No file>: line 1
azure-arm: ERROR EXCEPTION: System.Runtime.InteropServices.COMException (0x80240016): Exception from HRESULT: 0x80240016
azure-arm: ERROR EXCEPTION:    at System.Management.Automation.ComInterop.ComRuntimeHelpers.CheckThrowException(Int32 hresult, ExcepInfo& excepInfo, ComMethodDesc method, Object[] args, UInt32 argErr)
azure-arm: ERROR EXCEPTION:    at CallSite.Target(Closure , CallSite , ComObject )
azure-arm: ERROR EXCEPTION:    at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
azure-arm: ERROR EXCEPTION:    at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
azure-arm: ERROR EXCEPTION:    at System.Management.Automation.Interpreter.DynamicInstruction`2.Run(InterpretedFrame frame)
azure-arm: ERROR EXCEPTION:    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)

In cases where two builds fail they often find the same updates but don't have the same download sizes and in cases where it works often Windows Updates finds one or two additional updates.
To us this looked like an issue where one of the updates wants a reboot or one of the downloads is corrupt or something.

As a solution we have created a version of the plugin where we catch the errors during install and then reboot the machine. This seems to have fixed the issue in our case. I will put in a PR shortly with the changes and link it to this issue.

Also our issue seems related to #15

@rgl
Copy link
Owner

rgl commented Aug 14, 2020

I've merged this and other change, can you please try with the artifacts from https://github.com/rgl/packer-provisioner-windows-update/actions/runs/209091335 and let me known how it goes?

@pvandervelde
Copy link
Contributor Author

I'll update our build container when I get back to the office on monday. Thanks for merging it so quickly!

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

No branches or pull requests

2 participants