Skip to content
This repository has been archived by the owner on Mar 19, 2022. It is now read-only.

Runtime error with MINGW64_NT-10.0 #465

Open
darkn3rd opened this issue Dec 9, 2015 · 21 comments
Open

Runtime error with MINGW64_NT-10.0 #465

darkn3rd opened this issue Dec 9, 2015 · 21 comments

Comments

@darkn3rd
Copy link

darkn3rd commented Dec 9, 2015

I am not able to cook, when trying this with vagrant and git-bash (64bit MSYS). The problem is that the paths are getting munged up pretty badly. I initially had a problem with my own identity file, which I corrected (input was C:, so it was missing the /C/).

However, even though that is fixed, when I try to cook, I am prompted for a password, and then it just hangs. I left the initial RuntimeError message below, as I noticed that the ControlPath might have caused a problem under MSYS: ControlPath=C:\\Users\\devops/.chef/knife-solo-sockets/%h. Even if that directory resolved correctly, I never created a .chef there, only in my little vagrant play area ~/knife_solo/centos7/.chef

.chef/knife.rb

current_dir = File.dirname(__FILE__)
repo = "#{current_dir}/../chef-repo"
cookbook_path    "#{repo}/cookbooks"
node_path        "#{repo}/nodes"
role_path        "#{repo}/roles"
environment_path "#{repo}/environments"
data_bag_path    "#{repo}/data_bags"

knife[:berkshelf_path] = "#{repo}/cookbooks"
knife[:ssh_port] = 2222
knife[:identity_file] = "/Users/devops/knife_solo/centos7/.vagrant/machines/default/virtualbox/private_key"
knife[:cygdrive_prefix_local] = ''
knife[:cygdrive_prefix_remote] = ''
$ knife solo cook vagrant@localhost
Running Chef on localhost...
Checking Chef version...
Uploading the kitchen...
ERROR: RuntimeError: Failed to launch command ["rsync", "-rL", "--chmod=ugo=rwX", "--rsh=ssh vagrant@localhost -i /Users/devops/knife_solo/centos7/.vagrant/machines/default/virtualbox/private_key -p 2222 -o ControlMaster=auto -o ControlPath=C:\\Users\\devops/.chef/knife-solo-sockets/%h -o ControlPersist=3600", "--delete-after", "-zt", "--exclude=revision-deploys", "--exclude=.git", "--exclude=.hg", "--exclude=.svn", "--exclude=.bzr", "/C/Users/devops/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/knife-solo/resources/patch_cookbooks/", ":~/chef-solo/cookbooks-1"]
@matschaffer
Copy link
Owner

You need to have rsync installed on your workstation.

I usually work on OS X so the best I can offer for windows is to check out the readme at https://github.com/tknerr/bills-kitchen and contact the author there.

I believe there are a few options for rsync on windows.

@matschaffer
Copy link
Owner

Or if rsync works and you suspect a problem with the control master support you can try adding --ssh-control-master no to the command

@darkn3rd
Copy link
Author

I installed rsync (cwRsync 5.4.1), and have similar issues. For some weird reason, I am prompted to enter a password to log in. The process for knife solo prepare works fine.

$ rsync --version | head -2
rsync  version 3.1.1  protocol version 31
Copyright (C) 1996-2014 by Andrew Tridgell, Wayne Davison, and others.
$ cat ssh_config
Host localhost
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /c/Users/user/myproject/.vagrant/machines/default/virtualbox/private_key
  IdentitiesOnly yes
  LogLevel FATAL
$ knife solo cook -F ssh_config vagrant@localhost
Running Chef on localhost...
Checking Chef version...
Enter the password for vagrant@localhost: vagrant

At this point, it just freezes.

@matschaffer
Copy link
Owner

Can you run it with -VV ? That should tell us what operation is leading to
the password prompt.

Do you have anywhere you would expect to enter a password or is everything
passwordless?

On Friday, 11 December 2015, Joaquin Menchaca [email protected]
wrote:

I installed rsync, and have similar issues. For some weird reason, I am
prompted to enter a password to log in. The process for knife solo prepare
works fine.

