Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout waiting for WinRM #8

Closed
tpetchel opened this issue Jul 28, 2015 · 9 comments
Closed

Timeout waiting for WinRM #8

tpetchel opened this issue Jul 28, 2015 · 9 comments

Comments

@tpetchel
Copy link
Contributor

First, I just want to say that this is a great contribution, and something that will make it easy for folks to create Windows Server boxes that they can use with Vagrant and Test Kitchen.

I downloaded the .iso and ran packer. It was taking a long time (hours) for the Windows Updates to complete, so I walked away from my computer for awhile. When I came back, the process completed with errors.

Here's my output. Did I miss something along the way?

packer build -force vbox-2012r2.json
virtualbox-iso output will be in this color.

==> virtualbox-iso: Downloading or copying ISO
    virtualbox-iso: Downloading or copying: file:///iso/9600.17050.WINBLUE_REFRESH.140317-1640_X64FRE_SERVER_EVAL_EN-US-IR3_SSS_X64FREE_EN-US_DV9.ISO
==> virtualbox-iso: Creating floppy disk...
    virtualbox-iso: Copying: answer_files/2012_r2/Autounattend.xml
    virtualbox-iso: Copying: scripts/postunattend.xml
    virtualbox-iso: Copying: scripts/boxstarter.ps1
    virtualbox-iso: Copying: scripts/package.ps1
==> virtualbox-iso: Creating virtual machine...
==> virtualbox-iso: Creating hard drive...
==> virtualbox-iso: Attaching floppy disk...
==> virtualbox-iso: Creating forwarded port mapping for SSH (host port 2322)
==> virtualbox-iso: Executing custom VBoxManage commands...
    virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1438092104 --natpf1 guest_winrm,tcp,,55985,,5985
    virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1438092104 --memory 2048
    virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1438092104 --cpus 2
==> virtualbox-iso: Starting the virtual machine...
==> virtualbox-iso: Waiting 10s for boot...
==> virtualbox-iso: Typing the boot command...
==> virtualbox-iso: Waiting for WinRM to become available...
==> virtualbox-iso: Timeout waiting for WinRM.
==> virtualbox-iso: Unregistering and deleting virtual machine...
==> virtualbox-iso: Deleting output directory...
Build 'virtualbox-iso' errored: Timeout waiting for WinRM.

==> Some builds didn't complete successfully and had errors:
--> virtualbox-iso: Timeout waiting for WinRM.

==> Builds finished but no artifacts were created.
@mwrock
Copy link
Owner

mwrock commented Jul 28, 2015

Yeah it takes almost 5 hours on my test host box. I've seen it complete just 10 minutes short of the 5 hour timeout so it might be a good idea to extend to 8h (ugh). I do think there are things to be done to speed up the updates. However the dism and file zapping take a while too but clearly the updates take the longest by far.

The idea here is that building images is an infrequent event as opposed to provisioning VMs. So I'm willing to put up with the wait but it does suck that packer deletes the artifacts on failure making it difficult to troubleshoot.

@tpetchel
Copy link
Contributor Author

Hi Matt,

My feedback wasn't about the length of time it takes to run so much as the error that I'm getting. Notice above that it fails with this error:

Build 'virtualbox-iso' errored: Timeout waiting for WinRM.

I don't see any other instructions in the README besides downloading the .iso and running packer. Any idea whether there's another step involved?

@mwrock
Copy link
Owner

mwrock commented Jul 28, 2015

Sorry for the misunderstanding. I go into alot more detail in my blog post.

The packer flow is that once it can connect via winrm, it shuts down the box and starts the provisioners. I dont put all the setup stuff in a provisioner because boxstarter reboots would cause that to fail. So instead, I leave winrm off until everything is done. This way packer just waits until the whole process is complete and thats why I was talking about the timeout.

If it does not complete before the timeout. Packer fails the entire build.

@tpetchel
Copy link
Contributor Author

Got it now! I'll give that a shot and close the issue after confirming. Thanks Matt :)

@tpetchel
Copy link
Contributor Author

OK, I tried again and it worked great! Sounds like it didn't complete in the timeout period the first time (computer went to sleep perhaps?), but did the second time.

@mwrock: thanks for the help.

@jeauxbleaux
Copy link

Pardon for the late entry, I've rather basic question. my packer build hosts are on redhat and debian. Is the winrm communicator for when the build host is a windows box?

thx

@mwrock
Copy link
Owner

mwrock commented Oct 7, 2015

These still use a winrm communicator even though they are linux hosts. The main difference on linux hosts (assuming you are running as a server and not desktop) is that the VirtualBox build is headless and therefore you cant see into what the VM is doing while the host is waiting for WinRM to connect.

@jeauxbleaux
Copy link

OK. So the communicators (winrm, ssh) are truly build host agnostic. That's what I was hoping. Thanks!

@prashant645
Copy link

Hi Matt Sorry again for the late entry. Iam facing the same issue of winrm getting timed out .Please suggest any solution in regards with this since I have been lingering on the step for nearly 2 days. I have also set the winrm timeout to 8 hrs but also the winrm is timing out.
Below is the output which I have attached please check it and let me know a solution

PS C:\Users\panugpr1\Desktop\chef-repo\packer-templates-master> .\packer.exe build -force -only virtualbox-iso vbox-2012r2.json
virtualbox-iso output will be in this color.

==> virtualbox-iso: Downloading or copying Guest additions
virtualbox-iso: Downloading or copying: file:///C:/Program%20Files/Oracle/VirtualBox/VBoxGuestAdditions.iso
==> virtualbox-iso: Downloading or copying ISO
virtualbox-iso: Downloading or copying: file:///C:/Users/panugpr1/Desktop/chef-repo/packer-templates-master/iso/9600.17050.WIN
BLUE_REFRESH.140317-1640_X64FRE_SERVER_EVAL_EN-US-IR3_SSS_X64FREE_EN-US_DV9.ISO
==> virtualbox-iso: Creating floppy disk...
virtualbox-iso: Copying: answer_files/2012_r2/Autounattend.xml
virtualbox-iso: Copying: scripts/oracle.cer
virtualbox-iso: Copying: scripts/postunattend.xml
virtualbox-iso: Copying: scripts/boxstarter.ps1
virtualbox-iso: Copying: scripts/PackerShutdown.bat
virtualbox-iso: Copying: scripts/package.ps1
virtualbox-iso: Copying: scripts/SetupComplete-2012.cmd
virtualbox-iso: Copying: scripts/Test-Command.ps1
==> virtualbox-iso: Creating virtual machine...
==> virtualbox-iso: Creating hard drive...
==> virtualbox-iso: Attaching floppy disk...
==> virtualbox-iso: Creating forwarded port mapping for communicator (SSH, WinRM, etc) (host port 2781)
==> virtualbox-iso: Executing custom VBoxManage commands...
virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1459396712 --natpf1 guest_winrm,tcp,,55985,,5985
virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1459396712 --memory 2048
virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1459396712 --vram 48
virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1459396712 --cpus 2
==> virtualbox-iso: Starting the virtual machine...
==> virtualbox-iso: Waiting 10s for boot...
==> virtualbox-iso: Typing the boot command...
==> virtualbox-iso: Waiting for WinRM to become available...

==> virtualbox-iso: Timeout waiting for WinRM.
==> virtualbox-iso: Unregistering and deleting virtual machine...
==> virtualbox-iso: Deleting output directory...
Build 'virtualbox-iso' errored: Timeout waiting for WinRM.

==> Some builds didn't complete successfully and had errors:
--> virtualbox-iso: Timeout waiting for WinRM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants