rgl / packer-plugin-windows-update

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

Windows update script exited with non-zero exit status: 16001 #65

Open DeleplaceM opened 4 years ago

DeleplaceM commented 4 years ago

Could anyone help me with that one?

Looks like the provisioner completed the first tasks by identifying the KBs and downloading them even though I don't really know whether the download was fully complete. it failed after ~15 minutes with status 16001.

==> vsphere-iso: Uploading the Windows update elevated script... ==> vsphere-iso: Uploading the Windows update check for reboot required elevated script... ==> vsphere-iso: Uploading the Windows update script... ==> vsphere-iso: Running Windows update... vsphere-iso: Searching for Windows updates... vsphere-iso: Waiting for operation to complete (system performance: 28 % cpu; 29 % memory)... 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 (2019-10-12; 0.08 MB): VMware, Inc. - System - 7/11/2019 12:00:00 AM - 9.8.16.0 vsphere-iso: Found Windows update (2019-10-12; 0.08 MB): VMware, Inc. - System - 7/11/2019 12:00:00 AM - 9.8.16.0 vsphere-iso: Found Windows update (2019-10-19; 0.05 MB): VMware, Inc. - SCSIAdapter - 8/2/2019 12:00:00 AM - 1.3.15.0 vsphere-iso: Found Windows update (2019-10-23; 0.08 MB): VMware, Inc. - Net - 7/11/2019 12:00:00 AM - 1.8.16.0 vsphere-iso: Found Windows update (2020-03-10; 30.62 MB): Windows Malicious Software Removal Tool x64 - March 2020 (KB890830) vsphere-iso: Found Windows update (2020-04-14; 11.59 MB): 2020-04 Servicing Stack Update for Windows Server 2016 for x64-based Systems (KB4550994) vsphere-iso: Found Windows update (2020-04-22; 100.76 MB): Security Intelligence Update for Windows Defender Antivirus - KB2267602 (Version 1.313.2080.0) vsphere-iso: Downloading Windows updates (8 updates; 1416.51 MB)... vsphere-iso: Waiting for operation to complete (system performance: 0 % cpu; 29 % memory)... vsphere-iso: Waiting for operation to complete (system performance: 1 % cpu; 28 % memory)... vsphere-iso: Waiting for operation to complete (system performance: 3 % cpu; 26 % memory)... vsphere-iso: Waiting for operation to complete (system performance: 1 % cpu; 26 % memory)... vsphere-iso: Waiting for operation to complete (system performance: 1 % cpu; 26 % memory)... ==> vsphere-iso: Provisioning step had errors: Running the cleanup provisioner, if present... ==> vsphere-iso: Clear boot order... ==> vsphere-iso: Power off VM... ==> vsphere-iso: Deleting Floppy image ... ==> vsphere-iso: Destroying VM... Build 'vsphere-iso' errored: Windows update script exited with non-zero exit status: 16001

==> Some builds didn't complete successfully and had errors: --> vsphere-iso: Windows update script exited with non-zero exit status: 16001

dgttm commented 4 years ago

same issue with qemu

I tried with windows16 and windows19 with packer 1.5.1 and 1.6.0 and windows-update current version .

same behavour both packer versions:

Any ideas?

{
  "type": "windows-update",
  "search_criteria": "IsInstalled=0",
  "filters": [
      "exclude:$_.Title -like '*Preview*'",
      "include:$true"
  ],
  "update_limit": 25,
  "timeout": "480m"
},

Log-snip

==> qemu: Setting a 8h0m0s timeout for the next provisioner... ==> qemu: Uploading the Windows update elevated script... ==> qemu: Uploading the Windows update check for reboot required elevated script... ==> qemu: Uploading the Windows update script... ==> qemu: Running Windows update... qemu: Searching for Windows updates... qemu: Found Windows update (2018-10-15; 20.72 MB): Update for Adobe Flash Player for Windows Server 2019 (1809) for x64-based Systems (KB4462930) qemu: Found Windows update (2020-05-12; 71.56 MB): 2020-05 Cumulative Update for .NET Framework 3.5, 4.7.2 and 4.8 for Windows Server 2019 for x64 (KB4556441) qemu: Found Windows update (2020-05-12; 29.96 MB): Windows Malicious Software Removal Tool x64 - v5.82 (KB890830) qemu: Found Windows update (2020-05-19; 2.34 MB): 2020-01 Update for Windows Server 2019 for x64-based Systems (KB4494174) qemu: 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) qemu: Found Windows update (2020-06-25; 99.64 MB): Security Intelligence Update for Microsoft Defender Antivirus - KB2267602 (Version 1.319.167.0) qemu: Found Windows update (2020-06-09; 15497.94 MB): 2020-06 Cumulative Update for Windows Server 2019 (1809) for x64-based Systems (KB4561608) qemu: Downloading Windows updates (7 updates; 15743.27 MB)... qemu: Waiting for operation to complete (system performance: 21% cpu; 20% memory)... qemu: Installing Windows updates... qemu: Waiting for operation to complete (system performance: 27% cpu; 21% memory)... qemu: Waiting for operation to complete (system performance: 42% cpu; 25% memory)... qemu: Waiting for operation to complete (system performance: 31% cpu; 27% memory)... qemu: Waiting for operation to complete (system performance: 31% cpu; 30% memory)... qemu: Waiting for operation to complete (system performance: 9% cpu; 29% memory)... qemu: Waiting for operation to complete (system performance: 10% cpu; 30% memory)... qemu: Waiting for operation to complete (system performance: 16% cpu; 32% memory)... qemu: Waiting for operation to complete (system performance: 13% cpu; 34% memory)... qemu: Waiting for operation to complete (system performance: 10% cpu; 35% memory)... qemu: Waiting for operation to complete (system performance: 11% cpu; 35% memory)... qemu: Waiting for operation to complete (system performance: 12% cpu; 36% memory)... qemu: Waiting for operation to complete (system performance: 7% cpu; 35% memory)... qemu: Waiting for operation to complete (system performance: 9% cpu; 37% memory)... qemu: Waiting for operation to complete (system performance: 16% cpu; 38% memory)... qemu: Waiting for operation to complete (system performance: 13% cpu; 38% memory)... qemu: Waiting for operation to complete (system performance: 13% cpu; 33% memory)... qemu: Waiting for operation to complete (system performance: 11% cpu; 35% memory)... qemu: Waiting for operation to complete (system performance: 15% cpu; 39% memory)... qemu: Waiting for operation to complete (system performance: 7% cpu; 34% memory)... qemu: Waiting for operation to complete (system performance: 15% cpu; 32% memory)... qemu: Waiting for operation to complete (system performance: 10% cpu; 32% memory)... qemu: Waiting for operation to complete (system performance: 4% cpu; 33% memory)... qemu: Waiting for operation to complete (system performance: 12% cpu; 32% memory)... qemu: Waiting for operation to complete (system performance: 15% cpu; 35% memory)... qemu: Waiting for operation to complete (system performance: 11% cpu; 30% memory)... qemu: Waiting for the Windows Modules Installer to exit... qemu: Waiting for operation to complete (system performance: 0% cpu; 30% memory)... qemu: Waiting for operation to complete (system performance: 1% cpu; 27% memory)... ==> qemu: Restarting the machine... ==> qemu: Waiting for machine to become available... ==> qemu: A system shutdown is in progress.(1115) ==> qemu: A system shutdown is in progress.(1115) qemu: WINDOWS-2019 restarted. ==> qemu: Running Windows update... qemu: Searching for Windows updates... qemu: Found Windows update (2020-03-04; 4.89 MB): Update for Windows Defender Antivirus antimalware platform - KB4052623 (Version 4.18.2001.10) qemu: Found Windows update (2020-06-03; 4.66 MB): Update for Microsoft Defender Antivirus antimalware platform - KB4052623 (Version 4.18.2005.5) qemu: Downloading Windows updates (2 updates; 9.55 MB)... qemu: Installing Windows updates... ==> qemu: Provisioning step had errors: Running the cleanup provisioner, if present... ==> qemu: Deleting output directory... Build 'qemu' errored: Windows update script exited with non-zero exit status: 16001