$ rsync --version | head -2
rsync version 3.1.1 protocol version 31
Copyright (C) 1996-2014 by Andrew Tridgell, Wayne Davison, and others.
$ cat ssh_config
Host localhost
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /c/Users/user/myproject/.vagrant/machines/default/virtualbox/private_key
IdentitiesOnly yes
LogLevel FATAL
$ knife solo cook -F ssh_config vagrant@localhost
Running Chef on localhost...
Checking Chef version...
Enter the password for vagrant@localhost: vagrant

At this point, it just freezes.


Reply to this email directly or view it on GitHub
#465 (comment)
.

-Mat

matschaffer.com

@darkn3rd
Copy link
Author

I just tried this:

$ knife solo cook vagrant@localhost -p 2222 -i .vagrant/machines/default/virtualbox/private_key
Running Chef on localhost...
Checking Chef version...
Uploading the kitchen...
The authenticity of host '[localhost]:2222 ([127.0.0.1]:2222)' can't be established.
ECDSA key fingerprint is SHA256:ZbVIp0drV1pEgXfRQNo0AANvcjle5Ljcdovdnx50f1Y.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[localhost]:2222' (ECDSA) to the list of known hosts.
mm_receive_fd: no message header
process_mux_new_session: failed to receive fd 0 from slave
mux_client_request_session: read from master failed: Connection reset by peer
Failed to connect to new control master
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(235) [sender=3.1.1]
ERROR: RuntimeError: Failed to launch command ["rsync", "-rL", "--chmod=ugo=rwX", "--rsh=ssh vagrant@localhost -i .vagrant/machines/default/virtualbox/private_key -p 2222 -o ControlMaster=auto -o ControlPath=C:\\Users\\suave/.chef/knife-solo-sockets/%h -o ControlPersist=3600", "--delete-after", "-zt", "--exclude=revision-deploys", "--exclude=.git", "--exclude=.hg", "--exclude=.svn", "--exclude=.bzr", "/C/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/knife-solo/resources/patch_cookbooks/", ":~/chef-solo/cookbooks-1"]

@darkn3rd
Copy link
Author

For using the ssh_config, it just freezes.

$ knife solo cook vagrant@localhost -F ssh_config -VV
INFO: Using configuration from C:/Users/suave/projarea/sysadmin-exp/chef/06.knife_solo/centos7/.chef/knife.rb
Starting 'Run'
Running Chef on localhost...
Checking Chef version...
Enter the password for vagrant@localhost: vagrant

When I specify the port and identity file manually, I get further information:

$ knife solo cook vagrant@localhost -p 2222 -i .vagrant/machines/default/virtualbox/private_key -VV
INFO: Using configuration from C:/Users/suave/projarea/sysadmin-exp/chef/06.knife_solo/centos7/.chef/knife.rb
Starting 'Run'
Running Chef on localhost...
Checking Chef version...
DEBUG: Initial command sudo chef-solo --version 2>/dev/null | awk '$1 == "Chef:" {print $2}'
DEBUG: Initial command sudo -V
DEBUG: Running processed command sudo -V
DEBUG: sudo -V stdout: Sudo version 1.8.6p7
Sudoers policy plugin version 1.8.6p7
Sudoers file grammar version 42
Sudoers I/O plugin version 1.8.6p7

DEBUG: Running processed command sudo -p 'knife sudo password: ' chef-solo --version 2>/dev/null | awk '$1 == "Chef:" {print $2}'
DEBUG: sudo -p 'knife sudo password: ' chef-solo --version 2>/dev/null | awk '$1 == "Chef:" {print $2}' stdout: 12.5.1

DEBUG: Node config '../chef-repo/nodes/localhost.json' already exists
DEBUG: Berksfile not found
DEBUG: Cheffile not found
Uploading the kitchen...
DEBUG: Initial command ver
DEBUG: Running processed command ver
DEBUG: ver stdout: bash: ver: command not found

DEBUG: Initial command mkdir -p -m 0700 ~/chef-solo
DEBUG: Running processed command mkdir -p -m 0700 ~/chef-solo
DEBUG: No chefignore file found at ./chefignore no files will be ignored
DEBUG: ["rsync", "-rL", "-v", "--chmod=ugo=rwX", "--rsh=ssh vagrant@localhost -i .vagrant/machines/default/virtualbox/private_key -p 2222 -o ControlMaster=auto -o ControlPath=C:\\Users\\suave/.chef/knife-solo-sockets/%h -o ControlPersist=3600", "--delete-after", "-zt", "--excle=revision-deploys", "--exclude=.git", "--exclude=.hg", "--exclude=.svn", "--exclude=.bzr", "/C/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/knife-solo/resources/patch_cookbooks/", ":~/chef-solo/cookbooks-1"]
mm_receive_fd: no message header
process_mux_new_session: failed to receive fd 0 from slave
mm_send_fd: sendmsg(2): Connection reset by peer
mux_client_request_session: send fds failed
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(235) [sender=3.1.1]
C:/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/knife-solo/tools.rb:4:in `system!': Failed to launch command ["rsync", "-rL", "-v", "--chmod=ugo=rwX", "--rsh=ssh vagrant@localhost -i .vagrant/machines/default/virtualbox/private_key -p 2222 -o ContrMaster=auto -o ControlPath=C:\\Users\\suave/.chef/knife-solo-sockets/%h -o ControlPersist=3600", "--delete-after", "-zt", "--exclude=revision-deploys", "--exclude=.git", "--exclude=.hg", "--exclude=.svn", "--exclude=.bzr", "/C/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/ge/knife-solo-0.5.1/lib/knife-solo/resources/patch_cookbooks/", ":~/chef-solo/cookbooks-1"] (RuntimeError)
        from C:/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/chef/knife/solo_cook.rb:279:in `rsync'
        from C:/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/chef/knife/solo_cook.rb:233:in `upload'
        from C:/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/chef/knife/solo_cook.rb:249:in `upload_to_provision_path'
        from C:/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/chef/knife/solo_cook.rb:124:in `block in sync_kitchen'
        from C:/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/chef/knife/solo_cook.rb:123:in `each'
        from C:/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/chef/knife/solo_cook.rb:123:in `each_with_index'
        from C:/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/chef/knife/solo_cook.rb:123:in `sync_kitchen'
        from C:/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/chef/knife/solo_cook.rb:96:in `block in run'
        from C:/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/chef/knife/solo_cook.rb:212:in `time'
        from C:/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/chef/knife/solo_cook.rb:79:in `run'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/knife.rb:405:in `block in run_with_pretty_exceptions'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/local_mode.rb:44:in `with_server_connectivity'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/knife.rb:404:in `run_with_pretty_exceptions'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/knife.rb:203:in `run'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/application/knife.rb:142:in `run'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/bin/knife:25:in `<top (required)>'
        from C:/opscode/chefdk/bin/knife:64:in `load'
        from C:/opscode/chefdk/bin/knife:64:in `<main>'

@matschaffer
Copy link
Owner

The password prompt looks like a sudo prompt. Can you try setting up the
box for passwordless sudo?

As for the rsync fail, can you confirm that running the command (at least
the basic components) directly works?

On Friday, 11 December 2015, Joaquin Menchaca [email protected]
wrote:

For using the ssh_config, it just freezes.

$ knife solo cook vagrant@localhost -F ssh_config -VV
INFO: Using configuration from C:/Users/suave/projarea/sysadmin-exp/chef/06.knife_solo/centos7/.chef/knife.rb
Starting 'Run'
Running Chef on localhost...
Checking Chef version...
Enter the password for vagrant@localhost: vagrant

When I specify the port and identity file manually, I get further
information:

$ knife solo cook vagrant@localhost -p 2222 -i .vagrant/machines/default/virtualbox/private_key -VV
INFO: Using configuration from C:/Users/suave/projarea/sysadmin-exp/chef/06.knife_solo/centos7/.chef/knife.rb
Starting 'Run'
Running Chef on localhost...
Checking Chef version...
DEBUG: Initial command sudo chef-solo --version 2>/dev/null | awk '$1 == "Chef:" {print $2}'
DEBUG: Initial command sudo -V
DEBUG: Running processed command sudo -V
DEBUG: sudo -V stdout: Sudo version 1.8.6p7
Sudoers policy plugin version 1.8.6p7
Sudoers file grammar version 42
Sudoers I/O plugin version 1.8.6p7

DEBUG: Running processed command sudo -p 'knife sudo password: ' chef-solo --version 2>/dev/null | awk '$1 == "Chef:" {print $2}'
DEBUG: sudo -p 'knife sudo password: ' chef-solo --version 2>/dev/null | awk '$1 == "Chef:" {print $2}' stdout: 12.5.1

DEBUG: Node config '../chef-repo/nodes/localhost.json' already exists
DEBUG: Berksfile not found
DEBUG: Cheffile not found
Uploading the kitchen...
DEBUG: Initial command ver
DEBUG: Running processed command ver
DEBUG: ver stdout: bash: ver: command not found

DEBUG: Initial command mkdir -p -m 0700 ~/chef-solo
DEBUG: Running processed command mkdir -p -m 0700 /chef-solo
DEBUG: No chefignore file found at ./chefignore no files will be ignored
DEBUG: ["rsync", "-rL", "-v", "--chmod=ugo=rwX", "--rsh=ssh vagrant@localhost -i .vagrant/machines/default/virtualbox/private_key -p 2222 -o ControlMaster=auto -o ControlPath=C:\Users\suave/.chef/knife-solo-sockets/%h -o ControlPersist=3600", "--delete-after", "-zt", "--excle=revision-deploys", "--exclude=.git", "--exclude=.hg", "--exclude=.svn", "--exclude=.bzr", "/C/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/knife-solo/resources/patch_cookbooks/", ":
/chef-solo/cookbooks-1"]
mm_receive_fd: no message header
process_mux_new_session: failed to receive fd 0 from slave
mm_send_fd: sendmsg(2): Connection reset by peer
mux_client_request_session: send fds failed
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(235) [sender=3.1.1]
C:/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/knife-solo/tools.rb:4:in system!': Failed to launch command ["rsync", "-rL", "-v", "--chmod=ugo=rwX", "--rsh=ssh vagrant@localhost -i .vagrant/machines/default/virtualbox/private_key -p 2222 -o ContrMaster=auto -o ControlPath=C:\\Users\\suave/.chef/knife-solo-sockets/%h -o ControlPersist=3600", "--delete-after", "-zt", "--exclude=revision-deploys", "--exclude=.git", "--exclude=.hg", "--exclude=.svn", "--exclude=.bzr", "/C/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/ge/knife-solo-0.5.1/lib/knife-solo/resources/patch_cookbooks/", ":~/chef-solo/cookbooks-1"] (RuntimeError) from C:/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/chef/knife/solo_cook.rb:279:inrsync' from C:/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/chef/knife/solo_cook.rb:233:in upload' from C:/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/chef/knife/solo_cook.rb:249:inupload_to_provision_path'
from C:/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/chef/knife/solo_cook.rb:124:in block in sync_kitchen' from C:/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/chef/knife/solo_cook.rb:123:ineach' from C:/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/chef/knife/solo_cook.rb:123:in each_with_index' from C:/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/chef/knife/solo_cook.rb:123:insync_kitchen'
from C:/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/chef/knife/solo_cook.rb:96:in block in run' from C:/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/chef/knife/solo_cook.rb:212:intime' from C:/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/chef/knife/solo_cook.rb:79:in run' from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/knife.rb:405:inblock in run_with_pretty_exceptions'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/local_mode.rb:44:in with_server_connectivity' from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/knife.rb:404:inrun_with_pretty_exceptions' from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/knife.rb:203:in run' from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/application/knife.rb:142:inrun'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/bin/knife:25:in <top (required)>' from C:/opscode/chefdk/bin/knife:64:inload' from C:/opscode/chefdk/bin/knife:64:in `

