mwrock / packer-templates

Templates for creating vagrant boxes
Other
536 stars 250 forks source link

Build 'virtualbox-iso' errored: Timeout waiting for WinRM #35

Open jcii opened 8 years ago

jcii commented 8 years ago

Hi Matt,

Thanks for the awesome work on packer and boxstarter! I am running the packer-template for 2012r2 to get a current 90 day license. I left it running last night, but it errored out waiting on all the windows patching.

I'm in Seattle on Comcast 100mbps...is it possible to cache any of those window patches? Do I have any other options to get this to complete? I'm re-running now...

-Jimmy

mwrock commented 8 years ago

Yeah its a pretty terrible experience. Are you running with a gui? If it times out waiting for WinRM, it could be there was an error in the underlying box that you might be able t osee with the gui. However if you are like me, you may have gone to sleep only to wake up with that error message and a deleted VM. I believe there is a separate packer issue around preserving the VM when things go wrong.

Another potential issue is that it just was not finished by the end of the timeout. The timeout is 8 hours which is usually adequate but may need to be extended if your host is extremely under resourced. I suspect its not bandwidth thats the issue but would be more likely RAM/Disk. The machine I run this on is my daughters old laptop with a busted monitor but works fine if I RDP to it. Its not that beefy (I5/6GB/HDD (not SSD)).

jcii commented 8 years ago

currently im on an Ubuntu 14.04 host, which is an i7-something w/ 32GB of ram...I believe the VM is configured with 2 procs and 2GB of ram. SSD disk.

I edited the packer json to extend the timeout to 16 hours. The error from last night did go away with packer's cleanup. The linux terminal said something about Timeour waiting for WinRM so I assume it took longer than 8 hours. I'll update later when it completes or errors out.

If it completes, I'll upload it to Azure. My ultimate plan is to apply a chef cookbook that installs vs2015 community and include a Vagrantfile in my OS project.

mwrock commented 8 years ago

Well thats certainly beefy enough :) I'd bet it didn't just timeout but there was an error in the setup but after 8 hours, packer timed out and it all went away. Extending the timeout is good since it should give you more time to see the real issue in the vbox gui.

bradwilliamson commented 8 years ago

I am seeing the Timeout waiting for WinRM from my powershell session on my host.

==> 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: http://care.dlservice.microsoft.com/dl/download/6/2/A/62A76ABB-9990-4EFC-A4FE-C7D698DAEB96/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/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 3364) ==> virtualbox-iso: Executing custom VBoxManage commands... virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1458938405 --natpf1 guest_winrm,tcp,,55985,,5985 virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1458938405 --memory 2048 virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1458938405 --vram 48 virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1458938405 --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... Timeout waiting for WinRM

If I get on the virtualbox guest created with the vbox-2012r2.json file & type in

winrm set winrm/config/service '@{AllowUnencrypted="True"}' it connects over winrm & progresses further. Is there anyway to inject this in somewhere along the packer build or in a config file somewhere that loads before needing WinRM

mwrock commented 8 years ago

The package script intentionally sets that property at the very end of the boxstarter run. If its done too early, packer will reboot the vm and then hands off the rest of the provisioning to the provisioner.

When you see the above timeout, that usually means that either something went wrong in the boxstarter run or windows updates took too long. If you have a Virtualbox GUI up, you may be able to tell what is wrong by an error in the console or looking in the boxstarter log at $env:localappdata\boxstarter\boxstarter.log.

prashant645 commented 8 years ago

Hi Matt Sorry . 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.

mwrock commented 8 years ago

see my comment just above yours. If the run has been going over 8 hours and you have decent hardware, something went wrong and you need to check the boxstarter log or the vbox gui for errors.

prashant645 commented 8 years ago

vbox gui doesnt show up any errors .I also cannot find the box starter.log file, is it present in the VM or my local worstation?

mwrock commented 8 years ago

its in the vm at $env:LocalAppData\boxstarter\boxstarter.log

prashant645 commented 8 years ago

Hi Matt Below I am not able to see the log file.Below I am attaching my screenshot of the folder system check it once and guide me please boxstarter

mwrock commented 8 years ago

you want c:\users\vagrant\appdata\local\boxstarter

prashant645 commented 8 years ago

Hi Matt This is the screen shot of the last 20 line of the log.Can you please let me know the problem by looking at the log file. Because I am unable to diagnose the root cause or error boxstarter

prashant645 commented 8 years ago

Hi matt please reply to the above thread.Please let me know the problem

mwrock commented 8 years ago

looks like something went wrong further up. you could include a link to a gist of the whole thing.

prashant645 commented 8 years ago

oh gosh My entire vm got deleted now. and I wont be able to trace out the boxstarter.log.Could you suggest me any other method for building a windowsr2012 box for setting up a test kitchen instance.

mwrock commented 8 years ago

oh...I know that pain.

You can always use mwrock/Windows2012R2 which is built from this template and I keep it pretty current.

jcii commented 8 years ago

fwiw, I set the timeout to 16 hours, ran the script on my laptop, and worked on other things, watching it. I got it to work, but i remember having to hit enter at a prompt for something.

mwrock commented 8 years ago

yeah. a prompt would definitely be a bug.

haf commented 8 years ago

Same here, 8h later it just killed everything off. I have the latest MacBook Pro machine with 16 cores and 16 GiB memory and the top-of-the-line SSD that I think can write 600 MiB/s. It's not about being underspecced. The my internet connection is 1000/1000 to the internet (and 300 mbps WiFi that caps out at 296 mbps in real life, because who wants cables to a MacBook Pro?).

To the contrary, I think it's a lot about network latency to MSFT servers and how it chooses to install its security updates (staged download-install-then-download-again). Is it possible to use one of the batch security update ISOs, you think?

Zian commented 8 years ago

Is there any way to get the boxstarter log when the VM is stuck at the following window?

virtualbox_packer-virtualbox-iso-1467494898_02_07_2016_15_45_19

mwrock commented 8 years ago

The log can be found in %LOCALAPPDATA%\boxstarter

Its likely not going to have anything helpful. The call to windows update and check updates, especially on a clean win 7 VM can take a very long time.

nealbrown commented 7 years ago

Just a data point I am still getting this bug https://github.com/mitchellh/packer/issues/3652 so hopefully next release of packer will address this

cwlls commented 7 years ago

This looks very similar to an error I just had with the WinRM port. In commit 832eaeb7de96ab4e30034054723f6057fbc585ff it was set to 55985 instead of the default port of 5985. @mwrock just approved my pull request to change it in the vbox-2012r2.json. This might also be the problem in issue #76.

dbhaskaran1 commented 7 years ago

This is what I'm seeing when I open up the GUI. Its going through a ton of updates. I'll increase the timeout and see if its done then.

image