Packer timeouts waiting for the WinRM to become available

1,095 views
Skip to first unread message

Tushar Sappal

unread,
Dec 19, 2017, 4:47:49 AM12/19/17
to Packer
hey ,
I am trying building an Image via Packer for Azure .. I am trying to build a Windows Server 2012 R2 image and it seems the packer build fails even though I am setting `"winrm_timeout": "20m",` ( which is a huge number ) .. I am following some of the git bugs but none is able to provide me what might be causing the issue .. Can some one provide any context on this ?



A point to note that on Azure portal the VM is shown up and running ( from which the Image needs to be extracted ) .


 



```==> azure-arm: Timeout waiting for WinRM.
==> azure-arm:
==> azure-arm: Cleanup requested, deleting resource group ...```
This is the error that I am getting ..


Providing the sample json file that I am using 


Enter code here..
{
  "builders": [{
    "type": "azure-arm",

    "client_id": "XXXXX",
    "client_secret": "XXXX",
    "resource_group_name": "testPacker",
    "storage_account": "testpackerstorage",
    "subscription_id": "XXXX",
    "tenant_id": "XXX",
    "object_id": "XXX",

    "capture_container_name": "images",
    "capture_name_prefix": "packer",

    "os_type": "Windows",
    "image_publisher": "MicrosoftWindowsServer",
    "image_offer": "WindowsServer",
    "image_sku": "2012-R2-Datacenter",

    "communicator": "winrm",
    "winrm_use_ssl": "true",
    "winrm_insecure": "true",
    "winrm_username": "packer",
    "winrm_timeout": "20m",

    "location": "EAST US2",
    "vm_size": "Standard_DS2_v2"
  }],
  "provisioners": [{
    "type": "powershell",
    "inline": [
      "if( Test-Path $Env:SystemRoot\\windows\\system32\\Sysprep\\unattend.xml ){ rm $Env:SystemRoot\\windows\\system32\\Sysprep\\unattend.xml -Force}",
      "& $env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /oobe /generalize /quiet /quit",
      "while($true) { $imageState = Get-ItemProperty HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State | Select ImageState; if($imageState.ImageState -ne 'IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE') { Write-Output $imageState.ImageState; Start-Sleep -s 10  } else { break } }"
    ]
  }]
}



b...@tanners.org

unread,
Dec 19, 2017, 2:20:09 PM12/19/17
to Packer
What version packer?

I had the same problem and upgrading to 1.1.3 resolved my problem.
Reply all
Reply to author
Forward
0 new messages