'


Reply to this email directly or view it on GitHub
#465 (comment)
.

-Mat

matschaffer.com

@darkn3rd
Copy link
Author

These are standard vagrant boxes, so I can sudo w/o permission.

$ ssh vagrant@localhost -F ssh_config
Last login: Fri Dec 11 10:15:34 2015 from 10.0.2.2
[vagrant@localhost ~]$ sudo su -
[root@localhost sudoers.d]# cat /etc/sudoers.d/vagrant
vagrant        ALL=(ALL)       NOPASSWD: ALL

@darkn3rd
Copy link
Author

I am trying combinations with rsync, but I am rusty with the tool.

$ rsync -rL -v -e "ssh vagrant@localhost -F ssh_config" Vagrantfile vagrant@localhost:test/
dup() in/out/err failed
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]
$ rsync -rL -v -e "ssh vagrant@localhost -F ssh_config" ../chef-repo/ vagrant@localhost:test
dup() in/out/err failed
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]

I get similar errors, whether using csRsync or MSYS Rsync

@matschaffer
Copy link
Owner

Googling for that error turned up
http://askubuntu.com/questions/249853/rysnc-errors-backup-with-deltacopy-and-ubuntu
which
has some recommendations. Have you found this link yet?

On Friday, 11 December 2015, Joaquin Menchaca [email protected]
wrote:

I am trying combinations with rsync, but I am rusty with the tool.

$ rsync -rL -v -e "ssh vagrant@localhost -F ssh_config" Vagrantfile vagrant@localhost:test/dup() in/out/err failed
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]
$ rsync -rL -v -e "ssh vagrant@localhost -F ssh_config" ../chef-repo/ vagrant@localhost:testdup() in/out/err failed
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]

I get similar errors, whether using csRsync or MSYS Rsync


Reply to this email directly or view it on GitHub
#465 (comment)
.

-Mat

matschaffer.com

@darkn3rd
Copy link
Author

Is rsyncd required to run on target node? It's not running on my target CentOS 7 node.

# systemctl list-unit-files | grep rsync
rsyncd.service                              disabled
rsyncd.socket                               disabled

@matschaffer
Copy link
Owner

It should be able to work by calling the rsync binary on the server side.
But if there's some reason ssh can't invoke that it could cause an issue.
I'd dig into the rsync and ssh logs to figure out why the connection is
being broken.

On Friday, 11 December 2015, Joaquin Menchaca [email protected]
wrote:

Is rsyncd required to run on target node? It's not running on my target
CentOS 7 node.

systemctl list-unit-files | grep rsync

rsyncd.service disabled
rsyncd.socket disabled


Reply to this email directly or view it on GitHub
#465 (comment)
.

-Mat

matschaffer.com

@darkn3rd
Copy link
Author

I am thinking about some potential solutions paths. I think that the rsync does not work on MSYS, is because I may be using 32-bit w/ 64-bit environment, I am unfamiliar with MSYS beyond bundled versions with git, so I can take MSYS2 for a spin, see if I have better mileage. I can also use pure CygWin, but I have numerous problems with CygWin, e.g. file permission problem on Win7+ (noacl vs. cygdrive). Most problematic is that ChefDK doesn't work with it out of the box with CygWin, but works with MSYS. There's a Chef blog article on this, will dig that up after I can get rsync to work.

Lastly, these vagrant images (centos or ubuntu trusty) have worked on both Linux host or Mac OS X flavored hosts, without requiring use of rsyncd. I will try some options, if I can get this to work, I can submit some documentation snippets for this.

Side Note, Vagrant and other tools are suffering from this issue as well. I think they had some ruby library issues in addition to the non-existence of rync on Windows; I also saw discussions on bundling an rsync client with vagrant. I am not sure there final solution, may look at this later after running some tests...

@matschaffer
Copy link
Owner

Some better documentation on how to use knife-solo from windows would definitely be appreciated. I'm all Mac & Linux these days so can't offer much perspective but if you hit new errors let me know and I can try to help work through them.

@darkn3rd
Copy link
Author

darkn3rd commented Jan 2, 2016

I managed to setup a CygWin + ChefDK (notes below). I still have the error:

mux_client_request_session: send fds failed
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.1]
ERROR: RuntimeError: Failed to launch command ["rsync", "-rL", "--chmod=ugo=rwX", "--rsh=ssh vagrant@localhost -F ssh_config -o ControlMaster=auto -o ControlPath=C:\\cygwin64\\home\\suave/.chef/knife-solo-sockets/%h -o ControlPersist=3600", "--delete-after", "-zt", "--exclude=revision-deploys", "--exclude=.git", "--exclude=.hg", "--exclude=.svn", "--exclude=.bzr", "/C/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/knife-solo/resources/patch_cookbooks/", ":~/chef-solo/cookbooks-1"]

