rgl / packer-plugin-windows-update

Packer plugin for installing Windows updates
Mozilla Public License 2.0
303 stars 71 forks source link

Fails with exit code 1 #20

Open agowa opened 5 years ago

agowa commented 5 years ago
==> vsphere-iso: Running Windows update...
    vsphere-iso: #< CLIXML
    vsphere-iso: Searching for Windows updates...
    vsphere-iso: Skipped (filter) Windows update (2017-06-13; 12.55 MB): Microsoft Silverlight (KB4023307)
    vsphere-iso: Found Windows update (2018-05-17; 1273.25 MB): 2018-05 Cumulative Update for Windows Server 2016 for x64-based Systems (KB4103720)
    vsphere-iso: Found Windows update (2018-05-17; 11.43 MB): 2018-05 Update for Windows Server 2016 for x64-based Systems (KB4132216)
    vsphere-iso: Found Windows update (2018-09-11; 45.88 MB): Windows Malicious Software Removal Tool x64 - September 2018 (KB890830)
    vsphere-iso: Found Windows update (2018-09-29; 148.29 MB): Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.277.305.0)
    vsphere-iso: Downloading Windows updates...
    vsphere-iso: Installing Windows updates...
    vsphere-iso: Pending Reboot detected. Waiting for the Windows Modules Installer to exit...
    vsphere-iso: Rebooting...
    vsphere-iso: <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj><Obj S="progress" RefId="1"><TNRef RefId="0" /><MS><I64 N="SourceId">2</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj></Objs>
==> vsphere-iso: Power off VM...
==> vsphere-iso: Destroying VM...
Build 'vsphere-iso' errored: Windows update script exited with non-zero exit status: 1

Maybe it's the progress part at the end. If so, adding $ProgressPreference='SilentlyContinue' internally to your powershell calls could help. Or it's because I'm connecting with ssh instead of winrm into it.

rgl commented 5 years ago

I didn't yet try with ssh... but if you want to try with winrm, 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) and use the provision step without any options, i.e.:

{
    "provisioners": [
        {
            "type": "windows-update"
        }
    ]
}
agowa commented 5 years ago

@rgl Any update? I would really like to use the latest version and also to use ssh instead of winrm. Did you have time to look into it?

rgl commented 3 years ago

Please try v0.14.0 and let us known how it goes.

At https://github.com/rgl/windows-vagrant I'm using SSH now.

frippe75 commented 2 years ago

I'm on v0.14.0 and it exits with status: 1.

Stderr and Stdout is empty. Doing a manual update from the UI works fine. Not sure what to do to troubleshoot further.