Closed lonniev closed 9 years ago
Darn fragile code:
rsync: mkdir "/cygdrive/c/Users/vagrant/C:vagrant-chef/5e5b4497aa57800c3fe732202ad0e04e/cookbooks" failed: No such...
That's what I get when I use the provisioning_path fix you suggest. It looks like for now I am stuck with my little monkey patch. (We can see that the rsync handling code doesn't know how to cygwin-ize a ruby path for Windows that already has drive letters within it.)
@lonniev For cygwin, what's the setup? I'd like to try some things out with it. (or with rsync)
It isn’t the case that a guest VM happens to have cygwin installed onto but rather than the rsync executable most usable for Windows was built with Cygwin’s libraries for dealing with Windows pathnames and other OS-specific details. Therefore, the vagrant and chef modules that call rsync are responsible for transforming Ruby paths to Windows paths to Cygwin paths.
-- Lonnie VanZandt 303-900-3048
On 25 June 2015 at 05:33:51, NickMRamirez (notifications@github.com) wrote:
@lonniev For cygwin, what's the setup? I'd like to try some things out with it.
— Reply to this email directly or view it on GitHub.
I tried using MinGW to get rsync installed, but couldn't get it working at all with Vagrant. (unrelated to Chef provisioning). I'd never tried before and am just going off of the Vagrant rsync docs. Maybe you can share your Vagrantfile and setup?
My Vagrantfile otherwise, solves the Windows guest problems I was having before.
Vagrant.configure(2) do |config|
config.vm.box = "kensykora/windows_2012_r2_standard"
# Could not get rsync working...
# config.vm.synced_folder '.', '/my_share', type: 'rsync'
config.vm.provision 'chef_zero' do |chef|
chef.provisioning_path = 'C:/vagrant-chef' # note forward slashes OK
chef.file_backup_path = 'C:/chef/backup'
chef.file_cache_path = 'C:/chef/cache'
chef.roles_path = 'roles'
chef.add_role 'windowsnode'
end
end
If we can get the rsync/cygwin stuff figured out, would make a better case for changing the default paths for Windows.
The following comes from a Packer script for making vagrantized Windows boxes. One also has to setup OpenSSH on the image beforehand.
rem install rsync
if not exist "C:\Windows\Temp\7z920-x64.msi" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://downloads.sourceforge.net/sevenzip/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi
pushd C:\Windows\Temp
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://mirrors.kernel.org/sourceware/cygwin/x86_64/release/rsync/rsync-3.1.0-1.tar.xz', 'C:\Windows\Temp\rsync-3.1.0-1.tar.xz')" <NUL
cmd /c ""C:\Program Files\7-Zip\7z.exe" x rsync-3.1.0-1.tar.xz"
cmd /c ""C:\Program Files\7-Zip\7z.exe" x rsync-3.1.0-1.tar"
copy /Y usr\bin\rsync.exe "C:\Program Files\OpenSSH\bin\rsync.exe"
rmdir /s /q usr
del rsync-3.1.0-1.tar
popd
msiexec /qb /x C:\Windows\Temp\7z920-x64.msi
rem make symlink for c:/vagrant share
mklink /D "C:\Program Files\OpenSSH\vagrant" "C:\vagrant"
I got rsync working with a Windows host and Windows guest. Steps I took:
kensykora/windows_2012_r2_standard
box (comes with OpenSSH already installed). The Vagrantfile uses rsync fix, documented at https://github.com/mitchellh/vagrant/issues/3230#issuecomment-62588180# rsync fix:
ENV["VAGRANT_DETECTED_OS"] = ENV["VAGRANT_DETECTED_OS"].to_s + " cygwin"
Vagrant.configure(2) do |config|
config.vm.box = "kensykora/windows_2012_r2_standard"
config.vm.network 'private_network', ip: '192.168.50.4'
# Note: guest path uses /cygdrive, even though cygwin is only installed on the host
config.vm.synced_folder './my_share', '/cygdrive/c/my_share', type: 'rsync'
config.vm.provision 'chef_zero' do |chef|
chef.provisioning_path = 'C:/vagrant-chef'
chef.file_backup_path = 'C:/chef/backup'
chef.file_cache_path = 'C:/chef/cache'
chef.roles_path = 'roles'
chef.add_role 'windowsnode'
end
end
vagrant up
, vagrant rdp'ed into the machine so I could install rsync.vagrant reload
That did it to sync up the my_share
folders.
Status update: the combination of MacOS, Vagrant, Chef-Solo, Windows still has, in Vagrant 1.7.4 and Chef 12.4.1, issues with rsync and Windows paths.
I should create a new issue. If I recall, it is the Windows Capabilities Rsync ruby code in core Vagrant that is responsible for getting this resolved.
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.
Host path: /Users/lonniev/Vagrants/softlayer-windows-obeoteam/cookbooks/
Guest path: C:/vagrant-chef/f3c765f92a8356d41d4338281bc64a00/cookbooks
Command: rsync --verbose --archive --delete -z --copy-links --no-owner --no-group -e ssh -p 22 -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null -i '/Users/lonniev/.vagrant.d/insecure_private_key' --exclude .vagrant/ /Users/lonniev/Vagrants/softlayer-windows-obeoteam/cookbooks/ vagrant@255.255.255.255:C:/vagrant-chef/f3c765f92a8356d41d4338281bc64a00/cookbooks
Error: Warning: Permanently added '255.255.255.255' (RSA) to the list of known hosts.
cygwin warning:
MS-DOS style path detected: C:/vagrant-chef/f3c765f92a8356d41d4338281bc64a00/cookbooks
Preferred POSIX equivalent is: /cygdrive/c/vagrant-chef/f3c765f92a8356d41d4338281bc64a00/cookbooks
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
rsync: change_dir#1 "/cygdrive/c/Users/vagrant//C:/vagrant-chef/f3c765f92a8356d41d4338281bc64a00/cookbooks" failed: No such file or directory (2)
rsync error: errors selecting input/output files, dirs (code 3) at main.c(631) [Receiver=3.1.0]
Similiar to (closed) https://github.com/mitchellh/vagrant/issues/2818
The Vagrantfile includes:
The entire configuration works fine for Ubuntu guest boxes. The provider is virtualbox. All the proper files are in the right directories on the host, all the right mounts of shared folders are in place, all the remapped files are available on the guest Windows, all the files can be opened from the Windows guest file explorer, and the solo.rb file has the proper, mapped paths for cookbooks, roles, and bags. If chef.add_role is replaced with chef.add_recipe for a recipe that is in the cookbooks folder, then that works fine. It is just the role access that is failing.
So, what could be the problem?
(Is there a unix-dos CRLF issue at the root of this?)