流浪错误:NFS报告您的导出文件无效


95

我正在尝试使用这些说明来建立Discourse开发环境。但是,当我运行Vagrant时,出现错误:

NFS报告您的导出文件无效。Vagrant在对文件进行任何更改之前会进行此检查。请更正以下问题,然后执行“无用重新加载”:

无法打开/ etc / exports

我检查了一下,但是没有etc / exports文件夹,所以我创建了一个文件夹并运行了vagrant reload。这让我:

/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/中的/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/plugins/hosts/bsd/host.rb:146:in read': Is a directory - /etc/exports (Errno::EISDIR) from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/plugins/hosts/bsd/host.rb:146:innfs_prune'插件/synced_folders/nfs/synced_folder.rb:68:在cleanup' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builtin/synced_folder_cleanup.rb:24:in/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builtin/synced_folder_cleanup.rb:22:in的通话中each_key' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builtin/synced_folder_cleanup.rb:22:in从/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34中call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/plugins/providers/virtualbox/action/prepare_nfs_valid_ids.rb:12:in调用:从/Applications/Vagrant/embedded/gems/gems/vagrant-1.4调用call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb:118:in/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in中的.1 / lib / vagrant / action / warden.rb:34:in call'call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/plugins/providers/virtualbox/action/prepare_forwarded_port_collision_params.rb:30:in从/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34中call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builtin/env_set.rb:19:in调用:从/Applications/Vagrant/embedded/gems/gems/vagrant-1.4调用.1 / lib / vagrant / action / warden.rb:34:in call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builtin/provision.rb:52:incall'从/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/plugins/providers/virtualbox/action/clear_forwarded_ports.rb:13:incall来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4中的“ /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/plugins/providers/virtualbox/action/set_name.rb:19:incall”。 1 / lib / vagrant / action / warden.rb:34:in call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/plugins/providers/virtualbox/action/clean_machine_folder.rb:17:incall'从/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/plugins/providers/virtualbox/action/check_accessible.rb:18:incall'来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:incall' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:95:in/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in call'from call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in/ Applications / Vagrant / embedded / gems / gems / vagrant 中的finalize_action块-1.4.1 / lib / vagrant / action / builder.rb:116:call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/runner.rb:69:in来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/util/busy.rb中的运行中块: 19:在busy' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/runner.rb:69:in运行中'来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builtin/call.rb:51 :在运行中'从call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in/ Applications / Vagrant / embedded / gems / gems / vagrant-1.4.1 / lib / vagrant / action / warden.rb:95:in call'from block in finalize_action' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb :34:incall' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builder.rb:116:in从/Applications/Vagrant/embedded/gems/gems/vagrant-1.4中调用/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/runner.rb:69:in block in run' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/util/busy.rb:19:inbusy .1 / lib / vagrant / action / runner.rb:69:in call'from run' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builtin/call.rb:51:in/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:95:inblock在/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:incall中来自/ Applications / Vagrant / embedded / gems / gems / vagrant- 1.4.1 / lib / vagrant / action / builder.rb:116:在call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/runner.rb:69:in/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/util/busy.rb:19中运行中:在busy' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/runner.rb:69:incall' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in从/ Applications / Vagrant / embedded / gems / gems / vagrant 运行/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builtin/call.rb:51:in call -1.4.1 / lib / vagrant / action / builtin / config_validate.rb:25:in call'from call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/plugins/providers/virtualbox/action/check_virtualbox。 rb:17:in call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:incall'from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builtin/call.rb:57:in call'from call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in/ Applications / Vagrant / embedded / gems / gems / vagrant-1.4.1 / plugins / providers / virtualbox / action / check_virtualbox.rb:17:in call'from call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action /builtin/config_validate.rb:25:incall' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:95:in block in finalize_action' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:incall'from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4 .1 / lib / vagrant / action / warden.rb:34:in call'from call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builder.rb:116:in/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/runner.rb:69:in block in run' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/util/busy.rb:19:inbusy来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4中的“ /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/runner.rb:69:in run' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builtin/call.rb:51:incall”。 1 / lib / vagrant / action / warden.rb:34:in call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/plugins/providers/virtualbox/action/check_virtualbox.rb:17:incall'从/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builder.rb:116:incall'来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/runner.rb:69:inblock in run' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/util/busy.rb:19:in/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/runner.rb:69:in run' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/machine.rb:147:inaction'from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4 .1 / plugins / commands / reload / command.rb:37:在block in execute' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/plugin/v2/command.rb:193:in/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/plugin/v2/command.rb中with_target_vms的块中: 191:each' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/plugin/v2/command.rb:191:in来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/plugins/commands/reload/command 中的with_target_vms.rb :36 :in execute' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/cli.rb:38:inexecute'来自/ Applications / Vagrant / embedded / gems / gems / cli' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/bin/vagrant:127:in来自/Applications/Vagrant/bin/../embedded/gems/bin/vagrant:23:in load' from /Applications/Vagrant/bin/../embedded/gems/bin/vagrant:23:in'的vagrant-1.4.1 / lib / vagrant / environment.rb:484:in '

我在Mac(OS X 10.6.8)上。我该如何解决?我尝试搜索原始错误消息,发现的只有几个存储库,该存储库包含引发该错误的Vagrant源代码。

Answers:


-32

尝试将Discourse中提到的VirtualBox和Vagrant的已知良好版本用作您的第一个Rails应用程序

我在Mac(OS X 10.9(Mavericks))上遇到了同样的问题,但是回滚到这些版本似乎可以解决我的问题。


谢谢,我仍在完成接下来的安装步骤,但看起来确实可行。
猎人,

3
不需要降级。您只需要运行sudo touch /etc/exports。请参阅colinhoernig的答案。另外,我刚刚将流浪汉安装更新为v1.4.3,将VirtualBox更新为v4.3.8,这似乎解决了我的问题。
甜甜圈2014年

5
这是一个误导性的答案。请选择colinhoemig的答案,因为它的帮助更大!
enjalot 2014年

3
答案不是建设性的和误导性的。我不知道如何将其标记为正确。正确答案是@colinhoernig的投票已被超过50次。为要解决的错误。您需要修复/ etc / exports文件。然后再次构建。
Alexandros Spyropoulos 2015年

1
当您第一次构建具有记录的依赖项的项目时,使用已知有效的确切版本会有所帮助,仅因为存在针对此确切问题的解决方法,并不意味着他不会遇到其他未记录的问题不兼容...-
洛克耶

330

我在VirtualBox安装中安装了一些以前的映像/框,因此已经有一些无效的条目/etc/exports。因此,我不得不清理该文件并重新启动我的Vagrant框。

NFS is reporting that your exports file is invalid. Vagrant does
this check before making any changes to the file. Please correct
the issues below and execute "vagrant reload":

这是我在主机上执行的操作:

sudo rm /etc/exports
sudo touch /etc/exports

vagrant halt
vagrant up --provision

9
这是最适用的一个,因为我有两个装有同一个文件夹的无用信息盒。他们感到困惑!
Wulftone 2014年

32
或者,而不是删除全部,只需删除所有与那些不再存在的VM相关的行。
亚历杭德罗·莫雷诺2014年

2
重命名项目目录名称后出现此问题。谢谢!:)
Radu

4
值得一提的是,该命令应在主机上执行。因为实际上由vagrant box启动,所以我可以登录到它,但是找不到/ etc / exports文件。因为它在主机上。
胖乎乎的

4
我不确定该--provision标志是否在最后一个命令中是必需的,因为通常会在安装NFS up时而不是在预配时安装该标志。在您的设置中可能需要它,但是这些步骤在没有该标志的情况下对我有用。
acobster's

79

我在OS X 10.9 Mavericks(13A603)上遇到了Vagrant 1.4.1和VirtualBox 4.3.6的问题。我能够用一个简单的命令来修复它,以创建丢失的/ etc / exports文件。如以下注释中所述,在OS X而不是guest虚拟机上运行它。

$ sudo touch /etc/exports

这样我就能够成功运行vagrant up。我确实遇到了另一个错误,其中“来宾添加”不是最新的,但我通过安装vagrant-vbguest插件解决了该问题。

$ vagrant plugin install vagrant-vbguest

然后很快vagrant reload,我就开始跑步了!


4
很好的提示,这必须在Mac主机上完成...不在我第一次尝试的访客上
Ramzi 2014年

谢谢@Ramzi,我已经编辑了原文以弄清楚。
colinhoernig 2014年

我必须在linux上使用sudo rm -rf / etc / exports,因为它是一个文件夹
timhc22 2014年

5
我还必须编辑我的/ etc / exports文件,因为它有多个条目,这使流浪汉感到困惑。
enjalot 2014年

我必须删除我的导出文件的内容
David

23

对我来说,此错误开始出现在正在工作的Vagrant环境中。

我已经重命名了Vagrant运行所在的目录。要修复它,我运行了'sudo vi / etc / exports'并修复了路径名,使其指向我的当前目录。


9

这样的事情我也经历过。我从另一个项目复制了Vagrantfile,却忘记更改NFS设置。这导致当前VM挂载了我从中复制原始Vagrantfile的VM的父文件夹。所以我这样做:

vagrant halt
vagrant up

仍然出现相同的错误。因此,我找到了位于/ etc / exports的导出文件,如下所示:

# VAGRANT-BEGIN: 501 64e10d4d-342e-4f55-b69a-97edda35742f
"/Users/[username]/vagrant" 192.168.11.12 -alldirs -mapall=501:20
# VAGRANT-END: 501 64e10d4d-342e-4f55-b69a-97edda35742f
# VAGRANT-BEGIN: 501 b3c6e7fe-95d4-48db-8876-c89d3e07af8d
"/Users/[username]/Sites/molitech-oms" 192.168.11.124 -alldirs -mapall=501:20
# VAGRANT-END: 501 b3c6e7fe-95d4-48db-8876-c89d3e07af8d
# VAGRANT-BEGIN: 501 3e2aabfd-ce63-441b-85a2-1b51e8beb863
"/Users/[username]/Sites/app" 192.168.11.125 -alldirs -mapall=501:20
# VAGRANT-END: 501 3e2aabfd-ce63-441b-85a2-1b51e8beb863
# VAGRANT-BEGIN: 501 ff92e353-9f6d-48ee-9d76-e29b33f1dd60
"/Users/[username]/Sites" 192.168.11.126 -alldirs -mapall=501:20
# VAGRANT-END: 501 ff92e353-9f6d-48ee-9d76-e29b33f1dd60

最后两个路径相同。所以我删除了最后三行并运行:

vagrant halt && vagrant up

现在一切似乎都正常。

OSX 10.11.1流浪汉1.7.4


8

我不想经历降级的麻烦。这就是我所做的(仍然花了一段时间,但是比降级IMHO麻烦些):

  1. 在VM Vagrantfile中,对于任何同步的文件夹,禁用NFS

    config.vm.synced_folder ".", "/vagrant", nfs: false

  2. 删除了/ etc / exports

    sudo mv /etc/exports ~/Desktop/exports

  3. 重写/ etc / exports

    vagrant up

  4. 如果要/需要在VM上启用NFS,请重新启用

    config.vm.synced_folder ".", "/vagrant", nfs: true


4

只需运行以下命令:

sudo rm /etc/exports
sudo touch /etc/exports
vagrant reload

不要使用vagrant up --provision,如果你不知道,这将您的项目不覆盖当前状态。


0

在Ubuntu 12主机/ Ubuntu 12访客上,以下代码对我有用

nfs_setting = RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /linux/
config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", type: "nfs", nfs_udp: "true", nfs_version: "4", :nfs => nfs_setting

注意:我还必须将由Vagrant确定的主机IP地址和由Vagrant确定的访客IP地址添加到防火墙例外中。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.