hashicorp / packer

Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.
http://www.packer.io
Other
15.03k stars 3.32k forks source link

Frequent timeouts while creating winrm password in GCP #11984

Open csomisetty-clgx opened 1 year ago

csomisetty-clgx commented 1 year ago

We are getting timeouts from winrm while creating password for the windows2019 instance in GCP. Below are the logs attached

image

Config: "builders": [ { "zone": "{{ user gcp_zone }}", "image_name": "{{ user gcp_image_name }}", "image_family": "packer-cl-windows-2019-engines-mig", "type": "googlecompute", "project_id": "{{ user gcp_project_id }}", "source_image_project_id": "{{ user gcp_source_image_project_id }}", "source_image_family": cl-windows-2019, "network_project_id": "{{ user gcp_shared_vpc_network_project_id }}", "subnetwork": "{{ user gcp_shared_vpc_subnetwork }}", "disk_size": "150", "machine_type": "n1-standard-4", "omit_external_ip": "true", "use_internal_ip": "true", "tags": ["allow-rdp", "allow-winrm", "allow-dl-health-checks", "windows", "windows-domain", "windows-domain-member"], "communicator": "winrm", "winrm_username": "{{ user gcp_winrm_username }}", "winrm_timeout": "1h15m", "winrm_insecure": true, "winrm_use_ssl": true, "metadata": { "windows-startup-script-cmd": "winrm quickconfig -quiet & net user /add {{ user gcp_winrm_username }} & net localgroup administrators {{ user gcp_winrm_username }} /add" } }

lbajolet-hashicorp commented 1 year ago

Hi @csomisetty-clgx,

Just looking at the configuration, it's hard to explain the reason of the timeouts as they could be diverse (the password creation process can take long for many reasons: latency, slow host, memory contention, etc.). To circumvent your problem, have you considered using the windows_password_timeout environment variable? This defaults to 3m right now, and it is likely the reason why you see the error message you're experiencing, maybe bumping this will fix your problem on its own?

For more precision, you mention frequent timeouts, I assume this sometimes succeed? In order to get more information about the root cause, could you run Packer with the PACKER_LOG=1 environment variable?

csomisetty-clgx commented 1 year ago

Hi @lbajolet-hashicorp , Thanks for the reply.

Below are the logs with PACKER_LOG=1 env variable and windows_password_timeout set to 15m

16:12:53 googlecompute: Instance has been created! 16:12:53 ==> googlecompute: Creating windows user for instance... 16:12:53 googlecompute: Waiting for windows password to complete... 16:12:54 2022/09/30 10:42:54 packer-builder-googlecompute plugin: Retryable error: retrying for state DONE, got RUNNING 16:28:01 ==> googlecompute: Error creating windows password: time out while waiting for the password to be created