Vagrant NFS problem

Hi there,
My local system is Windows 7. I install the newest vagrant and Vbox + plugins
$ vagrant plugin list
vagrant-gatling-rsync (0.9.0)
vagrant-hostsupdater (1.0.1)
vagrant-share (1.1.4, system)
vagrant-vbguest (0.11.0)
vagrant-winnfsd (1.1.0)

But when I make vagrant up NFS shared folders isn’t loaded and page loaded very slow. I try to modify Vagrant file
Line 49:
config.vm.synced_folder local_site_path(site), remote_site_path(name), owner: 'vagrant', group: 'www-data', mount_options: ['dmode=776', 'fmode=775'], type: 'nfs'

But after vagrant up i have this errors:
There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:
* Shared folders that have NFS enabled do not support owner/group
attributes. Host path: d:/wordpress/waluty
* Shared folders that have NFS enabled do not support owner/group
attributes. Host path: d:/wordpress/whiteblack

Any ideas?

Ok I founded what was wrong.
Line
config.vm.synced_folder local_site_path(site), remote_site_path(name), owner: ‘vagrant’, group: ‘www-data’, mount_options: [‘dmode=776’, ‘fmode=775’]
should be replaced by:
config.vm.synced_folder local_site_path(site), remote_site_path(name), type: ‘nfs’

But right now after vagrant up VM halt on Mounting NFS shared folder
default: SSH auth method: private key default: Warning: Connection timeout. Retrying... ==> default: Machine booted and ready! GuestAdditions 5.0.10 running --- OK. ==> default: Checking for guest additions in VM... ==> default: Setting hostname... ==> default: Configuring and enabling network interfaces... ==> default: Exporting NFS shared folders... ==> default: Preparing to edit nfs mounting file. [NFS] Status: halted [NFS] Start: started ==> default: Mounting NFS shared folders...

You might be experiencing what I have to deal with sometimes.

First, even though you got it figured out, this is how my NFS on Windows is setup for anyone in the future. I should have a check to make sure bindfs and winnfsd are installed, but apparently forgot to do that.

if Vagrant::Util::Platform.windows?
  wordpress_sites.each do |(name, site)|
    config.vm.synced_folder local_site_path(site), nfs_path(name), type: 'nfs'
    config.bindfs.bind_folder nfs_path(name), remote_site_path(name), u: 'vagrant', g: 'www-data', perms: "u=rwx:g=rwx:o=rwx"
  end
else
  if !Vagrant.has_plugin? 'vagrant-bindfs'
    raise Vagrant::Errors::VagrantError.new,  "vagrant-bindfs missing, please install the plugin:\nvagrant plugin install vagrant-bindfs"
  else
    wordpress_sites.each do |(name, site)|
      config.vm.synced_folder local_site_path(site), nfs_path(name), type: 'nfs'
      config.bindfs.bind_folder nfs_path(name), remote_site_path(name), u: 'vagrant', g: 'www-data'
    end
end

@padalec1 do you have hundreds if not thousands of images in your uploads folder? I came across an issue where it gets stuck in a loop trying to scan all the files in those folders. I put it in debug mode, and saw it kept reading the same directory over and over. Not sure if I should open a bug with the vagrant winnfsd guys, or who, but I have to delete all images in that folder before I provision the box, then resync that uploads folder.

You might also want to look and see if Windows firewall is blocking this service. Try temporarily disabling it.

Hi @nbyloff ,
thanks for your reply. I change Vagrantfile just like you suggest but right now I have this error:

==> default: Preparing to edit nfs mounting file. [NFS] Status: running ==> 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 'vers=3,udp,nolock' 192.168.50.1:'/E/wordpress/ibs' /vagrant-nfs-ibs.or g.pl Stdout from the command: Stderr from the command: stdin: is not a tty mount.nfs: access denied by server while mounting 192.168.50.1:/E/wordpress/ibs ==> default: The previous process exited with exit code 1.

No I haven’t a lot of images but I have 5 installation of bedrock and WP. This can be problem?
I see the problem is only with trellis I have laravel/homestead installed too and everything works correct.
Regards

1 Like

@padalec1 That might only work on your first time provisioning the server. Do you have both bindfs and winnfsd plugins installed?

I wouldn’t think that 5 installations would be a problem with NFS, but don’t have that many so not sure.

Did you try disabling your firewall with your original config when trying to start the box? Can you check and see if winnfsd.exe process is already running when trying to boot? If it’s already running, vagrant halt, kill winnfsd process, then vagrant up.

You can also find the nfsservice.bat file in your vagrant plugin folder, and change this line:

start "" "%~dp0winnfsd" -log off -pathFile %2 -id %3 %4

to this:

start "" "%~dp0winnfsd" -log on -pathFile %2 -id %3 %4

That will keep the NFS log service open so you can see if it reports any issues.

Might also want to try this in your Vagrantfile

if Vagrant.has_plugin?("vagrant-winnfsd")
  config.winnfsd.logging = "on"
end

Yes I have all of plugins installed.
To day when I start project on laravel/homestead the nfs want start to. I had to kill all Vbox and vagrant process.
I change nfsserive.bat added -log on, but I have little different :
start "" "%~dp0winnfsd" -log on %2 -pathFile %3 -id %4 %5

Firewall and Anti-virus disabled. Right now when I fire vagrant up and proces going to NFS the second prompt window was open and some information are displayed and window is closed and winnfsd.exe process is killed why?

Btw in other projects based on ZF2 when I login to VM and go to application files some files doesn’t exists but exists on windows

Just now I finished fresh install of laravel/homestead and everything works correct. No problem with NFS. The winnfsd command prompt open and I can see what happened between host and guest machine.

This error you got earlier mount.nfs: access denied by server while mounting seems to be triggered when you run vagrant up and winnfsd.exe is already running. I got the same error, that process was already running. So I killed the process and started again.

If you halt all VMs, then kill all winnfsd.exe processes, then start the Trellis VM, trying both your config and my config, does it work? If you try both, again, shutting down the VMs and killing the process before trying to boot again.

Outside of that, I am not sure. I haven’t had this issue.

I am going to get started playing with homestead on a new project, so I will be curious to see if their Vagrantfile is much different.

It is very different. Homestead uses a single yaml file for all sites. It’s easy to get a PHP project set up with it. What Trellis does though being specific to WordPress sites is it allows you to automatically run Composer, set up a WP site, and handles a lot of multsite stuff too. On Homestead you would only get the benefit having the nginx file set up somewhat.

Also, not to be taken lightly, but dev/prod parity is much higher with Trellis. Homestead is a great VM, but you don’t really know what’s on it other than the punch list of things on the website. You can see everything that’s installed with Trellis from the Ansible playbooks, and you can also provision your remote servers as well to be the same as your local box. AFAIK, you need to pay for Forge to get relative parity with the Homestead box, or work it out yourself.

I’m not dissing on Homestead, I use it for most other PHP projects outside of WP sites, unless I get serious about a project then I might take Trellis and set up a project-specific playbook to handle installation/config. But it’s good to know the differences and strengths/weaknesses of each.

1 Like

The problem is in winnfsd, have bug https://github.com/winnfsd/vagrant-winnfsd/issues/10 and cannot add multiple shared folders. Just now I checked this in homestead and its the same like in trellis.

Have the same issue running vagrant reload with standalone install (no multiple).
Any ideas?..

==> 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 vers=3,udp 192.168.50.1:/home/site /vagrant-nfs-example.com

Stdout from the command:

Stderr from the command:

mount.nfs: access denied by server while mounting 192.168.50.1:/home/site

Specifically, my problem was that NFS does not work with ecryptfs. You have ecryptfs if you clicked the button in the Ubuntu installer to encrypt your home directory.

The solution is to move your trellis folder outside the ecryptfs directories.

1 Like

Have the same issue running vagrant reload with standalone install (no multiple).
Any ideas?..

I resolved this issue yesterday by checking /etc/hosts and making sure that it has 127.0.0.1 localhost listed and not commented out.

Thanks. For me the trick was that NFS doesn’t work with encrypted file system in Ubuntu Linux. :slight_smile:

Just in case this helps somebody:

My problem was that I was trying to do this in a project in my “code” folder (originally created for Homestead, eventually used to hold all projects) and Homestead’s vagrant configuration (tied to the code folder) was interfering with creating a Trellis one. As soon as I tried outside of the code folder, I had no problems.

1 Like