For getting the ChefDK to work with CygWin, the problem is that ChefDK comes with an embedded Windows Ruby, which doesn't work with CygWin POSIX paths, but works with Windows Command Shell, PowerShell, and MSYS. Thus, I created some aliases to wrap of the ChefDK commands.

https://gist.github.com/darkn3rd/1a5a33e376c7abb756ac

@darkn3rd
Copy link
Author

darkn3rd commented Jan 2, 2016

Finally. I am able to successfully able to use rsync, but knife-solo still fails.

$ rsync -avzv -e 'ssh -F ssh_config' . vagrant@localhost:/home/vagrant/test
opening connection using: ssh -F ssh_config -l vagrant localhost rsync --server -vvlogDtprze.iLsfx . /home/vagrant/test  (11 args)
sending incremental file list
delta-transmission enabled
.generate_knife_config.sh is uptodate
.gitignore is uptodate
Vagrantfile is uptodate
ssh_config is uptodate
test is uptodate
update_environ.sh is uptodate
[email protected] is uptodate
.chef/knife.rb is uptodate
.vagrant/machines/default/virtualbox/action_provision is uptodate
.vagrant/machines/default/virtualbox/action_set_name is uptodate
.vagrant/machines/default/virtualbox/creator_uid is uptodate
.vagrant/machines/default/virtualbox/id is uptodate
.vagrant/machines/default/virtualbox/index_uuid is uptodate
.vagrant/machines/default/virtualbox/private_key is uptodate
.vagrant/machines/default/virtualbox/synced_folders is uptodate
total: matches=0  hash_hits=0  false_alarms=0 data=0

sent 567 bytes  received 895 bytes  2,924.00 bytes/sec
total size is 3,973  speedup is 2.72
$ rsync -avzv -e 'ssh -i .vagrant/machines/default/virtualbox/private_key -p2222' . [email protected]:/home/vagrant/test
opening connection using: ssh -i .vagrant/machines/default/virtualbox/private_key -p2222 -l vagrant 127.0.0.1 rsync --server -vvlogDtprze.iLsfx . /home/vagrant/test  (12 args)
sending incremental file list
delta-transmission enabled
.generate_knife_config.sh is uptodate
.gitignore is uptodate
Vagrantfile is uptodate
ssh_config is uptodate
test is uptodate
update_environ.sh is uptodate
[email protected] is uptodate
.chef/knife.rb is uptodate
.vagrant/machines/default/virtualbox/action_provision is uptodate
.vagrant/machines/default/virtualbox/action_set_name is uptodate
.vagrant/machines/default/virtualbox/creator_uid is uptodate
.vagrant/machines/default/virtualbox/id is uptodate
.vagrant/machines/default/virtualbox/index_uuid is uptodate
.vagrant/machines/default/virtualbox/private_key is uptodate
.vagrant/machines/default/virtualbox/synced_folders is uptodate
total: matches=0  hash_hits=0  false_alarms=0 data=0

sent 567 bytes  received 895 bytes  2,924.00 bytes/sec
total size is 3,973  speedup is 2.72

Thus with good ChefDK + good Rsync, Knife-Solo fails:

$ knife solo cook -F ssh_config vagrant@localhost
Running Chef on localhost...
Checking Chef version...
Uploading the kitchen...
mux_client_request_session: send fds failed
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.1]
ERROR: RuntimeError: Failed to launch command ["rsync", "-rL", "--chmod=ugo=rwX", "--rsh=ssh vagrant@localhost -F ssh_config -o ControlMaster=auto -o ControlPath=C:\\cygwin64\\home\\suave/.chef/knife-solo-sockets/%h -o ControlPersist=3600", "--delete-after", "-zt", "--exclude=revision-deploys", "--exclude=.git", "--exclude=.hg", "--exclude=.svn", "--exclude=.bzr", "/C/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/knife-solo/resources/patch_cookbooks/", ":~/chef-solo/cookbooks-1"]

@matschaffer
Copy link
Owner

Can you run the command as-specified in the output? Given what you
mentioned above I'd guess it's cygwin-vs-Windows pathing issues.

On Saturday, 2 January 2016, Joaquin Menchaca [email protected]
wrote:

Finally. I am able to successfully able to use rsync, but knife-solo still
fails.

$ rsync -avzv -e 'ssh -F ssh_config' . vagrant@localhost:/home/vagrant/test
opening connection using: ssh -F ssh_config -l vagrant localhost rsync --server -vvlogDtprze.iLsfx . /home/vagrant/test (11 args)
sending incremental file list
delta-transmission enabled
.generate_knife_config.sh is uptodate
.gitignore is uptodate
Vagrantfile is uptodate
ssh_config is uptodate
test is uptodate
update_environ.sh is [email protected] javascript:_e(%7B%7D,'cvml','[email protected]'); is uptodate
.chef/knife.rb is uptodate
.vagrant/machines/default/virtualbox/action_provision is uptodate
.vagrant/machines/default/virtualbox/action_set_name is uptodate
.vagrant/machines/default/virtualbox/creator_uid is uptodate
.vagrant/machines/default/virtualbox/id is uptodate
.vagrant/machines/default/virtualbox/index_uuid is uptodate
.vagrant/machines/default/virtualbox/private_key is uptodate
.vagrant/machines/default/virtualbox/synced_folders is uptodate
total: matches=0 hash_hits=0 false_alarms=0 data=0

sent 567 bytes received 895 bytes 2,924.00 bytes/sec
total size is 3,973 speedup is 2.72
$ rsync -avzv -e 'ssh -i .vagrant/machines/default/virtualbox/private_key -p2222' . [email protected]:/home/vagrant/test
opening connection using: ssh -i .vagrant/machines/default/virtualbox/private_key -p2222 -l vagrant 127.0.0.1 rsync --server -vvlogDtprze.iLsfx . /home/vagrant/test (12 args)
sending incremental file list
delta-transmission enabled
.generate_knife_config.sh is uptodate
.gitignore is uptodate
Vagrantfile is uptodate
ssh_config is uptodate
test is uptodate
update_environ.sh is [email protected] javascript:_e(%7B%7D,'cvml','[email protected]'); is uptodate
.chef/knife.rb is uptodate
.vagrant/machines/default/virtualbox/action_provision is uptodate
.vagrant/machines/default/virtualbox/action_set_name is uptodate
.vagrant/machines/default/virtualbox/creator_uid is uptodate
.vagrant/machines/default/virtualbox/id is uptodate
.vagrant/machines/default/virtualbox/index_uuid is uptodate
.vagrant/machines/default/virtualbox/private_key is uptodate
.vagrant/machines/default/virtualbox/synced_folders is uptodate
total: matches=0 hash_hits=0 false_alarms=0 data=0

sent 567 bytes received 895 bytes 2,924.00 bytes/sec
total size is 3,973 speedup is 2.72

Thus with good ChefDK + good Rsync, Knife-Solo fails:

$ knife solo cook -F ssh_config vagrant@localhost
Running Chef on localhost...
Checking Chef version...
Uploading the kitchen...
mux_client_request_session: send fds failed
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.1]
ERROR: RuntimeError: Failed to launch command ["rsync", "-rL", "--chmod=ugo=rwX", "--rsh=ssh vagrant@localhost -F ssh_config -o ControlMaster=auto -o ControlPath=C:\cygwin64\home\suave/.chef/knife-solo-sockets/%h -o ControlPersist=3600", "--delete-after", "-zt", "--exclude=revision-deploys", "--exclude=.git", "--exclude=.hg", "--exclude=.svn", "--exclude=.bzr", "/C/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/knife-solo/resources/patch_cookbooks/", ":~/chef-solo/cookbooks-1"]


Reply to this email directly or view it on GitHub
#465 (comment)
.

-Mat

matschaffer.com

@darkn3rd
Copy link
Author

darkn3rd commented Jan 2, 2016

Assuming that is a space delimited array, I can try to recreate it.

Generally, you cannot pass "C:\path\to\whatever" to POSIX systems, as they do not understand that. Thus the C:\\cygwin64\\home\\suave/.chef/knife-solo-sockets/%h will definitely fail, as rsync under CygWin doesn't understand Windows-DOS path names.

