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

Packer fails whilst searching for updates with exit code 16001 #17

Closed
roniyako opened this issue Sep 6, 2018 · 9 comments
Closed

Packer fails whilst searching for updates with exit code 16001 #17

roniyako opened this issue Sep 6, 2018 · 9 comments

Comments

@roniyako
Copy link

roniyako commented Sep 6, 2018

1536205203,,ui,say,==> amazon-ebs: Machine successfully restarted%!(PACKER_COMMA) moving on
1536205203,,ui,say,==> amazon-ebs: Uploading the Windows update elevated script...
1536205217,,ui,say,==> amazon-ebs: Uploading the Windows update script...
1536205230,,ui,say,==> amazon-ebs: Running Windows update...
1536205235,,ui,message, amazon-ebs: #< CLIXML
1536205236,,ui,message, amazon-ebs: Searching for Windows updates...
1536205296,,ui,say,==> amazon-ebs: Terminating the source AWS instance...
1536205328,,ui,say,==> amazon-ebs: Cleaning up any extra volumes...
1536205328,,ui,say,==> amazon-ebs: No volumes to clean up%!(PACKER_COMMA) skipping
1536205328,,ui,say,==> amazon-ebs: Deleting temporary security group...
1536205328,,ui,say,==> amazon-ebs: Deleting temporary keypair...
1536205328,,ui,error,Build 'amazon-ebs' errored: Windows update script exited with non-zero exit
status: 16001
1536205328,,error-count,1
1536205328,,ui,error,\n==> Some builds didn't complete successfully and had errors:
1536205328,amazon-ebs,error,Windows update script exited with non-zero exit status: 16001
1536205328,,ui,error,--> amazon-ebs: Windows update script exited with non-zero exit status: 1600
1
1536205328,,ui,say,\n==> Builds finished but no artifacts were created.

@roniyako
Copy link
Author

roniyako commented Sep 6, 2018

Does the plugin provide any error messages back from its script, i would say there might be something with my env and potentially proxies.

@roniyako
Copy link
Author

roniyako commented Sep 6, 2018

Do you have a sleep in any of your powershell code?

@rgl
Copy link
Owner

rgl commented Sep 6, 2018

I've never seen that error before. Try to follow the script at https://github.com/rgl/packer-provisioner-windows-update/blob/master/update/windows-update.ps1.

@roniyako
Copy link
Author

https://docs.microsoft.com/en-us/windows/desktop/Wua_Sdk/using-wua-from-a-remote-computer

Based on the above it says some wua api commands cannot be run remotely, im guessing your plugin uploads the script and runs it locally rather than remotely, correct?

@roniyako
Copy link
Author

I uploaded the file to a dummy server and tried to mimic running it remotely as i suspect packer is doing, the error code i suspect, but have not validated is related to unknown error code maybe.

When i try run the script i uploaded remotlet i get the below error code. If this was a windows issue, i would of thought everyone would of got it, so i'm unsure where the problem lies for me.

ERROR: Creating an instance of the COM component with CLSID {C01B9BA0-BEA7-41BA-B604-D0A36F469133} from
the IClassFactory failed due to the following error: 80070005 Access is denied. (Exception from HRESUL
T: 0x80070005 (E_ACCESSDENIED)).
ERROR: at ExitWhenRebootRequired, C:\Users\Administrator\Desktop\update.ps1: line 96
ERROR: at , C:\Users\Administrator\Desktop\update.ps1: line 115
ERROR EXCEPTION: System.UnauthorizedAccessException: Creating an instance of the COM component with CLS
ID {C01B9BA0-BEA7-41BA-B604-D0A36F469133} from the IClassFactory failed due to the following error: 800
70005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
ERROR EXCEPTION: at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Bo
olean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
ERROR EXCEPTION: at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis,
Boolean fillCache, StackCrawlMark& stackMark)
ERROR EXCEPTION: at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, O
bject[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
ERROR EXCEPTION: at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder bind
er, Object[] args, CultureInfo culture, Object[] activationAttributes)
ERROR EXCEPTION: at System.Activator.CreateInstance(Type type, Object[] args)
ERROR EXCEPTION: at Microsoft.PowerShell.Commands.NewObjectCommand.SafeCreateInstance(Type t, Object
[] args)
ERROR EXCEPTION: at Microsoft.PowerShell.Commands.NewObjectCommand.CreateComObject()
ERROR EXCEPTION: at Microsoft.PowerShell.Commands.NewObjectCommand.BeginProcessing()
ERROR EXCEPTION: at System.Management.Automation.Cmdlet.DoBeginProcessing()
ERROR EXCEPTION: at System.Management.Automation.CommandProcessorBase.DoBegin()

@roniyako
Copy link
Author

Also, this is trying it on a Windows 2016 image.

@rgl
Copy link
Owner

rgl commented Sep 12, 2018

On the machine itself, you should run it with administrator privileges.

The provider actually does it remotely, but indirectly, with a scheduled task that is run as SYSTEM. see https://github.com/rgl/packer-provisioner-windows-update/blob/master/update/elevated-template.ps1

@rgl
Copy link
Owner

rgl commented Oct 14, 2018

Please try with the new 0.6.0 and packer 1.2.5 (restart is broken after that release, so stick with 1.2.5 for now), winrm, and use the provision step without any options, i.e.:

{
    "provisioners": [
        {
            "type": "windows-update"
        }
    ]
}

It should now install all recommended updates alike the windows update ui.

@rgl
Copy link
Owner

rgl commented May 3, 2019

closed due to lack of feedback.

@rgl rgl closed this as completed May 3, 2019
This issue was closed.
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