3
votes

I'm trying to run vagrant in a Ubuntu host with nfs enabled, but it's getting an error while I try to run vagrant. These are my specifications:

  • Host : Ubuntu 14.04 LTS
  • Guest : Ubuntu 14.04 LTS
  • Virtual box version : 5.0.4
  • Vagrant version : 1.7.4

This is my vagrant file:

Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/trusty64"
  config.vm.hostname = "vagrant-play"
  config.vm.provider "virtualbox" do |v|
    v.name = "eng-soft-project"
    # max 75% CPU cap
    v.customize ["modifyvm", :id, "--cpuexecutioncap", "75"]
    # give vm max 3GB ram
    v.memory = 2048
  end

  config.vm.provision :shell, :privileged => false, :path => "vagrant-machine-setup.sh"
  config.vm.provision :shell, :privileged => false, :path => "vagrant-machine-run.sh",run: "always"

  forward_port = ->(guest, host = guest) do
      config.vm.network :forwarded_port,
        guest: guest,
        host: host, 
        auto_correct: true
  end

  forward_port[9000]           # activator run
  forward_port[8888]           # activator ui     
  forward_port[9999]           # unknow     

  config.vm.network :private_network, ip: "192.168.50.50"
  config.vm.synced_folder "source-code/", "/home/vagrant/source-code", type: "nfs", create: true, mount_options: ["dmode=755,fmode=755"]
  config.vm.synced_folder "teste/", "/home/vagrant/teste", type: "nfs", create: true, mount_options: ["dmode=755,fmode=755"]
end

And this is the error:

nfsd running
exportfs: <home-path>/project/teste does not support NFS export
exportfs: <home-path>/project/source-code does not support NFS export
==> default: Mounting NFS shared folders...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o 'dmode=755,fmode=755' 192.168.50.1:'<home-path>/project/source-code' /home/vagrant/source-code

Stdout from the command:



Stderr from the command:

stdin: is not a tty
mount.nfs: an incorrect mount option was specified

I tried a lot of possible solutions, like updating my vb box version, installing the vagrant-vbguest plugin, making a link between VBoxGuestAdditions inside guest.

None of this worked for my problem, if someone knows a solution please let me know.

1

1 Answers

2
votes

install nfs-kernel-server

sudo apt-get install nfs-kernel-server

then do provision or vagrant up

or

you can try by adding plugin vagrant-nfs_guest

vagrant plugin install  vagrant-nfs_guest

also check firewall of your system that may block NFS and rpcbind ports