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

Vagrant doesn't honor config.vm.synced_folder set to disabled and sets up an rsync folder with a CentOS 7 guest using VirtualBox #6154

Closed
tjanez opened this issue Aug 17, 2015 · 12 comments

Comments

@tjanez
Copy link
Contributor

tjanez commented Aug 17, 2015

Versions of installed components (the system is Fedora 20):

vagrant-1.7.4-1.x86_64
VirtualBox-4.3.28-1.fc20.x86_64

Steps to reproduce the problem:

  1. Add the official CentOS 7 box to Vagrant:

    vagrant box add --provider=virtualbox centos/7
    
  2. Use the following Vagrantfile:

    # -*- mode: ruby -*-
    # vi: set ft=ruby :
    
    VAGRANTFILE_API_VERSION = "2"
    
    Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
      config.vm.box = "centos/7"
      # Prevent Vagrant from mounting the default /vagrant synced folder
      config.vm.synced_folder '.', '/vagrant', disabled: true
    end
  3. Start the machine:

    vagrant up
    

Expected Results:

Vagrant disables syncing the current folder.

Actual Results:

Even though syncing the current folder is disabled, Vagrant installs rsync on the guest machine and rsyncs the contents of the current folder. Here is the output:

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'centos/7'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'centos/7' is up to date...
==> default: Setting the name of the VM: VagrantCentOSrsyncproblem_default_1439812291174_20087
==> default: Fixed port collision for 22 => 2222. Now on port 2201.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 => 2201 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2201
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: 
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default: 
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: No guest additions were detected on the base box for this VM! Guest
    default: additions are required for forwarded ports, shared folders, host only
    default: networking, and more. If SSH fails on this machine, please install
    default: the guest additions and repackage the box to continue.
    default: 
    default: This is not an error message; everything may continue to work properly,
    default: in which case you may ignore this message.
==> default: Installing rsync to the VM...
==> default: Rsyncing folder: /home/tadej/Temp/Vagrant CentOS rsync problem/ => /home/vagrant/sync
@wshallum
Copy link

Is this not caused by the target path being different? The CentOS 7 box's Vagrantfile specifies:

config.vm.synced_folder ".", "/home/vagrant/sync", type: "rsync"

In my Vagrantfile, using

config.vm.synced_folder ".", "/home/vagrant/sync", disabled: true

works for me. It no longer tries to install rsync or sync the directory. Of course, there is still the question of why they create an image that uses rsync by default and then not include rsync in the image...

@mrwiora
Copy link

mrwiora commented Sep 23, 2015

with the specification of the right destination folder this works for me too.

@darkn3rd
Copy link

darkn3rd commented Nov 6, 2015

Is this the new default in 1.7.4 where /vagrant is disabled now? It is no longer mounting the current working directory as /vagrant. Instead I get this rsync folder.

==> devbox: Rsyncing folder: /vagrants/centos7/ => /home/vagrant/sync

@exstral
Copy link

exstral commented Nov 18, 2015

This rsync shared folder is set in the Vagrantfile contained in the "centos/7" box.

Vagrant.configure("2") do |config|
  config.vm.base_mac = "<hash>"
  config.vm.synced_folder ".", "/home/vagrant/sync", type: "rsync"
end

I guess that for some reason the creators of the official box thought it prudent that everyone use rsync without giving us a hint or description on how to properly disable it. Thankfully I found this issue :)

@mitchellh
Copy link
Contributor

I also can't reproduce this. I'm going to mark as not a bug.

@vikas027
Copy link

vikas027 commented Feb 10, 2016

I also faced this today on a CentOS 7 box.

In CentOS 7, this works

config.vm.synced_folder '.', '/home/vagrant/sync', disabled: true

and this does't

config.vm.synced_folder '.', '/vagrant', disabled: true

@gdanielson
Copy link

I'm experiencing this too.(just starting to use vagrant so I might've done something wrong)
Running on OS X Vagrant 1.8.1 and VirtualBox 5.0.18
A new centos/7 attempts to rsync by default from . to guest ~/sync

vagrant init centos/7; vagrant up --provider virtualbox
---8<---
==> default: Rsyncing folder: /Users/gdanielson/ => /home/vagrant/sync

This is the Vagrantfile it created

    Vagrant.configure(2) do |config|
      config.vm.box = "centos/7"
    end

If I destroy and update the Vagrantfile to

    Vagrant.configure(2) do |config|
      config.vm.box = "centos/7"
      config.vm.synced_folder '.', '/home/vagrant/sync', disabled: true
    end

the rsync doesn't fire up.
Where is that rsync being triggered from? I guess there is some other config somewhere controlling this?

@vikas027
Copy link

@gdanielson I did not quite understand your issue. Do you want rsync to be enabled or disabled ?
If you want to disable it, just see my previous comment. If you want to enable it (which it is by default), then you can do something like this

config.vm.synced_folder '../../', '/vagrant', type: 'rsync', rsync__exclude: '.git/', owner: 'root', group: 'root'

@gdanielson
Copy link

I wanted to disable rsync. I didn't think that something like rsync replication would be enabled by default so I assumed it was an error.

@automaticgiant
Copy link

automaticgiant commented Oct 30, 2017

i have this problem with debian/jessie64, and i can't install rsync before configuring the proxy settings in apt. (well, to be clear, my problem is that i don't have a synced folder but it wants to install rsync anyway.) ah. and when i changed config.vm.synced_folder ".", "/home/vagrant/sync", disabled: true to listing /vagrant, i suspect it lined up with the default setting for debian/jessie64 and disabled it and doesn't need to install rsync now.
so it's a box "problem".

@vhosakot
Copy link

vhosakot commented Dec 17, 2017

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 29, 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 29, 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