dgttm commented 4 years ago

ran with debug, looks like a powershell script exists with a non-zero exit code C:/Windows/Temp/packer-windows-update-elevated.ps1' exited with code: 259

   qemu: Found Windows update (2020-06-03; 4.66 MB): Update for Microsoft Defender Antivirus antimalware platform - KB4052623 (Version 4.18.2005.5)
    qemu: Downloading Windows updates (2 updates; 9.55 MB)...
    qemu: Installing Windows updates...
2020/06/25 13:26:56 [INFO] 397 bytes written for 'stdout'
2020/06/25 13:26:56 packer-builder-qemu plugin: [INFO] command 'PowerShell -ExecutionPolicy Bypass -OutputFormat Text -File C:/Windows/Temp/packer-windows-update-elevated.ps1' exited with code: 259
2020/06/25 13:26:56 packer-builder-qemu plugin: [INFO] RPC endpoint: Communicator ended with: 259
2020/06/25 13:26:56 [INFO] 0 bytes written for 'stderr'
2020/06/25 13:26:56 [INFO] RPC client: Communicator ended with: 259
2020/06/25 13:26:56 [INFO] RPC endpoint: Communicator ended with: 259
2020/06/25 13:26:56 packer-provisioner-windows-update plugin: 2020/06/25 13:26:56 [INFO] 0 bytes written for 'stderr'
2020/06/25 13:26:56 packer-provisioner-windows-update plugin: 2020/06/25 13:26:56 [INFO] 397 bytes written for 'stdout'
2020/06/25 13:26:56 packer-provisioner-windows-update plugin: 2020/06/25 13:26:56 [INFO] RPC client: Communicator ended with: 259
2020/06/25 13:26:56 [INFO] (telemetry) ending windows-update
2020/06/25 13:26:56 Cancelling provisioner after context cancellation context canceled
==> qemu: Provisioning step had errors: Running the cleanup provisioner, if present...
2020/06/25 13:26:56 packer-builder-qemu plugin: failed to unlock port lockfile: close tcp 127.0.0.1:5944: use of closed network connection
2020/06/25 13:26:56 packer-builder-qemu plugin: failed to unlock port lockfile: close tcp 127.0.0.1:2812: use of closed network connection
2020/06/25 13:26:56 packer-builder-qemu plugin: Deleting floppy disk: /tmp/packer989465789
==> qemu: Deleting output directory...
2020/06/25 13:26:56 [INFO] (telemetry) ending qemu
Build 'qemu' errored: Windows update script exited with non-zero exit status: 259
2020/06/25 13:26:56 machine readable: error-count []string{"1"}

==> Some builds didn't complete successfully and had errors:
2020/06/25 13:26:56 machine readable: qemu,error []string{"Windows update script exited with non-zero exit status: 259"}
==> Builds finished but no artifacts were created.
==> Some builds didn't complete successfully and had errors:
--> qemu: Windows update script exited with non-zero exit status: 259

==> Builds finished but no artifacts were created.
2020/06/25 13:26:56 [INFO] (telemetry) Finalizing.
2020/06/25 13:26:57 waiting for all plugin processes to complete...
2020/06/25 13:26:57 /usr/local/bin/packer: plugin process exited
2020/06/25 13:26:57 /usr/local/bin/packer: plugin process exited
2020/06/25 13:26:57 /usr/local/bin/packer-provisioner-windows-update: plugin process exited
2020/06/25 13:26:57 /usr/local/bin/packer: plugin process exited
2020/06/25 13:26:57 /usr/local/bin/packer: plugin process exited
2020/06/25 13:26:57 /usr/local/bin/packer: plugin process exited
dgttm commented 4 years ago

looks like we're running in a loop of not beeing able to stream data to the vm.

2020/07/14 20:05:32 packer-provisioner-windows-update plugin: 2020/07/14 20:05:32 [ERR] 'stdout' copy error: io: read/write on closed pipe 2020/07/14 20:05:34 packer-builder-qemu plugin: #< CLIXML

full loop

==> qemu: Running Windows update... 2020/07/14 20:05:45 packer-builder-qemu plugin: <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></Objs>[INFO] starting remote command: PowerShell -ExecutionPolicy Bypass -OutputFormat Text -File C:/Windows/Temp/packer-windows-update-elevated.ps1 2020/07/14 20:05:45 Cancelling provisioner after context cancellation context canceled ==> qemu: Provisioner failed with "Windows update script exited with non-zero exit status: 16001", retrying with 11 trie(s) left ==> qemu: Setting a 6h0m0s timeout for the next provisioner... ==> qemu: Uploading the Windows update elevated script... 2020/07/14 20:05:45 packer-provisioner-windows-update plugin: 2020/07/14 20:05:45 [INFO] 4369 bytes written for 'uploadData' 2020/07/14 20:05:45 [INFO] 4369 bytes written for 'uploadData' 2020/07/14 20:05:45 packer-builder-qemu plugin: Uploading file to 'C:/Windows/Temp/packer-windows-update-elevated.ps1' 2020/07/14 20:05:50 packer-builder-qemu plugin: #< CLIXML 2020/07/14 20:05:53 packer-builder-qemu plugin: <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></Objs>#< CLIXML ==> qemu: Uploading the Windows update check for reboot required elevated script... 2020/07/14 20:05:53 packer-provisioner-windows-update plugin: 2020/07/14 20:05:53 [INFO] 4190 bytes written for 'uploadData' 2020/07/14 20:05:53 [INFO] 4190 bytes written for 'uploadData' 2020/07/14 20:05:53 packer-builder-qemu plugin: <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></Objs>Uploading file to 'C:/Windows/Temp/packer-windows-update-pending-reboot-elevated.ps1' 2020/07/14 20:05:56 packer-provisioner-windows-update plugin: 2020/07/14 20:05:56 [INFO] 0 bytes written for 'stdout' 2020/07/14 20:05:56 packer-provisioner-windows-update plugin: 2020/07/14 20:05:56 [ERR] 'stdout' copy error: io: read/write on closed pipe 2020/07/14 20:05:57 packer-builder-qemu plugin: #< CLIXML 2020/07/14 20:06:01 packer-builder-qemu plugin: <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></Objs>[INFO] command 'PowerShell -ExecutionPolicy Bypass -OutputFormat Text -File C:/Windows/Temp/packer-windows-update-elevated.ps1' exited with code: 0 2020/07/14 20:06:01 packer-builder-qemu plugin: [INFO] RPC endpoint: Communicator ended with: 0 2020/07/14 20:06:01 [INFO] 60 bytes written for 'stdout' 2020/07/14 20:06:01 [INFO] 0 bytes written for 'stderr' 2020/07/14 20:06:01 [INFO] RPC client: Communicator ended with: 0 2020/07/14 20:06:01 [INFO] RPC endpoint: Communicator ended with: 0 2020/07/14 20:06:01 packer-provisioner-windows-update plugin: 2020/07/14 20:06:01 [INFO] 0 bytes written for 'stderr' 2020/07/14 20:06:01 packer-provisioner-windows-update plugin: 2020/07/14 20:06:01 [INFO] RPC client: Communicator ended with: 0 2020/07/14 20:06:01 packer-builder-qemu plugin: #< CLIXML ==> qemu: Uploading the Windows update script... 2020/07/14 20:06:01 packer-provisioner-windows-update plugin: 2020/07/14 20:06:01 [INFO] 9759 bytes written for 'uploadData' 2020/07/14 20:06:01 [INFO] 9759 bytes written for 'uploadData' 2020/07/14 20:06:01 packer-builder-qemu plugin: <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></Objs>Uploading file to 'C:/Windows/Temp/packer-windows-update.ps1' 2020/07/14 20:06:05 packer-builder-qemu plugin: #< CLIXML 2020/07/14 20:06:09 packer-builder-qemu plugin: <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></Objs>#< CLIXML ==> qemu: Running Windows update...

rgl commented 3 years ago

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