2014-09-05 196 views
5

我使用Windows 8.1 Pro计算机运行vagrant和cygwin的rsync。在运行CoreOS虚拟机的流浪者的Windows上使用rsync

我配置这样:

config.vm.synced_folder "../sharedFolder", "/vagrant_data", type: "rsync" 

当我执行vagrant up我收到以下错误:

C:\dev\vagrantBoxes\coreOS>vagrant up 
Bringing machine 'default' up with 'virtualbox' provider... 
==> default: Checking if box 'yungsang/coreos' is up to date... 
==> default: Clearing any previously set forwarded ports... 
==> default: Clearing any previously set network interfaces... 
==> default: Preparing network interfaces based on configuration... 
    default: Adapter 1: nat 
==> default: Forwarding ports... 
    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: core 
    default: SSH auth method: private key 
    default: Warning: Connection timeout. Retrying... 
==> default: Machine booted and ready! 
==> default: Rsyncing folder: /c/dev/vagrantBoxes/sharedFolder/ => /vagrant_data 
There was an error when attempting to rsync a synced folder. 
Please inspect the error message below for more info. 

Host path: /c/dev/vagrantBoxes/sharedFolder/ 
Guest path: /vagrant_data 
Command: rsync --verbose --archive --delete -z --copy-links --chmod=ugo=rwX --no-perms --no-owner --no-group --rsync-path sudo rsync -e ssh -p 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/d 
ev/null -i 'C:/Users/aaron.axisa/.vagrant.d/insecure_private_key' --exclude .vagrant/ /c/dev/vagrantBoxes/sharedFolder/ [email protected]:/vagrant_data 
Error: Warning: Permanently added '[127.0.0.1]:2222' (RSA) to the list of known hosts. 
rsync: change_dir "/c/dev/vagrantBoxes/sharedFolder" failed: No such file or directory (2) 
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at /usr/src/ports/rsync/rsync-3.0.9-1/src/rsync-3.0.9/main.c(1052) [sender=3.0.9] 

我想这是它是如何改变的目录路径的问题/ c/dev而不是C:\ dev

回答

1

从我的测试中,如果您使用的是cygwin,请使用由@ osroot25提供的解决方案。

如果您正在使用cwRsync做了cygwin,存在利用流浪除了编辑源代码@Andrew迈尔斯细节没有解决方法。使用Vagrant v1.6.5进行测试。

我的解决方法适用于我,完全绕过Vagrant并直接使用cwRsync。这对我很有用,因为我正在同步一个几乎不会改变的文件夹。我可能会在一天内多次更改它(所以我必须记住每次下面的第2步),但是我会在几周(或几个月)内没有任何更改。请记住,要使用cwRsync,您必须编辑并使用cwrsync.cmd脚本。尝试直接访问rsync.exe命令或将其添加到路径将失败。步骤1:我添加以下行cwrsync.cmd的端部(已安装的文件夹中):

rsync -re "ssh -p 2222" /cygdrive/b/VCS/packages/ [email protected]:packages --exclude ".git/"

步骤2:我有一个单独的命令窗口打开,我运行使用的cwrsync.cmd完整路径。然后,如果我需要将更改同步到虚拟机上,我将激活该窗口,向上箭头,并立即更新!

修改ENV通过@ osroot25设置cygwin的修复,因为当你强迫cygwin的检测不与cwRsync工作,“无业游民的ssh”命令将无法正常工作,因为它需要的cygwin的命令cygpath,你赢了”没有,所以你不能ssh进入虚拟机。那么你可以,如果你直接使用ssh命令和所有正确的选项。

2

有一种很奇怪的方法可以解决这个问题(无论如何都是为我工作),您必须更改

hostpath = Vagrant::Util::Platform.cygwin_path(hostpath) 

C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-[VERSION]\plugins\synced_folders\rsync\helper.rb

这对1.5.x的不同

hostpath = "/cygdrive" + Vagrant::Util::Platform.cygwin_path(hostpath) 

上线43,你可以在这里阅读此线程它:https://github.com/mitchellh/vagrant/issues/3230

我会的,但是,是第一个承认编辑内核远非理想。

8

就像我在github上发出评论说,按照你的Vagrantfile线肯定会解决您的问题

ENV["VAGRANT_DETECTED_OS"] = ENV["VAGRANT_DETECTED_OS"].to_s + " cygwin"

,因为这是你的Vagrantfile地方,源文件可以保持不变

3

解决方法:只需ln -s /cygdrive/c/ /c上cygwin终端

相关问题