On Windows 10, if you update your CentOS 7 Vagrant box to v1905.01 you might notice a very annoying rsync error after running vagrant up
...
The error looks very similar to this:
The key text here is "There was an error when attempting to rsync a synced folder".
The known issues documentation in the official CentOS blog article Updated CentOS Vagrant Images Available (v1905.01) explains everything. In the updated CentOS box images VirtualBox Guest Additions are no longer pre-installed which means rsync won't work out of the box, hence the error we see.
To fix this issue you have two options. Both involve adding a configuration line to the vagrantfile:
- Install the vagrant-vbguest plugin and add
config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
to the top of your vagrantfile. This will allow synced folders to work like before. - Disable the synced folder setting in your vagrantfile by adding
config.vm.synced_folder ".", "/vagrant", disabled: true
.
The First Option
If you run provision scripts from the vagrantfile, or if you have additional automation tasks then you will want to go with option #1 (which I recommend anyways).
First you'll have to install the vagrant-vbguest plugin. Execute the command below:
$ vagrant plugin install vagrant-vbguest
Then, edit your vagrantfile and add the synced folder option. Here is an example vagrantfile:
Vagrant.configure("2") do |config|
config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
config.vm.define "myhost" do |myhost|
myhost.vm.box = "centos/7"
myhost.vm.hostname = "myhost"
myhost.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.memory = "2048"
vb.name = "myhost"
vb.linked_clone = true
end
end
end
The Second Option
If you don't have a need for synced folders, then just disable the option in your vagrantfile. It will look similar to this:
Vagrant.configure("2") do |config|
config.vm.synced_folder '.', '/vagrant', disabled: true
config.vm.define "myhost" do |myhost|
myhost.vm.box = "centos/7"
myhost.vm.hostname = "myhost"
myhost.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.memory = "2048"
vb.name = "myhost"
vb.linked_clone = true
end
end
end
This will get you up and running with the updated CentOS vagrant boxes. Make sure you read the official blog post linked above as well just to make sure you aren't missing anything.
-Joey D