Nerd in Action Code is poetry

Fix a vagrant nfs issue

Today, when I tried to vagrant up a local box as what I usually do, it failed to mount nfs folder. After a lot of googling, I fixed that by simply restarting the network adapter.

Environment

Error

==> 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:'/Users/xuli/Projs/PHP/test' /vagrant

Stdout from the command:



Stderr from the command:

stdin: is not a tty
mount.nfs: mount to NFS server '192.168.50.1:/Users/xuli/Projs/PHP/test' failed: timed out, giving up

Solution

# vboxnetX is the name of Host-only Adapter.
# You can find that in VirtualBox(Settings -> Network -> Adapter 2).
sudo ifconfig vboxnetX down
sudo ifconfig vboxnetX up

Helpful resources