hashicorp / vagrant

Vagrant is a tool for building and distributing development environments.
https://www.vagrantup.com
Other
26.24k stars 4.44k forks source link

rsync synced folders failing on vagrant up #3703

Closed andy-schmidt closed 10 years ago

andy-schmidt commented 10 years ago

Windows 8.1, Vagrant 1.6.0, MinGW via git-bash. GuestOS is Redhat Enterprise Linux 6.0 x86_64. A Vagrantfile/ base box compatible with Vagrant 1.5.4 results in the following output with error message:

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'bigfix/RHE60x64BuildVM'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'bigfix/RHE60x64BuildVM' is up to date...
==> default: Setting the name of the VM: Main_default_1399512636237_7331
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 52311 => 62311 (adapter 1)
    default: 80 => 62312 (adapter 1)
    default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Rsyncing folder: /c/depot/Main/BES/ => /home/vagrant/Source/BES
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /c/depot/Main/BES/
Guest path: /home/vagrant/Source/BES
Command: rsync --verbose --archive -z --chmod=ugo=rwX --no-perms --no-owner --no-group --rsync-path sudo rsync -e ssh -p 2222 -o StrictHostKeyChecking=no -o Use
rKnownHostsFile=/dev/null -i 'C:/Users/andy_schmidt/.vagrant.d/insecure_private_key' --exclude .vagrant/ /c/depot/Main/BES/ vagrant@127.0.0.1:/home/vagrant/Sour
ce/BES
Error: Warning: Permanently added '[127.0.0.1]:2222' (RSA) to the list of known hosts.
rsync: writefd_unbuffered failed to write 4 bytes to socket [sender]: Connection reset by peer (104)
rsync: read error: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at /usr/src/rsync/rsync-3.0.8/io.c(760) [sender=3.0.8]

The Vagrantfile sync folder configuration is as follows:

  config.vm.synced_folder "./BES", "/home/vagrant/Source/BES", type: "rsync", rsync__args: ["--verbose", "--archive", "-z"]
  config.vm.synced_folder "./External", "/home/vagrant/Source/External", type: "rsync", rsync__args: ["--verbose", "--archive", "-z"]
  config.vm.synced_folder "./Shared", "/home/vagrant/Source/Shared", type: "rsync", rsync__args: ["--verbose", "--archive", "-z"]
  config.vm.synced_folder "./Utility", "/home/vagrant/Source/Utility", type: "rsync", rsync__args: ["--verbose", "--archive", "-z"]
mitchellh commented 10 years ago

"Connectoin reset by peer" means the VM itself reset the connection, not Vagrant.

andy-schmidt commented 10 years ago

This Vagrantfile/base box works with Vagrant 1.5.4. This issue appears to be related to the target directories in the guest not existing.vagrant rsync fails with the same error above, until I create the target directory in guest. Then vagrant rsync succeeds. However, following this, executing vagrant rsync-auto fails with

$ vagrant rsync-auto
==> default: New synced folders were added to the Vagrantfile since running
==> default: `vagrant reload`. If these new synced folders are backed by rsync,
==> default: they won't be automatically synced until a `vagrant reload` is run.
There are no paths to watch! This is either because you have no
synced folders using rsync, or any rsync synced folders you have
have specified `rsync_auto` to be false.

Following this, executing vagrant reload succeeds, and then finally vagrant rsync-auto succeeds

I will investigate further.

andy-schmidt commented 10 years ago

Problem resolved with Vagrant 1.6.1. Excellent (and fast) work!