将NFS与vagrant一​​起使用不起作用

8 nfs vagrant vagrantfile

我的Vagrantfile中有以下内容:

config.vm.network :private_network, ip: "10.0.0.103"
config.vm.synced_folder ".", "/vagrant/", type: "nfs"
Run Code Online (Sandbox Code Playgroud)

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 'vers=3,udp' 10.0.0.1:'/Users/wayne/app' /vagrant

Stdout from the command:



Stderr from the command:

stdin: is not a tty
mount.nfs: access denied by server while mounting 10.0.0.1:/Users/wayne/app
Run Code Online (Sandbox Code Playgroud)

然后我需要vagrant reload它似乎工作......但我当然不应该这样做?

[更新:日志输出]

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' 10.0.0.1:'/Users/wayne/sonatribe' /vagrant

Stdout from the command:



Stderr from the command:

stdin: is not a tty
mount.nfs: requested NFS version or transport protocol is not supported
>
 INFO ssh: Execute: mount -o 'vers=3,udp' 10.0.0.1:'/Users/wayne/sonatribe' /vagrant (sudo=true)
 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' 10.0.0.1:'/Users/wayne/sonatribe' /vagrant

Stdout from the command:



Stderr from the command:

stdin: is not a tty
mount.nfs: requested NFS version or transport protocol is not supported
Run Code Online (Sandbox Code Playgroud)

Ole*_*rov 5

对于Linux,我在主机上执行此操作:

systemctl stop nfs-kernel-server.service
systemctl disable nfs-kernel-server.service
systemctl enable nfs-kernel-server.service
systemctl start nfs-kernel-server.service
Run Code Online (Sandbox Code Playgroud)

  • 仅供参考,这仅适用于 Linux,不适用于 macOS 和 Windows (2认同)

小智 0

将基础镜像降级并更改为 LTS Ubuntu(而不是 XUbuntu)似乎可以解决这个问题。