Skip to content
This repository has been archived by the owner on Apr 19, 2020. It is now read-only.

Running vagrant up hangs on NFS mounting (Vagrant 1.4.3) #4

Closed
tlhunter opened this issue Feb 24, 2014 · 47 comments
Closed

Running vagrant up hangs on NFS mounting (Vagrant 1.4.3) #4

tlhunter opened this issue Feb 24, 2014 · 47 comments

Comments

@tlhunter
Copy link

Vagrant hangs when booting this image while attempting to mount the NFS path. I'm not positive, but I believe Vagrant is failing at OS detection and executing /etc/init.d/nfs-kernel-server on the client. Running Linux Mint (Debian / Ubuntu) on the host.

$ vagrant -v
Vagrant 1.4.3
$ ls
Vagrantfile
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Clearing any previously set forwarded ports...
[default] Fixed port collision for 22 => 2222. Now on port 2200.
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2200 (adapter 1)
[default] Running 'pre-boot' VM customizations...
[default] Booting VM...
[default] Waiting for machine to boot. This may take a few minutes...
[default] Machine booted and ready!
[default] Configuring and enabling network interfaces...
[default] Exporting NFS shared folders...
Preparing to edit /etc/exports. Administrator privileges will be required...
sudo: /etc/init.d/nfs-kernel-server: command not found
[default] Mounting NFS shared folders...

I can, however, kill the boot process, then vagrant ssh to get in (the filesystem of course isn't mounted):

Preparing to edit /etc/exports. Administrator privileges will be required...
sudo: /etc/init.d/nfs-kernel-server: command not found
[default] Mounting NFS shared folders...
^C[default] Waiting for cleanup before exiting...
^C[default] Exiting immediately, without cleanup!
$ vagrant ssh
Last login: Mon Feb 24 17:41:56 2014 from 10.0.2.2
FreeBSD 10.0-RELEASE (GENERIC) #0 r260789: Thu Jan 16 22:34:59 UTC 2014

                                       _    _                  
                 __      ___   _ _ __ | | _(_)  ___  _ __ __ _ 
                 \ \ /\ / / | | | '_ \| |/ / | / _ \| '__/ _` |
                  \ V  V /| |_| | | | |   <| || (_) | | | (_| |
                   \_/\_/  \__,_|_| |_|_|\_\_(_)___/|_|  \__, |
                                                         |___/ 

Email: petar@wunki.org
Twitter: @wunki

Tip of the day:
--------------------------------------------------------------------------------
[vagrant@vagrant-freebsd-10 ~]$ 
@hazbo
Copy link

hazbo commented May 1, 2014

I had the same problem, ended up just updating my Vagrant to 1.5.4 and it works perfectly.

@teaqu
Copy link

teaqu commented Jul 19, 2014

I fixed the problem by adding :mount_options => ['nolock,vers=3,udp,noatime'] after :nfs => true, in the synced_folder config.

@wunki
Copy link
Owner

wunki commented Jul 19, 2014

This is a vagrant related problem, not something we can fix, but can document. Thanks for the tip @Kaamaru.

@johnzachary
Copy link

FWIW, I have this problem, too, with the @Kaamaru fix and vagrant 1.6.3 on virtual box 4.3.14.

@jevonearth
Copy link

I'm also affected by this issue. I'm running 1.6.3, and have tried with and without the mount_options as suggested by @Kaamaru

@wunki You said this is a vagrant related problem. Do you have a reference to the issue with vagrant?

Thanks.

@jevonearth
Copy link

Re-tested with vagrant 1.6.5, both with and without @Kaamaru mount_options. Same behavior, hangs at 'default: Mounting NFS shared folders.' Logs included;

✗ vagrant -v
Vagrant 1.6.5
✗ VBoxManage -v
4.3.14_OSEr95030
 ✗ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'freebsd-10.0-amd64-wunki'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: press_default_1409938407875_65299
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Exporting NFS shared folders...
==> default: Preparing to edit /etc/exports. Administrator privileges will be required...
● nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled)
   Active: active (exited) since Fri 2014-09-05 09:52:58 PDT; 41min ago
  Process: 1643 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
  Process: 1640 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
 Main PID: 1643 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/nfs-server.service

Sep 05 09:52:58 laptop systemd[1]: Started NFS server and services.
==> default: Mounting NFS shared folders...

@jevonearth
Copy link

On further digging, and using VAGRANT_LOG=debug, I see that the guest FreeBSD system is trying to mount the nfs share from 10.0.1.1, which is unreachable.

 INFO ssh: Execute: mount -t nfs '10.0.1.1:/home/jev/projects/press' '/vagrant' (sudo=true)

When I log into the guest freebsd box using vagrant ssh, I can see that I'm connected from 10.0.2.2, and interrogating 10.0.2.2 with rpcinfo, or namp, shows that rpcbind, nfs and ici? are all listening there. By trying to manually run mount -t nfs '10.0.2.2:/home/jev/projects/press' '/vagrant' from the guest, I get a prompt permission denied.

So, it appears that IP addresses are being confused. I have a wireless network card (has had problems running virtaualbox in bridged mode in the past, and I have some docker[0,1] network interfaces too, but I don't think they play a role.

I shall continue digging.

@johnzachary
Copy link

@jevonearth I was able to move past the NFS mount problem by switching to another box (config.vm.box = "chef/freebsd-10.0").

@nickdtodd
Copy link

I've had a problem with this and it turned out that I had duplicate entries in my /etc/exports file. After commenting one of them out it worked. Hope this helps someone.

@jevonearth
Copy link

My problem appears to be my host system, arch linux not supporting nfs over udp. I removed udp from the mount_options, and now the nfs synced_folders work just fine.

Related: hashicorp/vagrant#2989

@FractalizeR
Copy link

I've tried everything suggested here and my box still hangs on

==> default: Mounting NFS shared folders...

@nickdtodd
Copy link

@FractalizeR Are you able to start it in gui mode? I can't remember the setting to add to your Vagrant file but it could be that your box is waiting for input. You would be able to see this in gui mode. I'll try and find you a link.

@nickdtodd
Copy link

@FractalizeR
Copy link

The problem was in starting vagrant command from inside PHPStorm. I just started it from pure shell and got password request for modifying /etc/exports on host machine. After that all went fine.

@gfauredumont
Copy link

Hi,

I tumbled upon this thread while looking for a solution (had the same problem on Mint 17.1).

I could fix it by installing the missing package ;)

sudo apt-get install nfs-kernel-server

more on this here:
hashicorp/vagrant#1534

Hope this helps

@mconigliaro
Copy link

I had this problem with Test Kitchen on CentOS 7. I fixed it by giving sudo privileges to the user running Test Kitchen (I have no idea why it just hung rather then giving me some sort of permission denied error).

@davidstosik
Copy link

@gfauredumont Thanks, your comment above helped me get it working on Linux Mint 17.1. nfs-kernel-server package was not installed.

@aftabnaveed
Copy link

I am having the same problem, taking out udp from mount_options did not work for me, both my guest and hosts are 14.04 LTS

@aftabnaveed
Copy link

apparently it was my Firewall on Ubuntu Host blocking NFS and rpcbind ports

@andrewroth
Copy link

I'm getting this as well. Does anyone know a way to manually run the NFS mount?

@endorama
Copy link

Thanks @aftabnaveed! Your comment made me solve my issue. I had a firewall that was blocking incoming requests and prevented nfs to mount the folder. After disabling the firewall everything was fine.

@renatomefi
Copy link

In my case it was the firewall, I'm using Fedora 21 and we know that all RH based distros come with a very restrict firewall!

Maybe Vagrant should test with a simple netcat if the door is opened, this would made things easier to deduce!

@Azulinho
Copy link

This config works for me:

\>cat Vagrantfile 


Vagrant.configure("2") do |c|


   c.vm.define :freebsd do |f|

      f.vm.box = "opscode-freebsd-10.1"

      f.vm.box_url = "https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_freebsd-10.1_chef-provisionerless.box"

      f.vm.hostname = "freebsd-10.1"

      f.ssh.shell = '/bin/sh'

      f.vm.network(:private_network, {:ip=>"192.168.33.2"})

      f.vm.synced_folder ".", "/vagrant", disabled: true

      f.vm.synced_folder "/home/azul/gits/azulinho-cuisine", "/vagrant", create: true, type: :nfs, :mount_options => ['nolock,vers=3,tcp,noatime,clientaddr=192.168.33.2']

      f.vm.provider :virtualbox do |p|

          p.gui = false

      end

      f.vm.provision :shell, path: 'tests/freebsd/bootstrap.sh'

     end

end

@lordgordon
Copy link

Hi there,

I have the same problem but I found a simple workaround. In fact, as soon vagrant up hangs on the infamous "Mounting NFS" I access the box with vagrant ssh. First, I check it with ps the blocking command:

ps -afxu | grep nfs
mount -t nfs -o nfsv3 192.168.1.1:/Users/mypath/myrepo /vagrant
mount_nfs -o nfsv3 192.168.1.1:/Users/mypath/myrepo

Then I kill and execute it:

sudo killall mount mount_nfs
sudo mount -t nfs -o nfsv3 192.168.1.1:/Users/mypath/myrepo /vagrant

And everything works fine. If you have a firewall enable on host side make sure to add the proper rules. As example, with Little Snitch for OS X you can temporary disable it to run the mount command and the re-enable it (at least while trying this workaround).

Now, this is really boring and it should work out of the box with Vagrant.

Anyone can figure out why the command executed by Vagrant fails? It's something wrong in FreeBSD or it's really a Vagrant bug?

Thanks for your help!

Regards,

Nicholas

Host: OS X 10.9.5
Guest: FreeBSD 10.1-p10
Vagrantfile:

config.vm.network "private_network", ip: "192.168.1.2"
config.vm.synced_folder ".", "/vagrant", create: true, :nfs => true, :mount_options => ['nolock,vers=3,tcp,noatime,clientaddr=192.168.1.2'], id: "vagrant-root"

/etc/exports:

# VAGRANT-BEGIN: 501 XXX-XXX-XXX
"/Users/mypath/myrepo" 192.168.1.2 -alldirs -mapall=501:20
# VAGRANT-END: 501 XXX-XXX-XXX

@fdemmer
Copy link

fdemmer commented Jul 6, 2015

another hint: i needed to restart the nfs-kernel-server after doing a delete and fresh checkout of a project from git. nfs server was probably looking at the old inode.

@jakubigla
Copy link

I have also had this problem and what is causing this is McAfee. Had to change desktop firewall to adaptive mode. If this is not your case, check your anti-virus settings.

@markovic131
Copy link

For Linux (Ubuntu/Debian) make sure you either stop the firewall or add exception.

sudo service ufw stop

@bronger
Copy link

bronger commented Aug 27, 2015

@fdemmer, same here; thank you for the hint! Apparently, this issue can have very many causes. Better diagnostics would be very helpful.

@rafaeltuelho
Copy link

In my case this issue was solved just installing the vagrant-nfs_guest plugin.
After that it simply worked!

@wunki
Copy link
Owner

wunki commented Sep 13, 2015

Moving this to documentation soon.

@wunki wunki closed this as completed Sep 13, 2015
@dogawaf
Copy link

dogawaf commented Oct 8, 2015

@rafaeltuelho thx, installing the vagrant-nfs_guest plugin solved my issue too. It's weird, because I don't need the features offered by this plugin.

@bradfloodx
Copy link

For anyone on OSX check your Firewall preferences System Preferences -> Security & Privacy -> Firewall -> Firewall Options.
Make sure Automatically allow signed software to receive incoming connections is checked.

Otherwise just disable the OSX Firewall altogether if you don't need it.

@lordgordon
Copy link

@bradleyflood Actually, I don't have that option enabled and it works fine. In fact I don't think is a good security suggestion.

Please look at your settings, it's not necessary to disable the firewall to make NFS working properly with Vagrant.

@dadasoz-cuelogic
Copy link

Work for me -

VAGRANT_USE_VBOXFS=true vagrant up

@bakicdj
Copy link

bakicdj commented Oct 30, 2015

It was a firewall in my case. sudo ufw disable solved it.

@eduardodx
Copy link

Thank you @bradleyflood!

@netmikey
Copy link

netmikey commented Jan 8, 2016

Thanks, @bradleyflood!

@stadnitski
Copy link

@bradleyflood THANK YOU!!!

@tooshay
Copy link

tooshay commented Jul 28, 2016

We had a similar issue; turns out it was McAfee firewall blocking it all along.

@rhyw
Copy link

rhyw commented Sep 5, 2016

My case is that the nfs directory from the host server is not visible on guest.
This http://unix.stackexchange.com/a/243808/188279 resolves it.
PS I'm running on fedora 23, a rhel7.2 box with libvirt.

Hope that helps someone.

@LarkRiseMedia
Copy link

LarkRiseMedia commented Oct 10, 2016

It was McAfee that was blocking the NFS share on Vagrant. Anyone know what rule to put into McAfee to enable this to work as kinda would like the firewall on!

@chadfurman
Copy link

+1 firewall issue. Had to disable suse's default firewall. Not ideal, will have to add a rule at somepoint

@nicklaw5
Copy link

nicklaw5 commented Mar 3, 2017

For Debian users. If you've configured a private IP for your Vagrant machine, similar to this:

config.vm.network "private_network", ip: "192.168.50.50"

You just need to add as firewall exception for that specific IP:

$ sudo ufw allow from 192.168.50.50
$ sudo service ufw restart

@chadfurman
Copy link

chadfurman commented Mar 6, 2017

for SuSE users: edit /etc/sysconfig/SuSEfirewall2

find FW_TRUSTED_NETS and add the VBox net.

i.e. FW_TRUSTED_NETS="192.168.33.0/24"

then re-issue the firewall command to reload rules:

# SuSEfirewall2

@chadfurman
Copy link

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.

EDIT: DON'T FORGET TO LINK YOUR INTERFACE!
$ sudo ip link set vboxnet0 up

@cfebs
Copy link

cfebs commented Jul 20, 2017

Ubuntu 16.04.2
Virtualbox Version 5.1.24 r117012 (Qt5.5.1)
Vagrant 1.9.7

Similar to @chadfurman , ifconfig -a showed my vboxnet0 host only interface down but it had an ip, so sudo ifconfig vboxnet0 up was the fix.

Not exactly sure why but i'll be keeping an eye out on reboot, I believe i just updated virtualbox versions.

UPDATE

So yes my host only network will not come up when vagrant starts anymore, very interesting. My vagrant file line for the private network is: config.vm.network "private_network", ip: IP_ADDR, nictype: "virtio"

Also it looks like the real source of the issue is being discussed here: hashicorp/vagrant#8166

@midia-developer
Copy link

Docker had added a similar entity for me at
/Users

So Vagrant was unable to share the NFS
/Users/jonw/Sites

Fixed by commentating out the docker line

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests