Packer build is failing "errored: Timeout waiting for machine to restart."

261 views
Skip to first unread message

MKEERTHY

unread,
Jul 14, 2020, 12:55:46 PM7/14/20
to Packer

Hi,

I have tried building 2 different ways by giving Pause-before and windows restart as follows.. Both builds still are timing out. Can some one please help me?

Also when it says ==> windows-server-2019: Provisioning step had errors: Running the cleanup provisioner, if present... how can i know what exactly is the error that the step was failing on?



with packer build -debug option and packer windows-restart provisioner with pause_before
{
"type": "windows-restart",
"pause_before": "300s"
}
==> windows-server-2019: Pausing before the next provisioner . Press enter to continue.
==> windows-server-2019: Provisioning with Powershell...
==> windows-server-2019: Provisioning with powershell script: /var/folders/pm/m38brgss06x14djhjgps7w180000gs/T/powershell-provisioner952503076
windows-server-2019: Restart Computer
==> windows-server-2019: Pausing before the next provisioner . Press enter to continue.
==> windows-server-2019: Pausing 20s before the next provisioner...
==> windows-server-2019: Provisioning with Powershell...
==> windows-server-2019: Provisioning with powershell script: /var/folders/pm/m38brgss06x14djhjgps7w180000gs/T/powershell-provisioner027517984
==> windows-server-2019: Provisioning step had errors: Running the cleanup provisioner, if present...
==> windows-server-2019: Pausing before cleanup of step 'StepConnect'. Press enter to continue.
==> windows-server-2019: Pausing before cleanup of step 'StepCreateSSMTunnel'. Press enter to continue.
==> windows-server-2019: Pausing before cleanup of step 'StepGetPassword'. Press enter to continue.
==> windows-server-2019: Pausing before cleanup of step 'StepRunSourceInstance'. Press enter to continue.
==> windows-server-2019: Terminating the source AWS instance...
==> windows-server-2019: Error terminating instance, may still be around: RequestExpired: Request has expired.

==> windows-server-2019: status code: 400, request id: 7f3f0dc7-f669-4fe9-bdbb-358f7d875cc7
==> windows-server-2019: Pausing before cleanup of step 'StepCleanupVolumes'. Press enter to continue. ==> windows-server-2019: Cleaning up any extra volumes...
==> windows-server-2019: Error describing volumes: RequestExpired: Request has expired.

==> windows-server-2019: status code: 400, request id: 0f3aeb2f-1777-479b-8883-431d3164cffe
==> windows-server-2019: Pausing before cleanup of step 'StepIamInstanceProfile'. Press enter to continue. ==> windows-server-2019: Pausing before cleanup of step 'StepSecurityGroup'. Press enter to continue.
==> windows-server-2019: Pausing before cleanup of step 'StepKeyPair'. Press enter to continue.
==> windows-server-2019: Deleting temporary keypair...
==> windows-server-2019: Error cleaning up keypair. Please delete the key manually: packer_5f0dbf66-bd4c-da33-4a8c-ab554d83df82

==> windows-server-2019: Pausing before cleanup of step 'StepNetworkInfo'. Press enter to continue. ==> windows-server-2019: Pausing before cleanup of step 'StepSourceAMIInfo'. Press enter to continue. ==> windows-server-2019: Pausing before cleanup of step 'StepPreValidate'. Press enter to continue.
Build 'windows-server-2019' errored: Error processing command: Error uploading ps script containing env vars: Error uploading file to $env:TEMP\winrmcp-4d3ca262-24e4-43a7-49ab-b46a0067dc7e.tmp: Couldn't create shell: http response error: 401 - invalid content type

==> Some builds didn't complete successfully and had errors:
--> windows-server-2019: Error processing command: Error uploading ps script containing env vars: Error uploading file to $env:TEMP\winrmcp-4d3ca262-24e4-43a7-49ab-b46a0067dc7e.tmp: Couldn't create shell: http response error: 401 - invalid content type

==> Builds finished but no artifacts were created.



and with packer_log option and restart windows:
{
"type": "powershell",
"inline": [ "echo "Restart Computer"; Start-Sleep 5; Restart-Computer -force" ]
},
{
"pause_before": "20s",
"type": "powershell",
"inline": [ "echo "Sleep 60"; Start-Sleep 60" ]
},

2020/07/14 09:39:07 packer-builder-amazon-ebs plugin: Uploading file to 'c:/Windows/Temp/packer-cleanup-5f0dc1e8-952d-23eb-1f39-ba5f0e87b03d.ps1'
2020/07/14 09:39:09 packer-builder-amazon-ebs plugin: #< CLIXML
2020/07/14 09:39:10 packer-builder-amazon-ebs plugin: System.Management.Automation.PSCustomObjectSystem.Object1Preparing modules for first use.0-1-1Completed-1 #< CLIXML
2020/07/14 09:39:10 packer-builder-amazon-ebs plugin: System.Management.Automation.PSCustomObjectSystem.Object1Preparing modules for first use.0-1-1Completed-1 [INFO] starting remote command: powershell -executionpolicy bypass "& { if (Test-Path variable:global:ProgressPreference){set-variable -name variable:global:ProgressPreference -value 'SilentlyContinue'};. c:/Windows/Temp/packer-ps-env-vars-5f0dc1e8-6629-5754-157d-6597ba2cce9d.ps1; &'c:/Windows/Temp/packer-cleanup-5f0dc1e8-952d-23eb-1f39-ba5f0e87b03d.ps1'; exit $LastExitCode }"
2020/07/14 09:39:11 packer-builder-amazon-ebs plugin: [INFO] command 'powershell -executionpolicy bypass "& { if (Test-Path variable:global:ProgressPreference){set-variable -name variable:global:ProgressPreference -value 'SilentlyContinue'};. c:/Windows/Temp/packer-ps-env-vars-5f0dc1e8-6629-5754-157d-6597ba2cce9d.ps1; &'c:/Windows/Temp/packer-cleanup-5f0dc1e8-952d-23eb-1f39-ba5f0e87b03d.ps1'; exit $LastExitCode }"' exited with code: 0
2020/07/14 09:39:11 packer-builder-amazon-ebs plugin: [INFO] RPC endpoint: Communicator ended with: 0
2020/07/14 09:39:11 [INFO] 0 bytes written for 'stdout'
2020/07/14 09:39:11 [INFO] 0 bytes written for 'stderr'
2020/07/14 09:39:11 [INFO] RPC client: Communicator ended with: 0
2020/07/14 09:39:11 [INFO] RPC endpoint: Communicator ended with: 0
2020/07/14 09:39:11 packer-provisioner-powershell plugin: [INFO] 0 bytes written for 'stdout'
2020/07/14 09:39:11 packer-provisioner-powershell plugin: [INFO] 0 bytes written for 'stderr'
2020/07/14 09:39:11 packer-provisioner-powershell plugin: [INFO] RPC client: Communicator ended with: 0
2020/07/14 09:39:11 [INFO] (telemetry) ending powershell
2020/07/14 09:39:11 [INFO] (telemetry) Starting provisioner windows-restart
2020/07/14 09:39:11 ui: �[1;32m==> windows-server-2016: Pausing 1m0s before the next provisioner...�[0m
2020/07/14 09:40:11 ui: �[1;32m==> windows-server-2016: Restarting Machine�[0m
2020/07/14 09:40:11 packer-builder-amazon-ebs plugin: [INFO] starting remote command: shutdown /r /f /t 0 /c "packer restart"
2020/07/14 09:40:12 packer-builder-amazon-ebs plugin: [INFO] command 'shutdown /r /f /t 0 /c "packer restart"' exited with code: 0
2020/07/14 09:40:12 packer-builder-amazon-ebs plugin: [INFO] RPC endpoint: Communicator ended with: 0
2020/07/14 09:40:12 [INFO] 0 bytes written for 'stdout'
2020/07/14 09:40:12 [INFO] 0 bytes written for 'stderr'
2020/07/14 09:40:12 [INFO] RPC client: Communicator ended with: 0
2020/07/14 09:40:12 [INFO] RPC endpoint: Communicator ended with: 0
2020/07/14 09:40:12 packer-provisioner-windows-restart plugin: [INFO] 0 bytes written for 'stderr'
2020/07/14 09:40:12 packer-provisioner-windows-restart plugin: [INFO] 0 bytes written for 'stdout'
2020/07/14 09:40:12 packer-provisioner-windows-restart plugin: [INFO] RPC client: Communicator ended with: 0
2020/07/14 09:40:12 ui: �[1;32m==> windows-server-2016: Waiting for machine to restart...�[0m
2020/07/14 09:40:12 packer-provisioner-windows-restart plugin: Check if machine is rebooting...
2020/07/14 09:40:12 packer-builder-amazon-ebs plugin: [INFO] starting remote command: shutdown /r /f /t 60 /c "packer restart test"
2020/07/14 09:40:12 packer-builder-amazon-ebs plugin: [INFO] command 'shutdown /r /f /t 60 /c "packer restart test"' exited with code: 0
2020/07/14 09:40:12 packer-builder-amazon-ebs plugin: [INFO] RPC endpoint: Communicator ended with: 0
2020/07/14 09:40:12 [INFO] 0 bytes written for 'stdout'
2020/07/14 09:40:12 [INFO] 0 bytes written for 'stderr'
2020/07/14 09:40:12 [INFO] RPC client: Communicator ended with: 0
2020/07/14 09:40:12 [INFO] RPC endpoint: Communicator ended with: 0
2020/07/14 09:40:12 packer-provisioner-windows-restart plugin: [INFO] 0 bytes written for 'stdout'
2020/07/14 09:40:12 packer-provisioner-windows-restart plugin: [INFO] 0 bytes written for 'stderr'
2020/07/14 09:40:12 packer-provisioner-windows-restart plugin: [INFO] RPC client: Communicator ended with: 0
2020/07/14 09:40:20 [INFO] 0 bytes written for 'stdout'
2020/07/14 09:40:20 [INFO] 0 bytes written for 'stderr'
2020/07/14 09:40:20 packer-provisioner-windows-restart plugin: [INFO] 0 bytes written for 'stdout'
2020/07/14 09:40:20 packer-provisioner-windows-restart plugin: [INFO] 0 bytes written for 'stderr'
2020/07/14 09:40:20 packer-provisioner-windows-restart plugin: Waiting for machine to reboot with timeout: 15m0s
2020/07/14 09:40:20 packer-provisioner-windows-restart plugin: Waiting for machine to become available...
2020/07/14 09:40:20 packer-provisioner-windows-restart plugin: Checking that communicator is connected with: 'powershell.exe -EncodedCommand ZQBjAGgAbwAgACgAIgB7ADAAfQAgAHIAZQBzAHQAYQByAHQAZQBkAC4AIgAgAC0AZgAgAFsAUwB5AHMAdABlAG0ALgBOAGUAdAAuAEQAbgBzAF0AOgA6AEcAZQB0AEgAbwBzAHQATgBhAG0AZQAoACkAKQA='
2020/07/14 09:40:32 [INFO] 0 bytes written for 'stderr'
2020/07/14 09:40:32 [INFO] 0 bytes written for 'stdout'
2020/07/14 09:40:32 packer-provisioner-windows-restart plugin: [INFO] 0 bytes written for 'stdout'
2020/07/14 09:40:32 packer-provisioner-windows-restart plugin: [INFO] 0 bytes written for 'stderr'
2020/07/14 09:40:32 packer-provisioner-windows-restart plugin: echo didn't succeed; retrying...
2020/07/14 09:40:38 [INFO] 0 bytes written for 'stdout'
2020/07/14 09:40:38 [INFO] 0 bytes written for 'stderr'
2020/07/14 09:55:09 packer-provisioner-windows-restart plugin: [INFO] 0 bytes written for 'stdout'
2020/07/14 09:55:09 packer-provisioner-windows-restart plugin: [INFO] 0 bytes written for 'stderr'
2020/07/14 09:55:09 packer-provisioner-windows-restart plugin: echo didn't succeed; retrying...
2020/07/14 09:55:12 ui error: �[1;31m==> windows-server-2016: Timeout waiting for machine to restart.�[0m
2020/07/14 09:55:12 [INFO] (telemetry) ending windows-restart
2020/07/14 09:55:12 ui: �[1;32m==> windows-server-2016: Provisioning step had errors: Running the cleanup provisioner, if present...�[0m
2020/07/14 09:55:12 ui: �[1;32m==> windows-server-2016: Terminating the source AWS instance...�[0m
2020/07/14 09:55:14 packer-provisioner-windows-restart plugin: echo didn't succeed; retrying...
2020/07/14 09:55:19 packer-provisioner-windows-restart plugin: echo didn't succeed; retrying...
2020/07/14 09:55:19 packer-provisioner-windows-restart plugin: [ERR] 'stdout' accept error: timeout waiting for accept
2020/07/14 09:55:19 packer-provisioner-windows-restart plugin: [ERR] 'stderr' accept error: timeout waiting for accept
2020/07/14 09:55:19 packer-provisioner-windows-restart plugin: [ERR] Error accepting response stream 486: timeout waiting for accept
2020/07/14 09:55:24 packer-provisioner-windows-restart plugin: [ERR] 'stderr' accept error: timeout waiting for accept
2020/07/14 09:55:24 packer-provisioner-windows-restart plugin: echo didn't succeed; retrying...
2020/07/14 09:55:24 packer-provisioner-windows-restart plugin: [ERR] 'stdout' accept error: timeout waiting for accept
2020/07/14 09:55:24 packer-provisioner-windows-restart plugin: [ERR] Error accepting response stream 489: timeout waiting for accept
2020/07/14 09:55:29 packer-provisioner-windows-restart plugin: [ERR] 'stderr' accept error: timeout waiting for accept
2020/07/14 09:55:29 packer-provisioner-windows-restart plugin: [ERR] 'stdout' accept error: timeout waiting for accept
2020/07/14 09:55:29 packer-provisioner-windows-restart plugin: echo didn't succeed; retrying...
2020/07/14 09:55:29 packer-provisioner-windows-restart plugin: [ERR] Error accepting response stream 492: timeout waiting for accept
2020/07/14 09:55:34 packer-provisioner-windows-restart plugin: echo didn't succeed; retrying...
2020/07/14 09:55:34 packer-provisioner-windows-restart plugin: [ERR] 'stdout' accept error: timeout waiting for accept
2020/07/14 09:55:34 packer-provisioner-windows-restart plugin: [ERR] 'stderr' accept error: timeout waiting for accept
2020/07/14 09:55:34 packer-provisioner-windows-restart plugin: [ERR] Error accepting response stream 495: timeout waiting for accept
2020/07/14 09:55:39 packer-provisioner-windows-restart plugin: [ERR] 'stderr' accept error: timeout waiting for accept
2020/07/14 09:55:39 packer-provisioner-windows-restart plugin: [ERR] 'stdout' accept error: timeout waiting for accept
2020/07/14 09:55:39 packer-provisioner-windows-restart plugin: echo didn't succeed; retrying...
2020/07/14 09:55:39 packer-provisioner-windows-restart plugin: [ERR] Error accepting response stream 498: timeout waiting for accept
2020/07/14 09:55:43 ui: �[1;32m==> windows-server-2016: Cleaning up any extra volumes...�[0m
2020/07/14 09:55:43 ui: �[1;32m==> windows-server-2016: No volumes to clean up, skipping�[0m
2020/07/14 09:55:43 ui: �[1;32m==> windows-server-2016: Deleting temporary keypair...�[0m
2020/07/14 09:55:44 [INFO] (telemetry) ending amazon-ebs
2020/07/14 09:55:44 ui error: �[1;31mBuild 'windows-server-2016' errored: Timeout waiting for machine to restart.�[0m
2020/07/14 09:55:44 machine readable: error-count []string{"1"}
2020/07/14 09:55:44 ui error:
==> Some builds didn't complete successfully and had errors:
2020/07/14 09:55:44 machine readable: windows-server-2016,error []string{"Timeout waiting for machine to restart."}
2020/07/14 09:55:44 ui error: --> windows-server-2016: Timeout waiting for machine to restart.
2020/07/14 09:55:44 ui:
==> Builds finished but no artifacts were created.
2020/07/14 09:55:44 [INFO] (telemetry) Finalizing.
2020/07/14 09:55:44 packer-provisioner-windows-restart plugin: [ERR] 'stderr' accept error: timeout waiting for accept
2020/07/14 09:55:44 packer-provisioner-windows-restart plugin: [ERR] 'stdout' accept error: timeout waiting for accept
2020/07/14 09:55:44 packer-provisioner-windows-restart plugin: echo didn't succeed; retrying...
2020/07/14 09:55:44 packer-provisioner-windows-restart plugin: [ERR] Error accepting response stream 501: timeout waiting for accept
2020/07/14 09:55:46 [WARN] (telemetry) Error finalizing report. This is safe to ignore. Post "https://checkpoint-api.hashicorp.com/v1/telemetry/packer": context deadline exceeded
2020/07/14 09:55:46 waiting for all plugin processes to complete...
2020/07/14 09:55:46 /usr/local/bin/packer: plugin process exited
2020/07/14 09:55:46 /usr/local/bin/packer: plugin process exited
2020/07/14 09:55:46 /usr/local/bin/packer: plugin process exited
2020/07/14 09:55:46 /usr/local/bin/packer: plugin process exited
2020/07/14 09:55:46 /usr/local/bin/packer: plugin process exited
2020/07/14 09:55:46 /usr/local/bin/packer: plugin process exited
2020/07/14 09:55:46 /usr/local/bin/packer: plugin process exited
2020/07/14 09:55:46 /usr/local/bin/packer: plugin process exited
2020/07/14 09:55:46 [ERR] Error decoding response stream 23: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 146: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 155: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 494: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 122: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 143: EOF
2020/07/14 09:55:46 /usr/local/bin/packer: plugin process exited
2020/07/14 09:55:46 [ERR] Error decoding response stream 119: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 446: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 68: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 287: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 341: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 101: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 302: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 284: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 41: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 311: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 35: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 263: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 62: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 440: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 239: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 425: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 458: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 86: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 338: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 98: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 410: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 137: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 56: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 59: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 161: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 95: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 257: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 443: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 221: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 389: EOF
2020/07/14 09:55:46 [ERR] Error decoding response stream 350: EOF

Reply all
Reply to author
Forward
0 new messages