New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NFS mount fails on subsequent `vagrant up` commands #1941

Closed
n1vlac opened this Issue Jul 17, 2013 · 51 comments

Comments

Projects
None yet
@n1vlac

n1vlac commented Jul 17, 2013

I know there are other issues around this problem, but perhaps my situation is a little different.

So I'm hitting errors on mounting a shared directory. The funny thing is, it WORKS when I create a new VM, though it seems to hit a bunch of errors before somehow finally working. See below:

DEBUG ssh: Exit status: 0
DEBUG ssh: Re-using SSH connection.
 INFO ssh: Execute: mount -o vers=3 10.98.0.1:'/Users/nivlac/work/nucleus' /home/vagrant/work (sudo=true)
DEBUG ssh: stderr: stdin: is not a tty

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

DEBUG ssh: Exit status: 32
 INFO retryable: Retryable exception raised: #<Vagrant::Errors::LinuxNFSMountFailed: The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o vers=3 10.98.0.1:'/Users/nivlac/work/nucleus' /home/vagrant/work>
DEBUG ssh: Re-using SSH connection.
 INFO ssh: Execute: mount -o vers=3 10.98.0.1:'/Users/nivlac/work/nucleus' /home/vagrant/work (sudo=true)
DEBUG ssh: stderr: stdin: is not a tty

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

DEBUG ssh: Exit status: 32
 INFO retryable: Retryable exception raised: #<Vagrant::Errors::LinuxNFSMountFailed: The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o vers=3 10.98.0.1:'/Users/nivlac/work/nucleus' /home/vagrant/work>
DEBUG ssh: Re-using SSH connection.
 INFO ssh: Execute: mount -o vers=3 10.98.0.1:'/Users/nivlac/work/nucleus' /home/vagrant/work (sudo=true)
DEBUG ssh: stderr: stdin: is not a tty

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

DEBUG ssh: Exit status: 32
 INFO retryable: Retryable exception raised: #<Vagrant::Errors::LinuxNFSMountFailed: The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o vers=3 10.98.0.1:'/Users/nivlac/work/nucleus' /home/vagrant/work>
DEBUG ssh: Re-using SSH connection.
 INFO ssh: Execute: mount -o vers=3 10.98.0.1:'/Users/nivlac/work/nucleus' /home/vagrant/work (sudo=true)
DEBUG ssh: stderr: stdin: is not a tty

DEBUG ssh: Exit status: 0
DEBUG ssh: Checking whether SSH is ready...
DEBUG ssh: Re-using SSH connection.
 INFO ssh: SSH is ready!
 INFO guest: Execute capability: shell_expand_guest_path (ubuntu)

But once it's created, on any subsequent vagrant up commands (after I do a halt), it just fails.

mount -o vers=3 10.98.0.1:'/Users/nivlac/work/nucleus' /home/vagrant/work>
DEBUG ssh: Re-using SSH connection.
 INFO ssh: Execute: mount -o vers=3 10.98.0.1:'/Users/nivlac/work/nucleus' /home/vagrant/work (sudo=true)
DEBUG ssh: stderr: stdin: is not a tty

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

DEBUG ssh: Exit status: 32
 INFO retryable: Retryable exception raised: #<Vagrant::Errors::LinuxNFSMountFailed: The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o vers=3 10.98.0.1:'/Users/nivlac/work/nucleus' /home/vagrant/work>
DEBUG ssh: Re-using SSH connection.
 INFO ssh: Execute: mount -o vers=3 10.98.0.1:'/Users/nivlac/work/nucleus' /home/vagrant/work (sudo=true)
DEBUG ssh: stderr: stdin: is not a tty

DEBUG ssh: stderr: mount.nfs: access denied by server while mounting 10.98.0.1:/Users/nivlac/work/nucleus

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

mount -o vers=3 10.98.0.1:'/Users/nivlac/work/nucleus' /home/vagrant/work

I've been using Vagrant for several months now... this error just started happening yesterday.

Vagrant version 1.2.4

@n1vlac

This comment has been minimized.

n1vlac commented Jul 18, 2013

Addtl info: From /var/log/syslog:

Jul 18 00:58:58 dev-02 kernel: [  324.707810] RPC: server 10.98.0.1 requires stronger authentication.
Jul 18 00:59:00 dev-02 kernel: [  326.743088] RPC: server 10.98.0.1 requires stronger authentication.
Jul 18 00:59:26 dev-02 kernel: [  352.926302] RPC: server 10.98.0.1 requires stronger authentication.
Jul 18 00:59:38 dev-02 kernel: [  364.570143] RPC: server 10.98.0.1 requires stronger authentication.
@millsb

This comment has been minimized.

millsb commented Jul 18, 2013

I can confirm this problem. Originally thought my NFS problems were fixed by upgrading from 1.2.2 to 1.2.3, only to see the volume fail to mount after the 'up' command was run for the first time. Running Vagrant on OS X 10.8.4 using a precise32 box.

@mitchellh

This comment has been minimized.

Member

mitchellh commented Jul 18, 2013

I can't reproduce this problem, although I clearly believe it is happening due to the many comments here.

To explain the "errors repeateadly" problem (I realize thats not the bug being reported): Vagrant has to restart the host NFS server. So while exit status 32 happens with mount.nfs, Vagrant retries continuously. So that part is working as expected.

But I'm not seeing this problem right now. Any more info to help me?

@n1vlac

This comment has been minimized.

n1vlac commented Jul 18, 2013

Thanks for the reply @mitchellh. I'm not sure what other info I should give. If you google the error "rpc server requires strong auth", there's lots of hits but I can't find a solution.

I'll keep digging.

@mitchellh

This comment has been minimized.

Member

mitchellh commented Aug 29, 2013

I still haven't been able to figure this out. I'm going to need help in order to reproduce this. Have people still been having this problem often? If I can't reproduce this I can't really fix it unfortunately. :(

@lorique

This comment has been minimized.

lorique commented Oct 9, 2013

I've run into this issue as well, but im getting a different error. My log message is as follows:

"mount.nfs: mount to NFS server '192.168.56.1:/Users/user/mount' failed: timed out, giving up"

Running OSX 10.8.5 with vagrant 1.3.4 and virtualbox 4.2.18.

I am unable to connect to my virtualbox to my host.

@GeoffreyPlitt

This comment has been minimized.

GeoffreyPlitt commented Nov 8, 2013

+1

@leahaense

This comment has been minimized.

leahaense commented Nov 18, 2013

Having the same issue running vagrant 1.3.5, VirtualBox 4.2.18 and Mac OS X 10.9.

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

DEBUG ssh: Exit status: 32
 INFO retryable: Retryable exception raised: #<Vagrant::Errors::LinuxNFSMountFailed: The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o 'vers=3,udp' 172.84.98.1:'/path/to/shared/folder' /vagrant

Stdout from the command:



Stderr from the command:

mount.nfs: requested NFS version or transport protocol is not supported
@sebastian-alfers

This comment has been minimized.

sebastian-alfers commented Nov 19, 2013

Same for me

@Furizaa

This comment has been minimized.

Furizaa commented Nov 21, 2013

I can't get it to work on two different machines. Both VirtaulBox 4.3.2, Vagrant 1.3.5 and OSX 10.9

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.240.1:'/Volumes/Media/Code/code/unity/share' /srv/httpd

Stdout from the command:



Stderr from the command:

stdin: is not a tty
mount.nfs: access denied by server while mounting 192.168.240.1:/Volumes/Media/Code/code/unity/share

Edit: Got it working. I completely removed everything Vagrant and VirtualBox and re-installed both. But I guess the trick was to remove any old exports in /etc/exports and restart nfsd.

@mitchellh

This comment has been minimized.

Member

mitchellh commented Nov 24, 2013

For the recent commets here: I increased the retry timeout in core and it seems to have gotten rid of these issues for people. It looks like NFS server takes a bit longer to restart sometimes on Mavericks, oddly.

@mitchellh mitchellh closed this Nov 24, 2013

@leahaense

This comment has been minimized.

leahaense commented Dec 2, 2013

When will this be released? Or is there another way to get this fix?

@nZac

This comment has been minimized.

nZac commented Dec 11, 2013

To be clear, the issue is that Mavericks takes longer to start the NFS server resulting in a timeout of mounting those drives?

Just so I understand this better, does vagrant start the NFS server on vagrant up with Mac OS X hosts?

@petkostas

This comment has been minimized.

petkostas commented Dec 27, 2013

Getting the same problem after apt-get upgrade in my Vagrant box (running on Mac OSX Mavericks) any tips would be welcome.

@petkostas

This comment has been minimized.

petkostas commented Dec 27, 2013

Please ignore, updating to the latest vagrant and virtualbox solved the problem.

@therobyouknow

This comment has been minimized.

therobyouknow commented Feb 25, 2014

Solution for ubuntu 12.04 LTS 64bit as the host machine, nfs common and nfs server both needed to install, also using vagrant 1.3.5 and 4.3.2 of virtualbox (newer version combinations may work)

( faviouz commented in #1534 )

$ sudo apt-get install nfs-common nfs-kernel-server worked for me on Ubuntu 13.10.

therobyouknow commented:

@faviouz - this worked for me too on Ubuntu 12.04 LTS 64bit - thanks both are needed, not just nfs-common. When I had only installed nfs-common, I got this error:

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

mount -o 'vers=3,udp' 33.33.33.1:'/home/hostmachinevagrantfolder/sites' /var/www

Stdout from the command:

Stderr from the command:

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

Once I installed nfs-kernel-server too, this error did not occur

So yes, use:
sudo apt-get install nfs-common nfs-kernel-server

I am using VirtualBox 4.3.2 with Vagrant 1.3.5
Yes I know there are later versions of both but from experience with Mac and Windows, certain version combinations don't work (fatal errors) but I will try the later versions at some point. Sometimes I find that the latest and greatest virtualbox sometimes has regression.

For completeness, a few folks here are going on about repairing /etc/hosts file BUT don't actually say what the repair actually is. OK then, here's what my whole complete /etc/hosts file looks like, here you go! :-

127.0.0.1       localhost
127.0.1.1       rob-ThinkPad-X201s

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
@mikekeilty

This comment has been minimized.

mikekeilty commented Mar 28, 2014

+1 vagrant version: 1.5.1 VirtualBox version: 4.3.10

Exit status: 32 on mount.nfs

@shishirsharma

This comment has been minimized.

shishirsharma commented Apr 16, 2014

+1 on vagrant version: 1.5.1 VirtualBox version: 4.3.10

@sobit

This comment has been minimized.

sobit commented May 5, 2014

For me it was broken /etc/hosts file as well. Accidentally commented line 127.0.0.1 localhost which caused the problem. Uncommenting it was the solution.

@shishirsharma

This comment has been minimized.

shishirsharma commented May 6, 2014

For me it was host only network. vboxnet0
To fix this on mac. Run following on your host (outside of vagrant)

$ sudo ifconfig vboxnet0 down
$ sudo ifconfig vboxnet0 up
@c-castillo

This comment has been minimized.

c-castillo commented May 14, 2014

adding the line 127.0.0.1 localhost to the /etc/hosts file worked for me as well
I'm with vagrant 1.6.2 and vbox 4.3.10

@sinanm89

This comment has been minimized.

sinanm89 commented Jun 7, 2014

can confirm @therobyouknow 's answer works on 14.04 x64 as well.

@mogetutu

This comment has been minimized.

mogetutu commented Jul 16, 2014

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 me unblocking all incoming connections in my firewall settings - OS X did the trick.

@tommcquarrie

This comment has been minimized.

tommcquarrie commented Aug 17, 2014

Tried everything above and could not get mounting to work. Changing the private network ip address seemed to somehow fix it, although not sure why as there shouldn't be any network conflicts.

@therobyouknow

This comment has been minimized.

therobyouknow commented Aug 27, 2014

@tommcquarrie thanks - glad that worked for you. The following may be of interest, #1744 (comment)

@benjifisher

This comment has been minimized.

benjifisher commented Jan 16, 2015

@shishirsharma : 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, but I did not like that "solution".

@fnordfish

This comment has been minimized.

Contributor

fnordfish commented Jan 27, 2015

Just experienced the same ('mount.nfs: requested NFS version or transport protocol is not supported') on OS X Yosemite 10.10.2, vagrant 1.7.2, VirtualBox 4.3.20
After disabling UDP for the nfs connection it worked again: config.vm.synced_folder ".", "/vagrant", type: "nfs", nfs_udp: false
Not sure whats the NFS-UDP status on OS X is right now.

@phpguru

This comment has been minimized.

phpguru commented Feb 18, 2015

For what it's worth

Quote @fnordfish Just experienced the same ('mount.nfs: requested NFS version or transport
protocol is not supported') on OS X Yosemite 10.10.2, vagrant 1.7.2, VirtualBox 4.3.20

Same exact configuration - works on my box, doesn't work on my colleague's box. We cannot seem to figure out any differences between our two MacbookPro's after 8 hours of scouring each other's configs, caches, and googling the errors, uninstalling and reinstalling everything. To no avail. He gets asked for docker@127.0.0.1's password and I don't (it's tcuser). NFS mounts work fine on my box but not on his. Even ran disk utility to see if there were bad folder permissions. It's truly mind-boggling.

@maikelvl

This comment has been minimized.

maikelvl commented Feb 19, 2015

Never thought this would be the problem but i fixed it by setting my /etc/hosts to the default.
Thanks @therobyouknow !
Hope somebody else is helped by this

@ahzab

This comment has been minimized.

ahzab commented Mar 8, 2015

Thanks @shishirsharma Your solution worked for me

$ sudo ifconfig vboxnet0 down
$ sudo ifconfig vboxnet0 up

@lambertbeekhuis

This comment has been minimized.

lambertbeekhuis commented Mar 12, 2015

For me the problems was also caused by the /etc/hosts file of my OSX: I have two vagrant boxes, on different ip-addresses (192.168.56.x and 192.168.55.x). Initially, the both worked, but after restart of my system, I had disable one of these ip-addresses in my hosts file to run a 'vagrant up'.

Can someone explain what is the relation between the hosts file and the mounting of external paths by NFS?

@tristanbes

This comment has been minimized.

tristanbes commented May 19, 2015

I'm facing the same problem (@phpguru) :

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

With:
Vagrant 1.7.2
VirtualBox 4.3.28

OSX 10.10.3

Plugins:
vagrant-cachier (1.2.0)
vagrant-hostmanager (1.5.0)
vagrant-share (1.1.3, system)

I tried on a macbook air with OSX 10.10.3 and it worked with the same settings/versions that on my macbook pro that doesn't. I can't figure out why it's happening to me :/

@j3rrey

This comment has been minimized.

j3rrey commented Jul 6, 2015

installing these
sudo apt-get install nfs-common nfs-kernel-server
fixed it for me.

@rceee

This comment has been minimized.

rceee commented Aug 17, 2015

For me it was a malformed PATH variable. Fixing it in the bash config files, then exiting and restarting the shell completely (sourcing will just append) fixed it.

@fireproofsocks

This comment has been minimized.

fireproofsocks commented Sep 3, 2015

Vagrant used to work fine... now "vagrant up" is prompting for a sudo password -- I suspect that might be related to HFS timing out. Concerned that the user on the host system needs sudo...

@yellowmamba

This comment has been minimized.

yellowmamba commented Oct 28, 2015

I am having the same issue with @tristanbes . I have sudo apt-get install nfs-common nfs-kernel-server run in my guest ubuntu machine, but vagrant reload still spits mount.nfs: requested NFS version or transport protocol is not supported.

@dagonzalezc

This comment has been minimized.

dagonzalezc commented Dec 10, 2015

i have a Mac and had the same problem, the solution for me was changing all the synced_folder in Vagrantfile to nfs_udp:false and nfs: true, everything works in TCP protocol and the default for vagrant is UDP.

@bartmcleod

This comment has been minimized.

bartmcleod commented Dec 18, 2015

Same problem on a Mac since Monday december 14, 2015 after a system reboot. I thought it had to do with installing VMware 8.0.2, but restoring 8.0.0 did not fix the issue. The issue appears with all my VM's. None of the suggestions listed here helped so far. I also tried to issue the command manually from within the VM, also with tcp, but it did not help. Any mismatch between nfs on the guest and nfs on the host (such as a wrong /etc/hosts file) can trigger the error. The same error could come from a port mismatch for nfs (default is 2049). Just in my case, I wasn't lucky enough to find the cause and I am stuck with machines that do not properly sync their files, because I have to turn off nfs to be able to share any files at all. I re-installed Vagrant, I updated the plugins, I reinstalled VMware, I destroyed and rebuilt the boxes, I installed the nfs server inside the box, nothing helped.

I think it has not so much to do with Vagrant itself, but something seems to have changed in the configuration of nfs on the mac that is now conflicting with the box.

Output from netstat:
tcp6 0 0 .2049 *. LISTEN
tcp4 0 0 .2049 *. LISTEN
udp6 0 0 .2049 *.
udp4 0 0 .2049 *.
Looks like the mac is not listening for udp connections on the default nfs port, but it does not help to connect with tcp from the guest machine.

Edit [May 18, 2016]:
After a long time and lots of similar problems, all related to sharing a file system with a vagrant box with either vboxfs, HGFS or nfs, which all failed with similar errors, I realized the cause might be that I installed sshfs on top of OSX FUSE, as explained here: https://github.com/osxfuse/osxfuse/wiki/SSHFS
I followed their instructions to remove sshfs and straight after that, I could use nfs again with a vagrant box.

It seems to me that many solutions provided on this page may work in some situations, but not in others. As soon as file sharing over ssh fails, you get this weird error message, pointing one in the wrong direction, as if nfs wasn't supported. It may be supported allright, but not working for any of many reasons.

Also, if VMware tools aren't (properly) installed, HGFS will fail because of that. If a synced folder other than default is used, nfs might work, but HGFS will still fail on the default folder. This can be solved by explicitly disabling the default folder like so:
mymachine.vm.synced_folder ".", "/vagrant", disabled: true
If you forget this, but are using a custom synced folder AND VMware tools aren't properly installed, you might see a confusing output like this:
==> mymachine: Exporting NFS shared folders... ==> mymachine: Preparing to edit /etc/exports. Administrator privileges will be required... ==> mymachine: Mounting NFS shared folders... ==> mymachine: Waiting for HGFS kernel module to load... The HGFS kernel module was not found on the running virtual machine. This must be installed for shared folders to work properly. Please install the VMware tools within the guest and try again. Note that the VMware tools installation will succeed even if HGFS fails to properly install. Carefully read the output of the VMware tools installation to verify the HGFS kernel modules were installed properly.

Edit[May 23, 2016] And once more, after a reboot of my MacBook Pro, the same error occurs, and this time, there is no sshfs to uninstall, so I am back to where I started...

Same day:
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.

@redrohX

This comment has been minimized.

redrohX commented Feb 29, 2016

@c-castillo solution works for me. 👍

@tibotiber

This comment has been minimized.

tibotiber commented Feb 29, 2016

For me it's similar to @lambertb: with 2 VMs, I had to remove the mapping of the VMs' IP to localhost from /etc/hosts (OS X Yosemite).

@sagotsky

This comment has been minimized.

sagotsky commented Sep 14, 2016

Installing nfs-common and nfs-kernel-service wasn't enough for me. I had to start up both services in debian.

@mbifulco

This comment has been minimized.

mbifulco commented Dec 5, 2016

Just ran into this issue myself, with macOS Sierra as the host OS. Restarting the host seems to have done the trick to fix it for me, but I haven't the slightest clue why.

@fengler-it

This comment has been minimized.

fengler-it commented Feb 1, 2017

Had nfs timoeout while trying to mount from guest to ubuntu 16.04.01 host.
After disabling ufw, it worked! :-)

@gkatsanos

This comment has been minimized.

gkatsanos commented Feb 8, 2017

#1941 (comment) fixed it for me. adding 127.0.0.1 to the hosts file and

$ sudo ifconfig vboxnet0 down
$ sudo ifconfig vboxnet0 up
@nicklaw5

This comment has been minimized.

nicklaw5 commented Feb 24, 2017

@fengler-it's solution worked for me:

$ sudo ufw disable
$ vagrant up --provision
$ sudo ufw enable
@tecnocat

This comment has been minimized.

tecnocat commented Mar 7, 2017

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

#5424 (comment)

@chadfurman

This comment has been minimized.

chadfurman commented May 27, 2017

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.

@leonerd

This comment has been minimized.

leonerd commented Oct 16, 2017

For another take on this: in current debian it seems that nfs-kernel-server is not sufficient for vagrant any more. I had to remove that in favour of the userland implementation of nfs-server, which made it run happily.

$ vagrant --version
Vagrant 1.9.8
@whalesingswee

This comment has been minimized.

whalesingswee commented Nov 6, 2018

Would like to add if you're using OSX 10.14 and running this issue, please follow this simple step would help #10234

The Mojave upgrade removes/disables NFS, resulting the /etc/exports being renamed to #/etc/exportsbak

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment