Vagrant: NFS mount error: v1.2.2

Created on 19 May 2013  ·  77Comments  ·  Source: hashicorp/vagrant

I've tried:

  1. fix sudoers issue by setting: vagrant no password + Default !requiretty in VM
  2. install nfs-common in VM
  3. install virtual box guest addition (using vagrant-vbguest) in VM
  4. ensure localMachine having installed nfsd
  5. check /etc/exports and it shows correct settings

but the nfs issue still comes:

mount -o vers=3 192.168.62.1:'/Users/example/Documents/example/example.lamp/example.com' /var/www
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o vers=3 192.168.62.1:'/Users/example/Documents/example/example.lamp/example.com' /var/www

Environment:
OS X 10.8.3
vagrant 1.2.2
Virtualbox: 4.2.12 r84980

Vagrantfile + /etc/sudoers in guest + /etc/exports in my mac + vagrant DEBUG log:
https://gist.github.com/chakming/0d955ee0ef698f1b2a48

Most helpful comment

Just after posting, I found this. Run this command to check for conflicting exports - sudo nfsd checkexports. Manually removed the conflicting export and reloaded...life is good.

All 77 comments

+1 I am having exactly the same problem here

@chakming do you think this is related to 1.2.2? using 1.2.1 works?

i've tried downgrade vagrant but seems having the same problem.

Same issue with 1.2.2 but not with 1.2.1 (Mac OS 10.8)

@chakming Had the same problem and the exact same setup (OS X 10.8.3, Vagrant 1.2.2 VBox 4.2.12 r84980).

By simply adding a trailing slash i was able to get it to work.
So for me the line in the Vagrantfile looks like this:
_config.vm.synced_folder "/Users/test/webapp/", "/var/www/", id: "vagrant-root" , :nfs => true_

@hdalgrav Thanks for the reply.

The trailing slash doesn't work for me and shows following error:

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o vers=3 192.168.66.1:'/Users/example/Documents/example/example.lamp/web' /var/www

It doenst look like you have inserted the trailing slash after your pathname, or maybe it is Vagrant stripping them out, but that would be weird since i am able to reproduce the error by simply removing my trailing slashes.

@hdalgrav nope i did. but the error didn't have the trailing slash lol

I'm getting the same error. Running Mac OSX 10.8.4, Vagrant 1.2.2, and VirtualBox 4.2.8 r83876.

Digging a bit deeper, it tells me that "the requested NFS version or transport protocol is not supported":

$ vagrant up
...
[couch] 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 192.168.100.1:'/Users/michael/Projects/mobile' /vagrant
$ vagrant ssh couch
...
vagrant@couch:~$ sudo mount -v -o vers=3 192.168.100.1:'/Users/michael/Projects/mobile' /vagrant
mount: no type was given - I'll assume nfs because of the colon
mount.nfs: timeout set for Thu Jun  6 04:18:31 2013
mount.nfs: trying text-based options 'vers=3,addr=192.168.100.1'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: portmap query retrying: RPC: Program not registered
mount.nfs: prog 100003, trying vers=3, prot=17
mount.nfs: portmap query failed: RPC: Program not registered
mount.nfs: requested NFS version or transport protocol is not supported

On the host:

$ cat /etc/exports
# VAGRANT-BEGIN: bc4a44a2-2d5c-46e7-8978-9f09774d117f
"/Users/michael/Projects/mobile" 192.168.100.1 -mapall=501:20
# VAGRANT-END: bc4a44a2-2d5c-46e7-8978-9f09774d117f

Does nfsd on Mac OSX support version 3? How can we check?

Same problem here, OSX 10.8.3, Vagrant 1.2.2, Vbox 4.12

The error is:

vagrant@precise64:~$ sudo mount -vvv -o vers=3 10.0.0.1:'/Users/bowbaq/Dropbox/dev/projet/yujia-bowbaq' /var/www/yujia
mount: fstab path: "/etc/fstab"
mount: mtab path:  "/etc/mtab"
mount: lock path:  "/etc/mtab~"
mount: temp path:  "/etc/mtab.tmp"
mount: UID:        0
mount: eUID:       0
mount: no type was given - I'll assume nfs because of the colon
mount: spec:  "10.0.0.1:/Users/bowbaq/Dropbox/dev/projet/yujia-bowbaq"
mount: node:  "/var/www/yujia"
mount: types: "nfs"
mount: opts:  "vers=3"
mount: external mount: argv[0] = "/sbin/mount.nfs"
mount: external mount: argv[1] = "10.0.0.1:/Users/bowbaq/Dropbox/dev/projet/yujia-bowbaq"
mount: external mount: argv[2] = "/var/www/yujia"
mount: external mount: argv[3] = "-v"
mount: external mount: argv[4] = "-o"
mount: external mount: argv[5] = "rw,vers=3"
mount.nfs: timeout set for Thu Jun 13 00:20:48 2013
mount.nfs: trying text-based options 'vers=3,addr=10.0.0.1'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 10.0.0.1 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 10.0.0.1 prog 100005 vers 3 prot UDP port 54126
mount.nfs: mount(2): Permission denied
mount.nfs: access denied by server while mounting 10.0.0.1:/Users/bowbaq/Dropbox/dev/projet/yujia-bowbaq
# /etc/exports
# VAGRANT-BEGIN: 905bcf70-a146-4273-8e54-73a29c8caa32
"/Users/bowbaq/Dropbox/dev/projet/yujia-bowbaq" 10.0.0.1 -mapall=501:20
# VAGRANT-END: 905bcf70-a146-4273-8e54-73a29c8caa32

Just to add to this since I'm having a similar issue.

I downgraded to 1.1.5 and now I get the following message

[default] Mounting NFS shared folders...
Mounting NFS shared folders failed. This is most often caused by the NFS
client software not being installed on the guest machine. Please verify
that the NFS client software is properly installed, and consult any resources
specific to the linux distro you're using for more information on how to
do this.

Same issue here.

Managed to resolve this by rebooting my machine.

OS X 10.8.4, Vagrant 1.2.2, VirtualBox 4.2.12

@sentience When all else fails... ;) Thanks for the tip. Will try this afternoon.

@sentience Hmm, no dice. Can I ask what private_network IP you're using? Maybe that has something to do with it...

It’s 10.0.0.23. Excerpt from my Vagrantfile:

  config.vm.network :private_network, ip: "10.0.0.23"
  config.vm.network :forwarded_port, guest: 80, host: 8080
  config.vm.network :forwarded_port, guest: 3306, host: 3307
  config.vm.hostname = "myapp-vm"
  config.vm.synced_folder ".", "/home/vagrant/myapp", :nfs => true

Seeing this issue here, too. Restart, downgrade, none of that works. Other tips? Is this an env issue or bug?

Just after posting, I found this. Run this command to check for conflicting exports - sudo nfsd checkexports. Manually removed the conflicting export and reloaded...life is good.

@bke-drewb 's solution worked for me. For reference exports are stored in /etc/exports

@bke-drewb @markeganfuller thanks for the reference. I commented out the line in the exports file and it still didn't resolve the problem. Was there something more to do?

@kayzee I removed the line entirely, someone else with the same problem removed the virtualbox machine that it was related to and that worked for them. Beyond that I don't know without further research.

I was getting the same problem, for me, it was because I was specifying a symbolic link on my host system, I put in the direct location, all is good.

Ah yes symlinks are awkward with NFS, best to only use relative symlinks to files within the share.

All SORTS of bug fixes that fix many causes of this error are in 1.2.4 and more are coming in 1.2.5. Please try those versions and if the problem persists, then please open another issue with debug level logs.

@bke-drewb 's solution worked for me after I restarted my laptop. Thanks everyone.

Same issue here, nfsd's checkexports and restart doesn't make any effect :(

10.8.4, Vagrant 1.2.7, VirtualBox 4.2.16 r86992

Ok, my bad, after installing nfs-common on vm's ubuntu - everything seems to work!

Just for reference if somebody else has the same issue:

My /etc/hosts was damaged and did not have an entry for localhost. This breaks nfs and is rather unobvious, as everything else on the machine works as expected.

So one of the reasons might be a damaged /etc/hosts file.

@thgrendel you're right! after fixing the /etc/hosts file, everything works fine! thanks! :+1:

@thgrendel @chakming fixing the /etc/hosts file worked for me as well. thanks!

$ sudo nfsd checkexports, halting the machine, and then running vagrant up again worked for me

$ sudo nfsd checkexports, halting machine and up worked for me too ...

thanks, internet! fixing /etc/hosts was the answer here as well. :beers: @thgrendel

Fixing /etc/hosts worked for me too! Thanks @thgrendel

@sentience I can't believe it, but restarting my computer really was the answer. Thanks for the tip!

@thgrendel /etc/hosts fixed it! thnx

Just in case somebody comes into the same problem, for me the problem was that I was using an ip ending with 1 192.168.2.1 on the VM .

@11digitlabs thank you. I was using 192.168.50.1, which was causing NFS to fail. I realize now that the host and VM were both trying to use the same address. I changed it to 10.22.2.2, which fixed the issue (now the host automatically sets itself to 10.22.2.1)

@11digitlabs thank you very much for posting your solution. Changing IP address from 192.168.33.01 to 192.168.33.31 fixed the issue for me. So it had to do with IP address ending with 01.

Thanks for all the suggestions. Restarting took care of it!

@hdalgrav thanks! trailing slash fixed my problem.

@mitchellh it would be helpful if it were added to the docs.

I'm with Ubuntu 14.04 and I had a problem like that.

After restart the nfs-server, I figured out a conflict and a error on nfs folder of my project.
$ service nfs-kernel-server restart

It was because of my encrypted home diretory, then for to fix it I put the project outside of the home directory.

Take a look at those two links

http://ubuntuforums.org/showthread.php?t=1527089
http://ubuntuforums.org/showthread.php?t=1262280

@sentience thanks for the reboot tip, it was refreshing to see boot animation :+1:

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

For anyone who runs into this error, this can also be caused by simply not having the NFS server installed on your host OS.

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.33.1:'/Users/mogetutu/Projects/platform' /var/www

Stdout from the command:



Stderr from the command:

stdin: is not a tty
mount.nfs: Connection timed out

For guys having a similar error as above, check your firewall settings. Blocking all incoming connections might be the cause of this.

Run command (in different dir that Vagrant):
$ sudo ifconfig vboxnet0 down
$ sudo ifconfig vboxnet0 up

I moved the project out of the encrypted home folder and it worked.

Thank you, @wellingtonlorindo!

Emptying /etc/exports and restarting the NFS server /etc/init.d/nfs-kernel-server restart worked for me (both on Debian and Ubuntu/Mint).

@gnutix great - thanks for the tip!

Sorry to comment on this even if it is closed. But u i have to tell you guys that i have found a relation to this issue regarding the OSX Application layer firewall:
This blocks all apps and tools from networking. In my case unblocking the regarding apps manually on the console did the job: Flawless nfs mounts.
Here you can find all you need to unblock the apps: http://krypted.com/mac-security/the-os-x-application-layer-firewall-part-3-lion/

@parfienczyk : Your solution worked for me. I halted all running VM's, ran "sudo ifconfig ... down" for all the vboxnet networks, and "vagrant up" worked. Previously, I rebooted my host machine, as suggested by @sentience , but I did not like that solution.

Been to https://github.com/mikebell/drupaldev-nginx/issues/18 that points me to this page. Yep, my host file has been jacked up. Fixing it up solves the problem. Thanks.

Note to self: Disable PF firewall (IceFloor.app)!

As this is a popular issue for nfs mounts, when receiving the error: mount.nfs: requested NFS version or transport protocol is not supported. It can also be caused by having duplicate network mounts within VirtualBox. For example if a machine has been destroyed incorrectly.

Ubuntu 14.04, being from the land of Linux I don't often think of rebooting, but that's exactly what fixed it - NFS mount worked fine after rebooting! oy!

Tried everything here, but going back to:

config.vm.network :private_network, type: :dhcp

From a static IP assignment:

config.vm.network :private_network, ip: '172.16.231.130'

... is what did the trick for me.

Thank you @thgrendel ! I edit my hosts file many times a day while testing various deployments behind load balancers. It looks like at some point I fouled up the localhost entry from 127.0.0.1 to 27.0.0.1. Fixed that and NFS came back for vagrant.

Fixing my /etc/hosts file on my mac fixed this for me too. I had temporarily pointed localhost to somewhere other than 127.0.0.1 and switching it back resolved this.

My problem was, that IP adress was 192.168.100.1
The VM need the end "xxx.xxx.xxx.1"
Changed End IP to another and now works

restarting my machine helped ...

Confirming: switching localhost back to 127.0.0.1 in /etc/hosts resolved this.

Try -

VAGRANT_USE_VBOXFS=true vagrant up

Adding private_network IP into /ect/hosts worked for me. (Mac OSX + Vagrant box running below Ubuntu 14.04)

Similar issue on Windows 7

mount -o 'vers=3,udp,nolock' [removed]:'/C/[removed]' /var/www
Stderr from the command:
mount.nfs: access denied by server while mounting [removed]

Fixed by... restarting PC...

Emptying /etc/exports fixed this for me, thanks @gnutix. It seems if you have multiple vagrant boxes, there can be conflicts.

Just chipping in to say @gnutix and @ronilaukkarinen solution worked for me with Roots/Trellis.

Confirming that this error happens also if you are working on an encrypted home directory on Ubuntu. I moved the project to outside the encrypted home and it worked just fine.

I have the same error when running vagrant up

==> 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 'actimeo=1' 192.168.2.1:'/Users/n0impossible/Documents/htdocs' /home/vagrant/htdocs

Stdout from the command:

Stderr from the command:

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

i checked my /etc/hosts file

#

#

#

i127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost

see?

i127.0.0.1 localhost

my bad, typo when i edit this file using vi editor

i fixed my /etc/hosts file, do vagrant up and work fine.

--Cheers--

Today, I finally realized I had to fix the hosts file on the host machine. Indeed, there was no entry 127.0.0.1 locahost After I added it, nfs worked for me too, however, I am still a bit sceptical, since this error just comes and goes as it pleases.

My issue resolved by changing IP to end in 3 and not 1. I'm not sure if was necessary to empty /etc/exports, but I did that first and then edited the Vagrantfile like so: config.vm.network :private_network, ip: "10.11.12.3" ... vagrant reload --provision then brought mount up

Changing vagrant app directory from home to other directory solved the problem. thanks for the Tip!

Edit: This issue is so sporadic. After rebooting my Mac, my NFS mount won't let files be deleted sometimes. If I edit and save the file from my VM, it saves successfully and _then_ I can delete it.

Outdated
Yet another possibility: If you use an encrypted sparsebundle on macOS as a mounted directory in your Vagrant VM, you may get permission denied errors when writing to the mounted directory (even with root/sudo). I switched to an unencrypted sparsebundle to fix the issue (since my drive is encrypted anyhow).

For Mac OS Sierra this solve my day! (Vagrant 1.9.2)

https://github.com/mitchellh/vagrant/issues/5424#issuecomment-284816293

I had a similar problem in Ubuntu, Vagrant version 1.9.3, VB version 5.1.22

The problem was that my host's OS has changed the ifconfig to the ip command, and vboxnet0 did not have an ip address.

I had to run:

ip a add 192.168.33.1/255.255.255.0 dev vboxnet0 before Vagrant could start the NFS share

There were many other things I tried: starting/stopping the firewall (ufw, iptables, both, neither); adding specific rules to the firewall to allow all traffic to this IP; service start for each of nfs-common, nfs-kernel-server, nfs-server, nfs-client; and clearing out my /etc/exports

It wasn't until I made sure my vboxnet0 had an IP on the host machine that everything worked.

Thank you to @gitis and @erikaheidi regarding moving it out of encrypted home folder - I also found that I was able to move beyond this issue once I did that.

gitis commented on 4 Sep 2014

I moved the project out of the encrypted home folder and it worked. Thank you, @wellingtonlorindo!

erikaheidi commented on 1 Apr 2016

Confirming that this error happens also if you are working on an encrypted home directory on Ubuntu. I moved the project to outside the encrypted home and it worked just fine.

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.

Was this page helpful?
0 / 5 - 0 ratings