You would need to check uname -o to determine if it is Cygwin, and if it is, then use cygpath -u WINDOWS_PATH, which turns C:\ to /cygdrive/c. MSYS will auto-convert Windows Paths to POSIX paths, so that C:\ becomes /C/, but CygWin does not do this, so it needs to be detected and manually changed.

One thing bizarre. How is knife-solo getting /C/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/knife-solo/resources/patch_cookbooks/? This is a MSYS path. The /C/Users/... needs to by /cygdrie/c/Users/....

@darkn3rd
Copy link
Author

darkn3rd commented Jan 3, 2016

Hi. I may need some help. I have been trying to massage the command, but I am by no means an expert on rsync. I am sleuthing around solutions, reviewing man pages, etc.

My original cook command is this:

$ knife solo cook vagrant@localhost -p 2222 -i .vagrant/machines/default/virtualbox/private_key`
...
process_mux_new_session: failed to receive fd 0 from slave
mux_client_request_session: read from master failed: Connection reset by peer
Failed to connect to new control master
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.1]
ERROR: RuntimeError: Failed to launch command ["rsync", "-rL", "--chmod=ugo=rwX", "--rsh=ssh vagrant@localhost -i .vagrant/machines/default/virtualbox/private_key -p 2222 -o ControlMaster=auto -o ControlPath=C:\\cygwin64\\home\\suave/.chef/knife-solo-sockets/%h -o ControlPersist=3600", "--delete-after", "-zt", "--exclude=revision-deploys", "--exclude=.git", "--exclude=.hg", "--exclude=.svn", "--exclude=.bzr", "/C/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/knife-solo/resources/patch_cookbooks/", ":~/chef-solo/cookbooks-1"]

I try to do the command manually, after fixing the path names. I am wondering if the --rsh string needs to be quoted? Any ideas?

$ rsync -rL --chmod=ugo=rwX --rsh=ssh vagrant@localhost -i .vagrant/machines/default/virtualbox/private_key -p 2222 -o ControlMaster=auto -o ControlPath=/home/suave/.chef/knife-solo-sockets/%h -o ControlPersist=3600 --delete-after -zt --exclude=revision-deploys --exclude=.git --exclude=.hg --exclude=.svn --exclude=.bzr /cygdrive/c/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/knife-solo/resources/patch_cookbooks/ :~/chef-solo/cookbooks-1
ssh: connect to host  port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.1]

@darkn3rd
Copy link
Author

darkn3rd commented Jan 3, 2016

Part of the struggle with this is that the output from knife-solo with ERROR: RuntimeError: Failed to launch command is stripping out the quote characters in the commands.

I was able to get somewhere

$ rsync -rL --chmod=ugo=rwX --rsh='ssh vagrant@localhost -i .vagrant/machines/default/virtualbox/private_key -p 2222 -o ControlMaster=auto -o ControlPath=/home/suave/.chef/knife-solo-sockets/%h -o ControlPersist=3600' --delete-after -zt --exclude=revision-deploys --exclude=.git --exclude=.hg --exclude=.svn --exclude=.bzr /cygdrive/c/Users/suave/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-solo-0.5.1/lib/knife-solo/resources/patch_cookbooks/ :~/chef-solo/cookbooks-1
mm_receive_fd: no message header
process_mux_new_session: failed to receive fd 0 from slave
mux_client_request_session: read from master failed: Connection reset by peer
ControlSocket /home/suave/.chef/knife-solo-sockets/localhost already exists, disabling multiplexing

This provided clues to get this information: http://stackoverflow.com/questions/20959792/is-ssh-controlmaster-with-cygwin-on-windows-actually-possible

This referenced:

"Unfortunately if you are using OpenSSH on Cygwin you will not be able to take advantage of connection caching because Cygwin does not currently support file descriptor passing via unix-domain sockets."

@matschaffer
Copy link
Owner

Okay, you'll want to pass --ssh-control-master no as well then. Should also be settable via knife[:ssh_control_master] = 'no' in your knife config.

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

No branches or pull requests

2 participants