Discovered today that Vagrant automatically rsyncs files to the Host VM when the Docker provider is used on a system that doesn’t natively support Docker.
Sometimes, though, one wants to sync the files to a custom location, and might get errors when trying to sync them to two locations on the Host VM (as I was).
To turn off Vagrant’s default sync, use the same syntax you would to turn off the /vagrant shared folder otherwise:
This morning I ran into an issue with my Vagrant upgrade (I went from 1.0.7 to 1.2.1) that took me a few hours to figure out. I did, however, solve it in the end and thought it’d be useful to share how. It’s an easy fix.
First, the error I was getting was:
The box ‘boxname’ could not be found.
(where boxname was the actual name of the box, e.g. precise32)
The box did show up when I ran vagrant box list, so I knew that it should have been working.
After trying an assortment of things, including converting my Vagrantfile configuration to the version 2 format and trying to use the box in a fresh directory and with a fresh Vagrantfile, I decided to try re-adding the precise32 box that Vagrant provides. I did that, and then typed vagrant init precise32d. (I had called it precise32d.) This worked fine. I deduced that there must have been some change in the box itself. So I fired up DiffMerge.
DiffMerge told me that there weren’t any files it could compare. This, I discovered, was because everything in the new box I had downloaded was under a virtualbox directory. A-ha! I was on to something. I looked in that directory and saw these files:
Vagrantfile box.ovf box-disk1.vmdk metadata.json
Wait, metadata.json? That wasn’t in my existing box’s folder at all! What could be in there, I wondered?
$ cat virtualbox/metadata.json
{“provider”:”virtualbox”}
Ah. So it’s relying on this to figure out the provider, since Vagrant 1.1+ has the concept of providers other than VirtualBox. That explained a lot. The simplest fix is just as you may suppose:
To eliminate the potential for human error, we’ll use an existing metadata.json file. Run:
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here:
Cookie Policy