Skip to content
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

Encountering "mount.nfs: access denied by server" on Ubuntu 16.10 with NFS synced_folder configured #8241

Closed
revprez opened this issue Jan 31, 2017 · 10 comments
Assignees

Comments

@revprez
Copy link

revprez commented Jan 31, 2017

System

  1. Ubuntu 16.10
  2. nfs-kernel-server, nfs-common, and rpcbind are installed
  3. Virtualbox 5.1.6
  4. Vagrant 1.9.1
  5. Also employing vagrant-bindfs (though error proceeds its invocation)
  6. Using centos/7 box.
  7. /etc/exports modified by Vagrant like so:
    # VAGRANT-BEGIN: 1000 4b162241-d3a5-410c-a910-09a83ea90146
    "/home/revprez/dev/scm/git/encirca/orchestration/encirca-core-orchestration" 192.168.50.4(rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000,fsid=4169747921)
    # VAGRANT-END: 1000 4b162241-d3a5-410c-a910-09a83ea90146
    

Issue

After running vagrant up, encountering the following error:

Jan 31 11:06:55 mirai systemd[1]: Starting NFS server and services...
Jan 31 11:06:55 mirai systemd[1]: Started NFS server and services.
==> 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/revprez/dev/scm/git/encirca/orchestration/encirca-core-orchestration /vagrant-nfs
result=$?
if test $result -eq 0; then
if test -x /sbin/initctl && command -v /sbin/init && /sbin/init 2>/dev/null --version | grep upstart; then
/sbin/initctl emit --no-wait vagrant-mounted MOUNTPOINT=/vagrant-nfs
fi
else
exit $result
fi


Stdout from the command:



Stderr from the command:

mount.nfs: access denied by server while mounting 192.168.50.1:/home/revprez/dev/scm/git/encirca/orchestration/encirca-core-orchestration

Investigation

  1. Logged into the guest (vagrant ssh)
  2. Ran the NFS mount command with some verbosity and observed the output.
    [vagrant@regystar ~]$ sudo mount -v -o vers=3,udp 192.168.50.1:/home/revprez/dev/scm/git/encirca/orchestration/encirca-core-orchestration /vagrant-nfs
    mount.nfs: timeout set for Tue Jan 31 17:36:07 2017
    mount.nfs: trying text-based options 'vers=3,udp,addr=192.168.50.1'
    mount.nfs: prog 100003, trying vers=3, prot=17
    mount.nfs: trying 192.168.50.1 prog 100003 vers 3 prot UDP port 2049
    mount.nfs: prog 100005, trying vers=3, prot=17
    mount.nfs: trying 192.168.50.1 prog 100005 vers 3 prot UDP port 45228
    mount.nfs: mount(2): Permission denied
    mount.nfs: access denied by server while mounting 192.168.50.1:/home/revprez/dev/scm/git/encirca/orchestration/encirca-core-orchestration
    
    

Related issues

Mine my duplicate #5424, #100, and others.

@kikitux
Copy link
Contributor

kikitux commented Jan 31, 2017

@revprez

Can you please:

  • provide /var/log/message or relevant file for ubuntu (syslog?)
  • try to mount a folder outside /home, try /media/test

sudo mkdir /media/test
sudo chown /media/test

and share that folder

Thanks

@kikitux kikitux self-assigned this Jan 31, 2017
@revprez
Copy link
Author

revprez commented Jan 31, 2017

Same issue:

Jan 31 16:56:49 mirai systemd[1]: Starting NFS server and services...
Jan 31 16:56:50 mirai systemd[1]: Started NFS server and services.
==> 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:/media/test /vagrant-nfs
result=$?
if test $result -eq 0; then
if test -x /sbin/initctl && command -v /sbin/init && /sbin/init 2>/dev/null --version | grep upstart; then
/sbin/initctl emit --no-wait vagrant-mounted MOUNTPOINT=/vagrant-nfs
fi
else
exit $result
fi


Stdout from the command:



Stderr from the command:

mount.nfs: access denied by server while mounting 192.168.50.1:/media/test

@revprez
Copy link
Author

revprez commented Feb 1, 2017

Additionally, tried manually with some verbosity on the guest:

[vagrant@regystar ~]$ sudo mount -v -o vers=3,udp 192.168.50.1:/media/test/ /vagrant-nfs
mount.nfs: timeout set for Wed Feb  1 04:53:14 2017
mount.nfs: trying text-based options 'vers=3,udp,addr=192.168.50.1'
mount.nfs: prog 100003, trying vers=3, prot=17
mount.nfs: trying 192.168.50.1 prog 100003 vers 3 prot UDP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.50.1 prog 100005 vers 3 prot UDP port 37853
mount.nfs: mount(2): Permission denied
mount.nfs: access denied by server while mounting 192.168.50.1:/media/test/

@revprez
Copy link
Author

revprez commented Feb 1, 2017

Also confirmed this fails on macOS Sierra. Even in what I think should be the trivial case:

Test Vagrantfile fully complete is below:

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

   config.vm.box = 'centos/7'
   config.vm.hostname = hostname

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

    config.vm.synced_folder ".", "/vagrant-nfs", type: "nfs"
    # config.bindfs.bind_folder "/vagrant-nfs", "/vagrant"
	
    

end

@peterdragon
Copy link

See also #8138

@Abam
Copy link

Abam commented Feb 13, 2017

There are some problems when NAT is enabled in virtualbox. Instead of setuping network for eth1, Vagrant try to configure eth0 which is already used.

Please check /etc/network/interfaces file (in the virtual machine) for confirmation.

@revprez
Copy link
Author

revprez commented Feb 16, 2017

@kikitux : Not sure if you saw my previous replies, but after looking at #8138 at @peterdragon's suggestion, I note that mounting succeeds after restarting the network service:

[root@regystar ~]# ip route
default via 10.0.2.2 dev eth0  proto static  metric 100
10.0.2.0/24 dev eth0  proto kernel  scope link  src 10.0.2.15  metric 100
[root@regystar ~]# service network restart
Restarting network (via systemctl):                        [  OK  ]
[root@regystar ~]# ip route
default via 10.0.2.2 dev eth0  proto static  metric 100
10.0.2.0/24 dev eth0  proto kernel  scope link  src 10.0.2.15  metric 100
169.254.0.0/16 dev eth1  scope link  metric 1003
192.168.50.0/24 dev eth1  proto kernel  scope link  src 192.168.50.4
[root@regystar ~]# mount -o vers=3,udp 192.168.50.1:/Users/revprez/dev/scm/git/encirca/orchestration/encirca-core-orchestration /vagrant-nfs

However, this doesn't solve my problem, as I have additional bindfs configuration to proceed to afterwards. vagrant reload also blows away the new route.

@revprez
Copy link
Author

revprez commented Feb 16, 2017

@kikitux : This issue seems to be resolved in 9661134. A quick patch succeeded.

Any idea when the next Vagrant release is due?
0001-Revert-Fix-service-network-restart-on-RHEL-7-Fedora.patch.txt

@chrisroberts
Copy link
Member

Hi there,

It looks like this has been resolved within a previously shipped version of Vagrant so I am now closing this issue. If the original issue was not fully resolved, please reopen this issue or create a new one.

Cheers!

@ghost
Copy link

ghost commented Apr 2, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants