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

Rsync Synced Folder does not work when `requiretty' is enabled #6780

Closed
kissge opened this issue Jan 2, 2016 · 14 comments
Closed

Rsync Synced Folder does not work when `requiretty' is enabled #6780

kissge opened this issue Jan 2, 2016 · 14 comments
Milestone

Comments

@kissge
Copy link

kissge commented Jan 2, 2016

Even if I set config.ssh.pty = true (#1482), the rsync function does not properly work.

==> default: Rsyncing folder: /home/****/****/ => /vagrant
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /home/****/****/
Guest path: /vagrant
Command: rsync --verbose --archive --delete -z --copy-links --no-owner --no-group --rsync-path sudo rsync -e ssh -p 22 -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null -i '/home/****/****/****.pem' --exclude .vagrant/ /home/****/****/ ec2-user@**.**.**.**:/vagrant
Error: Warning: Permanently added '**.**.**.**' (ECDSA) to the list of known hosts.

sudo: sorry, you must have a tty to run sudo
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [sender=3.0.9]


Command "vagrant up --provider=aws" exited with 1

The reason is --rync-path sudo rsync.
In the guest environment sudo cannot be invoked without tty.
If the options for opening shell session (rsync -e ...) can be configured properly (e.g., ssh -tt) the problem is supposed to be resolved, but those options are fixed and cannot be modified.
(cf. https://github.com/mitchellh/vagrant/blob/master/plugins/synced_folders/rsync/helper.rb#L74)

Does anyone know workaround for this problem?

@kissge kissge changed the title Rsync synced folder does not work when `requiretty' is enabled Rsync Synced Folder does not work when `requiretty' is enabled Jan 3, 2016
@sethvargo
Copy link
Contributor

Hi @kissge

I am sorry you are having issues with Vagrant. Can you please share your Vagrantfile, host OS, guest OS, and the output of the command in debug mode as as github gist? Thanks! 😄

@apancutt
Copy link

I'm having the same issue, specifically with the Amazon Linux AMI 2015.09.1 image.

Host: OS X 10.11.2
Vagrant: 1.8.1
vagrant-aws (0.7.0)
vagrant-berkshelf (4.1.0)
vagrant-hostmanager (1.7.0)
vagrant-omnibus (1.4.1)
vagrant-reload (0.0.1)
vagrant-share (1.1.5, system)
vagrant-vbguest (0.11.0)

Vagrant.configure("2") do |config|

    config.vm.box = "dummy"

    config.vm.provider :aws do |aws, override|

        aws.access_key_id = "***"
        aws.secret_access_key = "***"
        aws.keypair_name = "foo"
        aws.ami = "ami-60b6c60a" # Amazon Linux AMI 2015.09.1

        override.ssh.pty = true
        override.ssh.username = "ec2-user"
        override.ssh.private_key_path = "~/.ssh/foo.pem"

    end

end

Output:

==> default: Rsyncing folder: /Users/apancutt/workspace/vagrant/ => /vagrant
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /Users/apancutt/workspace/vagrant/
Guest path: /vagrant
Command: rsync --verbose --archive --delete -z --copy-links --no-owner --no-group --rsync-path sudo rsync -e ssh -p 22 -o ControlMaster=auto -o ControlPath=/var/folders/f6/63j1_6111vv6cfnvd5gxbhww0000gn/T/ssh.331 -o ControlPersist=10m -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null -i '/Users/apancutt/.ssh/foo.pem' --exclude .vagrant/ /Users/apancutt/workspace/vagrant/ ec2-user@***:/vagrant
Error: Warning: Permanently added '***' (ECDSA) to the list of known hosts.
sudo: sorry, you must have a tty to run sudo
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-47/rsync/io.c(453) [sender=2.6.9]

@mandeepbal
Copy link

👍 I'm getting this same issue
Standard Ubuntu 14.04 image from aws
launching from OS X 10.11.3

==> default: Rsyncing folder: /Users/Documents/CodeRepos/chef-configure/ => /vagrant
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /Users/Documents/CodeRepos/chef-configure/
Guest path: /vagrant
Command: rsync --verbose --archive --delete -z --copy-links --no-owner --no-group --rsync-path sudo rsync -e ssh -p 22 -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null -i '/keys/dev.pem' --exclude .vagrant/ /Users/Documents/CodeRepos/chef-configure/ ubuntu@192.168.144.69:/vagrant
Error: Warning: Permanently added '192.168.1.69' (ECDSA) to the list of known hosts.
packet_write_wait: Connection to 192.168.1.69: Broken pipe
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-47/rsync/io.c(453) [sender=2.6.9]

@bryanwb
Copy link

bryanwb commented May 6, 2016

hey folks, one option is to disable the requirement for a tty.

You need something like the following in your instance userdata

#!/bin/bash                                                        
echo 'Defaults:root !requiretty' > /etc/sudoers.d/aws
echo 'Defaults:vagrant !requiretty' >> /etc/sudoers.d/aws

@kissge
Copy link
Author

kissge commented May 6, 2016

Yes, it is an option.
But as far as I tested it does not always work well.
It seemed that it is unpredictable whether the script runs before or after vagrant tries to connect the server via ssh. If it runs before vagrant, then it works; otherwise it fails.

And besides, that solution only works with Amazon EC2 instances.
After all improving vagrant seems a better solution to me.

@OptiverTimAll
Copy link

I'm not familiar with Ruby, but it seems like if the code that built the rsync rsh command were updated to respect config.ssh.pty, that should fix things nicely.

@sethvargo
Copy link
Contributor

We did some refactors. Can anyone confirm if this is still an issue with Vagrant 1.8.4?

@aseering
Copy link

I am hitting this issue with Vagrant 1.8.4.

@ayen-tibco
Copy link

+1 same issue here with Vagrant 1.8.5 and vagrant-aws (0.7.2).

@gianarb
Copy link

gianarb commented Sep 9, 2016

I have the same problem with vagrant 1.8.5 and vagrant-aws (0.7.2) like @ayen-tibco

@chrisroberts chrisroberts added this to the 1.9 milestone Oct 3, 2016
@kenorb
Copy link
Contributor

kenorb commented Dec 2, 2016

Same here when using custom AMI.

I think it worked with:

config.ssh.pty = true

added into Vagrantfile.

If you've got Broken pipe instead, see this.

@chrisroberts
Copy link
Member

Hi there,

Thanks for reporting this bug. I'm sure this was a real issue when originally reported (our fault for not looking sooner!) but there have been multiple Vagrant releases since the original report. I'm going to close this issue now and request you reopen the issue if you're still experiencing this problem. I'm sorry this wasn't looked at earlier ☹️

Cheers!

@vhosakot
Copy link

When I did vagrant up with the box centos/7 (virtualbox, 1703.01), ==> default: Rsyncing folder: /root/ => /vagrant was stuck for me too, and adding
config.vm.synced_folder '.', '/vagrant', disabled: true
in Vagrantfile resolved the issue for me and rsync did not happen.

@ghost
Copy link

ghost commented Mar 31, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests