Skip to content

Connection refused when using winrm to build windows kvm image #2445

@spyyang

Description

@spyyang

I use packer.0.8.0 to build windows 2012R2 image by WinRM communicator, having succeed building vmware-iso but failed to build qemu-kvm type using almost same configuration. Packer can not connect the windows instance as the log shows:

packer-builder-qemu: 2015/07/13 11:32:33 [INFO] Attempting WinRM connection...
packer-builder-qemu: 2015/07/13 11:32:33 [DEBUG] connecting to remote shell using WinRM
packer-builder-qemu: 2015/07/13 11:32:33 [ERROR] connection error: unknown error Post http://127.0.0.1:5985/wsman: dial tcp 127.0.0.1:5985: connection refused

I try CLI debugging:
ps -ef |grep packer:

root 50434 50322 84 12:31 pts/2 00:04:49 /usr/bin/qemu-system-x86_64 -machine type=pc,accel=kvm -cdrom /opt/iso/win-2012R2.iso -name win2k12r2-kvm-prod -m 4096M -smp 4 -device virtio-net,netdev=user.0 -fda /tmp/packer312230827 -netdev user,id=user.0,hostfwd=tcp::3499-:5985 -drive file=/opt/packer-output/prod/spyang_test/win-2012R2/win2k12r2-kvm-prod,if=virtio,cache=writeback,discard=ignore -boot once=d -vnc 0.0.0.0:87

curl -v http://127.0.0.1:5985/wsman:

* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* connect to 127.0.0.1 port 5985 failed: Connection refused
* Failed to connect to 127.0.0.1 port 5985: Connection refused
* Closing connection 0
curl: (7) Failed to connect to 127.0.0.1 port 5985: Connection refused

curl -v http://127.0.0.1:3499/wsman:

* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 3499 (#0)
> GET /wsman HTTP/1.1
> User-Agent: curl/7.35.0
> Host: 127.0.0.1:3499
> Accept: */*
> 
< HTTP/1.1 405 
< Allow: POST
* Server Microsoft-HTTPAPI/2.0 is not blacklisted
< Server: Microsoft-HTTPAPI/2.0
< Date: Sun, 12 Jul 2015 21:00:58 GMT
< Connection: close
< Content-Length: 0
< 
* Closing connection 0

I suspect packer should connect to http://127.0.0.1:3499/wsman not 5985. Thanks for your help.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions