-
Notifications
You must be signed in to change notification settings - Fork 20
Description
While debugging my last issue with windows updates timing out after 2 hours, I definitely had a series of reboot provisioners successfully rebooting a Win2012 packer build. Now we have solved the timeout problems, it seems the reboot provisioner is now returning non-zero and killing the packer run.
What I am trying to achieve is: fresh win2012 build from ISO, install windows upates, reboot, install further updates, reboot, one final check for outstanding updates, create vagrant box file.
The provisioners section of my packer template looks like this:
{
"type": "powershell",
"elevated_user": "{{user `winrm_userid`}}",
"elevated_password": "{{user `winrm_password`}}",
"inline": [
"Import-Module Boxstarter.WinConfig",
"Install-WindowsUpdate -acceptEula -suppressReboots"
]
},
{
"type": "restart-windows"
},
{
"type": "powershell",
"elevated_user": "{{user `winrm_userid`}}",
"elevated_password": "{{user `winrm_password`}}",
"inline": [
"Import-Module Boxstarter.WinConfig",
"Install-WindowsUpdate -acceptEula -suppressReboots"
]
},
{
"type": "restart-windows"
},
Running packer with debug output gives the following:
2015/05/18 13:08:02 ui: ==> VBoxWin2012: Restarting Machine
2015-05-18 13:08:02 ==> VBoxWin2012: Restarting Machine
2015/05/18 13:08:02 packer-builder-virtualbox-windows-iso: 2015/05/18 13:08:02 starting remote command: shutdown /r /c "packer restart" /t 5 && net stop winrm
2015/05/18 13:08:03 packer-builder-virtualbox-windows-iso: 2015/05/18 13:08:03 [INFO] RPC endpoint: Communicator ended with: 1
2015/05/18 13:08:03 [INFO] 0 bytes written for 'stderr'
2015/05/18 13:08:03 [INFO] 0 bytes written for 'stdout'
2015/05/18 13:08:03 [INFO] RPC client: Communicator ended with: 1
2015/05/18 13:08:03 [INFO] RPC endpoint: Communicator ended with: 1
2015/05/18 13:08:03 packer-provisioner-restart-windows.orig: 2015/05/18 13:08:03 [INFO] RPC client: Communicator ended with: 1
2015/05/18 13:08:03 packer-provisioner-restart-windows.orig: 2015/05/18 13:08:03 [INFO] 0 bytes written for 'stdout'
2015/05/18 13:08:03 packer-provisioner-restart-windows.orig: 2015/05/18 13:08:03 [INFO] 0 bytes written for 'stderr'
2015/05/18 13:08:03 ui: ask: ==> VBoxWin2012: Pausing before cleanup of step 'StepUploadGuestAdditions'. Press enter to continue.
The VM does reboot, but packer then terminates due to the non-zero exit from the provisioner.
If I try to manually run the shutdown command from a powershell window, it throws the following error - "The token '&&' is not a valid statement separator in this version."
I have even tried reverting to an earlier version of the packer-provisioner-restart-windows binary but I still get the same error.
Can anyone suggest anywhere else I can try looking to figure out why the reboot is not working ?