You are not logged in.

#1 2021-12-15 20:32:06

Sapiens
Member
Registered: 2021-07-05
Posts: 52

[SOLVED] Vagrants synced folders over NFS do not work.

Hi there,

I am currently trying to use Vagrant on my system. I setup a Vagrantfile that starts with

Vagrant.configure("2") do |config|
  config.vm.provider :libvirt do |libvirt|
    # setup VM parameters
    libvirt.memory = "1024"
    libvirt.cpus = 4
  end
  config.vm.box =  "centos/7"
  config.vm.synced_folder ".", "/vagrant", type: "nfs"
  # configure a macvtap device to get an IP from the host network
  config.vm.network :public_network,
      :dev => "enp8s0",
      :mode => "bridge",
      :type => "direct"
end

The problem is vagrant up, that is supposed to setup the virtual machine, fails during the step it should setup the NFS synced folders between the host and the guest:

==> default: Mounting NFS shared folders...
==> default: Pruning invalid NFS exports. Administrator privileges will be required...
==> default: Removing domain...
==> default: Deleting the machine folder
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o vers=3,udp 192.168.121.1:/home/sapiens/Code/vagrant-private/printing-server /vagrant

Stdout from the command:



Stderr from the command:

mount.nfs: requested NFS version or transport protocol is not supported

I have opened ports 111 2049 20048 32765 and 32803 for NFS in the firewall, still this fails. I do not know what I am doing wrong! I appreciate any help!

Last edited by Sapiens (2023-01-07 16:47:32)

Offline

#2 2021-12-15 22:54:23

ib
Member
Registered: 2021-12-11
Posts: 25

Re: [SOLVED] Vagrants synced folders over NFS do not work.

Check if they are available:

nmap -Pn -p 1-65535 127.0.0.1

Offline

#3 2021-12-16 03:09:27

Sapiens
Member
Registered: 2021-07-05
Posts: 52

Re: [SOLVED] Vagrants synced folders over NFS do not work.

@ib Thank you but I am using UFW/GUFW and can see the used ports in the GUI

I found the solution to this problem in a vagrant issue.

I needed to change

config.vm.synced_folder ".", "/vagrant", type: "nfs"

to

config.vm.synced_folder ".", "/vagrant", type: "nfs", mount_options: ["vers=3,tcp"]

and after that opening the ports 111,2049 and 24800 was enough!

Last edited by Sapiens (2021-12-16 03:09:50)

Offline

Board footer

Powered by FluxBB