Win10 1809 issue

So I have a packer build that works fine with 1903 and up but when I try to build a 1809 windows 10 enterprise image it keeps erroring out stating “provisioning step had errors”. I call in the json file for a reboot since I know the windows update script that is running will reboot the machine. When it starts rebooting it just hangs there and the VM will reboot but packer isn’t reconnecting it seems and seeing that the VM has indeed rebooted. I am fairly new with packer so please let me know what I could provide to help you all with assisting me.

You probably need to use a windows_restart provisioner with the check_registry flag set to tell your provisioner to wait until the windows reboots are not only complete, but that the registry key telling windows to continue rebooting is cleared.

The other option is to run all of your windows updates that require reboots before Packer tries to connect via WinRM, either via an autounattend file if you’re building from an iso or a user_data_file or other preflight config if you’re doing a cloud build. Without more information about what you’re doing, I think that’s all the advice I can give.

Thank you, funny enough that is what I am currently trying this morning.

I have tried in the past to run the windows updates in the unattend but I cant seem to figure out how to get the template to hold until the update script is done. It seems like it just runs through the unattend and doesn’t ever stop. Then it shuts down the machine before the windows updates running through the unattend are done. Am I missing something to get packer to hold until windows updates has finished?

If you configure winrm or ssh as part of your unattend, Packer will wait until it is able to connect to WinRM. If you make the winrm configuration the very last step of your unattend, it forces Packer to wait for the entire unattend to run before it shuts down the VM and exits.

1 Like