I'm trying to use NFS for synced folders with Vagrant, but when I vagrant up, I get:
NFS requires a host-only network to be created.
Please add a host-only network to the machine (with either DHCP or a
static IP) for NFS to work.
I'm not really sure what the exact steps required for this would be. If possible, could Vagrant automatically setup host-only network on installation?
2.0.0
macOS Sierra
FreeBSD
Vagrant.configure("2") do |config|
config.vm.box = "uchida/freebsd"
config.vm.synced_folder ".", "/vagrant", type: "nfs"
end
Hi @mcandre - due to the limitations wth VirtualBox's built in networking, you must create a private network for NFS. More information about that can be found in the pre-req section of the synced_folder docs: https://www.vagrantup.com/docs/synced-folders/nfs.html#prerequisites
For more information about setting up a private network, you can check out the docs here: https://www.vagrantup.com/docs/networking/private_network.html#dhcp
However it should be as easy as dropping in this line for your config:
config.vm.network "private_network", type: "dhcp"
Thanks!
A few notes:
configure_networks, preventing NFS from working.Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.box = "b00ga/dragonfly50"
config.vm.box_version = "0.1.1"
config.vm.network "private_network", type: "dhcp"
config.vm.synced_folder ".", "/vagrant", type: "nfs"
end
Trace:
$ vagrant up
...
Vagrant attempted to execute the capability 'configure_networks'
on the detect guest OS 'dragonflybsd', but the guest doesn't
support that capability. This capability is required for your
configuration of Vagrant. Please either reconfigure Vagrant to
avoid this capability or fix the issue by creating the capability.
As a workaround, I am manually configuring my box to use rsync. Would be nice to get either NFS or rsync /vagrant working in the base box by default. For now, I'm using this configuration to get things up and running.
Vagrant.configure("2") do |config|
config.vm.box = "b00ga/dragonfly50"
config.vm.box_version = "0.1.1"
config.vm.synced_folder ".", "/vagrant", type: "rsync"
end
Again, thank you for putting in all so much effort to help DragonFly BSD users work with Vagrant, it's much appreciated!
Hey @mcandre - if I remember correctly, that folder /vagrant should be syncing by default. Have you seen what happens if you leave it out of your config? The only downside is I think it uses the virtualbox built in shared folders protocol by default, but maybe that's alright? Unless you are specifically looking to use rsync or nfs, then you'd want to define that config option like you have above.
/vagrantshould be syncing by default
I agree, though BSD boxes tend to screw up how shared folders are managed. When I omit config.vm.synced_folder ".", "/vagrant", type: "rsync", then BSD guests tend to exit vagrant up with a complaint before the vagrant provision phase.
Odd, when I remove explicit config.vm.guest setting from my dragonflybsd Vagrantfile, my box skips over the rsync_install capability step, then of course dies on rsync not found. Browsing through the dragonflybsd guest plugin code, everything looks okay, correctly extends the freebsd guest plugin, which specifies the right command for installing rsync in freebsd and dragonflybsd: sudo pkg install -y rsync. I have no idea why this step is being skipped for the box.
Update
I tinkered some more and discovered that the dragonflybsd guest plugin is skipping the rsync_install step. Tracking that bug in https://github.com/hashicorp/vagrant/issues/9335
This sounds like a reasonable idea, but this has low chance of being a priority for us anytime soon, so we'd rather close this issue than have it stagnate into the foreseeable future. The best way to get this implemented would be to submit a PR. If you do so, we'd welcome this work. If you want to discuss how to go about doing this, I'd be happy to help with that.
Again, thank you for suggesting this and it is a reasonable idea. But, since this is a feature request, it requires some work to add it to the project and we don't plan on doing that soon. But as this is also an open source project we welcome contributions. Thanks!
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.
Most helpful comment
Hi @mcandre - due to the limitations wth VirtualBox's built in networking, you must create a private network for NFS. More information about that can be found in the pre-req section of the synced_folder docs: https://www.vagrantup.com/docs/synced-folders/nfs.html#prerequisites
For more information about setting up a private network, you can check out the docs here: https://www.vagrantup.com/docs/networking/private_network.html#dhcp
However it should be as easy as dropping in this line for your config:
Thanks!