Open gys-msci opened 3 years ago
Hi there thanks for reaching out. Could you provide the full packer debug logs PACKER_LOG=1
so that may better see what is happening during the build.
With that said, have you tired removing some of the inline commands in the Powershell provisoiner to see which command may be causing the timeout?
That fact that the provisioner works for one sku but fails for others seems to imply it is a Windows issue upon script execution. Not sure without logging. There is a debug mode option you could enable to see if one of the commands are failing somehow - see https://www.packer.io/docs/provisioners/powershell#debug_mode
Thank you for the response and the suggestions, nywilken!
I enabled PACKER_LOG=1 in the Packer build as well as debug_mode in the powershell provisioner ("debug_mode": "2"), simplified the inline command (hostname) and got the following:
2021-01-08T10:06:08.3572422Z 2021/01/08 10:06:08 packer.exe plugin: Connected to machine
2021-01-08T10:06:08.3574499Z 2021/01/08 10:06:08 1610100368,,ui,say,==> azure-arm: Connected to WinRM!
2021-01-08T10:06:08.3574879Z 1610100368,,ui,say,==> azure-arm: Connected to WinRM!
2021-01-08T10:06:08.3576641Z 2021/01/08 10:06:08 packer.exe plugin: Running the provision hook
2021-01-08T10:06:08.3577439Z 2021/01/08 10:06:08 [INFO] (telemetry) Starting provisioner windows-shell
2021-01-08T10:06:08.3587793Z 2021/01/08 10:06:08 1610100368,,ui,say,==> azure-arm: Provisioning with windows-shell...
2021-01-08T10:06:08.3588261Z 1610100368,,ui,say,==> azure-arm: Provisioning with windows-shell...
2021-01-08T10:06:08.3596337Z 2021/01/08 10:06:08 packer.exe plugin: Found command: netsh advfirewall set allprofiles state off
2021-01-08T10:06:08.3606379Z 2021/01/08 10:06:08 1610100368,,ui,say,==> azure-arm: Provisioning with shell script: C:\Users\VSSADM1\AppData\Local\Temp\windows-shell-provisioner691624915
2021-01-08T10:06:08.3607080Z 1610100368,,ui,say,==> azure-arm: Provisioning with shell script: C:\Users\VSSADM1\AppData\Local\Temp\windows-shell-provisioner691624915
2021-01-08T10:06:08.3608747Z 2021/01/08 10:06:08 packer.exe plugin: Opening C:\Users\VSSADM1\AppData\Local\Temp\windows-shell-provisioner691624915 for reading
2021-01-08T10:06:08.3615254Z 2021/01/08 10:06:08 packer.exe plugin: [INFO] 44 bytes written for 'uploadData'
2021-01-08T10:06:08.3616736Z 2021/01/08 10:06:08 [INFO] 44 bytes written for 'uploadData'
2021-01-08T10:06:08.3617820Z 2021/01/08 10:06:08 packer.exe plugin: Uploading file to 'c:/Windows/Temp/script.bat'
2021-01-08T10:06:09.5488939Z 2021/01/08 10:06:09 packer.exe plugin: #< CLIXML
2021-01-08T10:06:10.2963930Z 2021/01/08 10:06:10 packer.exe plugin:
I hoped for an error message but there was none.
The same error exists using 20h1-evd-o365pp but works with Windows Server 2019. If Azure Image Builder uses Packer then there must be an issue there too.
we also face a similar issue while executing a PowerShell script file to unzip a zip file through the PowerShell provisioners. The packer completes without unzipping the file completely and starts creating the image , we are using windows 2019
Overview of the Issue
I am using Azure Devops to try building a Windows 10 Enterprise (Azure Marketplace Image SKU: 20h1-ent) image in Azure to be uploaded to a Shared Image Gallery. During the Packer build process I noticed that powershell provisioners time out, while for example windows-shell and windows-restart remain functional. However the powershell provisioners worked fine for Windows 10 Enterprise Multi-Session (Marketplace SKU: 20h1-evd). What might be different between these SKUs that enable or prevent powershell Packer provisioner usage? Can we enable powershell provisioner to work with the plain Windows 10 Enterprise image?
Reproduction Steps
The problem persisted each time I tried running the pipeline, the same was the outcome when I tried different SKUs, like 20h1-ent-g2, 20h1-entn, 20h1-entn-g2.
Packer version
Tried it with versions 1.4.5 and 1.6.5.
Simplified Packer Buildfile
Operating system and Environment details
The build took place on an Azure Devops agent (windows-2019) that uses WinRM to remotely connect to a temporary Azure VM.
Log Fragments and crash.log files
1609923473,,ui,say,==> azure-arm: Waiting for WinRM to become available... 1609923481,,ui,message, azure-arm: WinRM connected. 1609923481,,ui,error,==> azure-arm: #< CLIXML 1609923481,,ui,error,==> azure-arm:System.Management.Automation.PSCustomObject System.Object 1 Preparing modules for first use. 0 -1 -1 Completed -1 1 Preparing modules for first use. 0 -1 -1 Completed -1
1609923481,,ui,say,==> azure-arm: Connected to WinRM!
1609923481,,ui,say,==> azure-arm: Provisioning with windows-shell...
1609923481,,ui,say,==> azure-arm: Provisioning with shell script: C:\Users\VSSADM~1\AppData\Local\Temp\windows-shell-provisioner242678815
1609923483,,ui,message, azure-arm:
1609923483,,ui,message, azure-arm: C:\Users\packer>netsh advfirewall set allprofiles state off
1609923484,,ui,message, azure-arm: Ok.
1609923484,,ui,message, azure-arm:
1609923484,,ui,say,==> azure-arm: Provisioning with Powershell...
1609923484,,ui,say,==> azure-arm: Provisioning with powershell script: C:\Users\VSSADM~1\AppData\Local\Temp\powershell-provisioner554706963