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

An existing connection was forcibly closed by the remote host #1029

Open
cmanon opened this issue Oct 28, 2016 · 24 comments
Open

An existing connection was forcibly closed by the remote host #1029

cmanon opened this issue Oct 28, 2016 · 24 comments

Comments

@cmanon
Copy link

cmanon commented Oct 28, 2016

I'm trying to use packer/vagrant to provision a windows 2016 box, using VirtualBox 5.1.8 and also tested with 5.0.28 using basically these scripts https://github.com/mwrock/packer-templates.

Chocolatey install correctly, but trying to use any command gives the error showed on the gist below when using the VirtualBox network interface as NAT, but if I switch the network as bridged and associate it to my computer interface chocolatey work as expected.

I also have tried using http instead of https and get the same issue.

Host: OSX 10.11.16
VirtualBox: 5.0.28/5.1.8
Chocolatey: 0.10.3

https://gist.github.com/cmanon/81a6db97d5e40d999d337dcaceb1e2ef

Any pointers would be a appreciated.

@ferventcoder
Copy link
Member

That's a pretty nasty looking error. Do you see this with everything you try to install?

@ferventcoder
Copy link
Member

What version of Vagrant by the way?

@ferventcoder
Copy link
Member

Also, if you can install fiddler and then run it with this and include the saz report, it will be helpful to determine the issue.

@cmanon
Copy link
Author

cmanon commented Oct 28, 2016

Do you see this with everything you try to install?

Yes, every command throw that error.

What version of Vagrant by the way?

1.8.5

I will do the test with fiddler.

I also did some more testing with other VirtualBox versions, installed the latest 4.3 series and with the NAT network configured it works perfectly, I'm actually building the vm image at this time.

@ferventcoder
Copy link
Member

I'm also on Vagrant 1.8.5 and Virtualbox 5.0.28. I'm not seeing the same error, but then again I'm still working to keep vagrant from destroying my Windows Server 2016 box as it is finishing the provisioning and runs into an error. (It's a feature :/)

@ferventcoder
Copy link
Member

ferventcoder commented Oct 28, 2016

@ferventcoder
Copy link
Member

Not sure if you are seeing the issue during the packer build or the vagrant box use. I was guessing the latter, so feel free to correct me if I'm wrong.

@cmanon
Copy link
Author

cmanon commented Oct 29, 2016

I'm experiencing on both, with provisioning and also when running the vm with vagrant, I added the line you mentioned and the issue persist, here's the output of the packer script.

https://gist.github.com/cmanon/41b817fd1b2a9d55186a786201fb0c9f

@ferventcoder
Copy link
Member

I also did some more testing with other VirtualBox versions, installed the latest 4.3 series and with the NAT network configured it works perfectly, I'm actually building the vm image at this time.

This (and the logs) make me think that the issue lies somewhere in not having network access within the Virtualbox VM. Are you able to use other things that need network access that are not choco?

@pammacdotnet
Copy link

Have the same problem... I can use the network and even ping from cmd.exe, but command "choco list" fails with the same error (unable to read data from transport connection).

@bhazard
Copy link

bhazard commented Oct 31, 2016

I am also seeing this error; however, choco list is not alone. Same issue with azure command line (azure login failed with similar error). Both work in bridge mode, but not NAT. My issue was definitely not related to chocolatey.
Virtualbox 5.1.8, Host OSX 10.11.6.

@cmanon
Copy link
Author

cmanon commented Oct 31, 2016

As others mentioned, I can browse the web in the VM and do pings.

@bhazard
Copy link

bhazard commented Oct 31, 2016

@cmanon, so can I (in NAT or bridge mode). The two modes are the same in that regard, but not in how outside services (such as choco and azure) talk back to the guest. From vbox: "NAT - Your host will act as a router (firewall) and your hosts will be on a private subnet. Use this if you are not running servers on the guests. Bridged - Your guests will get a ip address on the same subnet as your host. ... As the name implies, with this option you can connect to the guest servers from the host only." So seems that choco tries to create a return connection and the host isn't routing it correctly (or the host firewall is blocking it).

@ferventcoder
Copy link
Member

If someone can grab a fiddler report from the guest and attach it, that would be great!

@bhazard
Copy link

bhazard commented Oct 31, 2016

Here is my guest fiddler2 output, but I think comms is getting lost outside of the guest so I don't believe we will see anything useful in guest fiddler. Either way, here is what I see.

NAT Interface
With fiddler2 enabled and NAT interface, my choco list hangs (I might expect that). The unhappy fiddler output: https://gist.github.com/bhazard/727a6ced0d1477eadd0b24f8f64a339e

Without fiddler2, the choco list command line output is:
choco list
Chocolatey v0.10.3
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

(and as noted, with fiddler, it hangs so produces no output).

Bridge Interface
With bridge networking, the choco list completes and lists as expected. The happy fiddler output is:
https://gist.github.com/bhazard/71ad20abff2b7fa0f0105b743ce2ffd3

Could be my host network settings ... I have my mac firewall disabled, but could be other differences.

@matt-richardson
Copy link

I'm hitting the same issue with Vagrant 1.8.6, VirtualBox 5.0.28 r111378, and chocolatey0.10.3`. I'm hitting it with an vagrantfile very similar to https://github.com/mefellows/vagrant-dsc/blob/master/development/web/Vagrantfile.

@cmanon
Copy link
Author

cmanon commented Nov 2, 2016

@bhazard I don't think it has to do with the host network settings because without changing anything on the host network it works for me with VirtualBox 4.3 in NAT mode.

@bhazard
Copy link

bhazard commented Nov 2, 2016

@cmanon ... just to confirm my understanding ... virtualbox 5.x with NAT did not work for you, but 4.3 with NAT does? I only tried with vbox 5.1.8. In any case, still seems a networking issue to me (I had two different apps having what I believe is the same issue). Routing for bridge is much simpler, and cuts both host settings and virtualbox routing out of the picture. Is bridge mode not an option for you?

@cmanon
Copy link
Author

cmanon commented Nov 2, 2016

@bhazard Your statement is correct, 4.3 NAT works, 5.0 or 5.1 NAT does not work. Once running bridge works for me, but for the provisioning with packer it makes it really hard.

@jbarnett-r7
Copy link

We're also seeing this same issue. I did not experience it on VirtualBox 5.1.6 but others in the office were reporting it. After some troubleshooting and looking into differences between setups it showed that we had different VirtualBox versions. I upgraded to 5.1.8 and immediately started seeing the same problem.

We're using varying versions of Vagrant, from 1.8.5 to 1.8.7, and Chocolatey 0.10.3. Unfortunately switching to bridged isn't a very good option since we're using this to build a VM that is full of vulnerabilities.

@ferventcoder
Copy link
Member

Best thing I can recommend is to downgrade to a VirtualBox version that doesn't not experience issues like this. I'm in VBox 5.0.x and not seeing this issue either. It may also help to see if there is a bug with NAT in the latest versions of VirtualBox or file one if they don't already have a bug report.

@jbarnett-r7
Copy link

Yeah this looks to be a VirtualBox bug. I found this bug on their issue tracker and installed the recommended build, 5.1.9 r 111846, and ran the Vagrant provisioner again and all of my Chocolatey packages are installing correctly.

Currently that VirtualBox build is just a test release, but hopefully the fix will be rolled out with the next full GA release.

@bhazard
Copy link

bhazard commented Nov 11, 2016

@jbarnett-r7 - good find -- that looks like it would explain what folks are reporting and what I saw. Thanks for the update.

ColinNg added a commit to ColinNg/packer-windows that referenced this issue Nov 25, 2016
ColinNg added a commit to ColinNg/packer-windows that referenced this issue Nov 26, 2016
@tokra
Copy link

tokra commented Jul 5, 2017

Same issue on my virtual box/win10/chocolatey

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

No branches or pull requests

7 participants