打包Vagrant框后,NFS失败

Chr*_*isR 8 virtualbox nfs vagrant

我正面临一个奇怪的问题:(重新)包装一个Vagrant盒子,并希望有人可以告诉我在哪个方向看.这就是故事

  • 我安装了Vagrant,并成功创建了一些木偶清单,一切正常,流浪......准备,......
  • 然后我需要切换到失败的NFS,因为我的客户操作系统上没有安装nfs(Ubuntu 11.04-amd64)
  • 我在客户操作系统上安装了nfs-common(sudo apt-get install nfs-common)
  • vagrant halt
  • vagrant up
  • 即使在几次停止/启动命令之后,NFS挂载也能完美运行,我很高兴!

下一个合乎逻辑的步骤是打包盒子,这样每次VM被销毁时我都不需要重新安装nfs-common.

  • 在与上面相同的目录中: vagrant package
  • vagrant box add ubuntuvm2 package.box
  • rm package.box
  • config.vm.boxVagrantfile中的行更改为ubuntuvm2
  • vagrant destroy
  • vagrant up
  • 并且突然nfs挂载失败,当sshing进入VM我可以确认nfs-common确实安装但NFS挂载失败:https://img.skitch.com/20120302-kwix296t44y31rxkd52pwm72f4.jpg

任何人都知道在哪个方向开始寻找解决方案?

我在OS-X Lion上使用Virtualbox 4.1.8和Vagrant 1.0.0

tho*_*alt 13

我遇到了同样的问题,但我已经弄明白了.至少它现在对我有用.:)

TL; DR:

  • 检查/ etc/exports是否存在语法错误,并使用您确保有效的条目重新创建/ etc/exports.
  • 验证盒子上的网络接口是否已正确初始化(检查/ etc/network/interfaces并运行ifconfig -a).
  • 至少Debian和Ubuntu在/etc/udev/rules.d/70-persistent-net.rules中存储有关持久性网络设备的信息.如果您看到eth1初始化为eth2,那是因为在创建新的盒子实例时会重新生成网卡的mac地址.rm /etc/udev/rules.d/70-persistent-net.rules并重新包装你的盒子.
  • 如果您无法重新打包您的盒子更新/ etc/network/interfaces以使用eth2的eth2 instad

长表:

  • Vagrant是1.0.1
  • OS X是10.7.3
  • Box是定制的Debian Wheezy 64.

当重新加载或重新创建框时,它将在NFS安装上死亡并显示典型消息.

[default] Mounting NFS shared folders...
Mounting NFS shared folders failed. This is most often caused by the NFS
client software not being installed on the guest machine. Please verify
that the NFS client software is properly installed, and consult any resources
specific to the linux distro you're using for more information on how to
do this.
Run Code Online (Sandbox Code Playgroud)

使用NFS Manager检查/ etc/exports文件,它告诉我/ etc/exports包含语法错误.

我用这个条目清理/ etc/exports并测试nfs客户端和服务器:

/Users/tm/git -alldirs localhost 33.33.33.10
Run Code Online (Sandbox Code Playgroud)

当运行vagrant时,NFS安装再次正常工作.

在apt-get dist-upgrade之后重新打包时,我注意到NFS文件夹不会再次挂载.

这次/ etc/exports文件中没有错误.我发现Vagrant没有初始化主机本地接口.

/ etc/network/interfaces包含这个:

#VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant. Do not modify.
auto eth1
iface eth1 inet static
    address 33.33.33.10
    netmask 255.255.255.0
#VAGRANT-END
Run Code Online (Sandbox Code Playgroud)

ifconfig -a返回了这个:

eth0      Link encap:Ethernet  HWaddr 08:00:27:3a:47:72  
      inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
      inet6 addr: fe80::a00:27ff:fe3a:4772/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:971 errors:0 dropped:0 overruns:0 frame:0
      TX packets:614 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:83951 (81.9 KiB)  TX bytes:74872 (73.1 KiB)

eth2      Link encap:Ethernet  HWaddr 08:00:27:89:f5:e3  
      BROADCAST MULTICAST  MTU:1500  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
Run Code Online (Sandbox Code Playgroud)

接口未正确定义.在更新/ etc/network/intefaces节以使用eth2之后,NFS安装再次正常工作.