3

This is not about vagrant or virtualbox guest running slowly due to slow shared folder access, we know that can be resolved more or less by enabling nfs.

It's rather about mounted shared folder go out of sync when there are many file operations within the vm (enable nfs does not prevent it from happening) .

For example, when we are installing packages, like with php composer or node.js npm inside the vm, there is a certain probability that normal composer update or npm install will fail, and once it failed, only vagrant reload will help to restore the sync folder and allow the same command to pass without problem.

Such random failure only happens when executing on shared folder (nfs or not), so apt-get upgrade won't trigger the same problem as it runs within the vm folders.

Since the same sync problem does not appear when we run composer or npm from the host server, I am wondering what could have caused it and how do we go about debugging it?

Our vagrant setup and config:

if Vagrant::Util::Platform.windows?
    config.vm.synced_folder "www", "/var/www", :extra => "dmode=777,fmode=777", :owner => "vagrant", :group => "vagrant"
else
    config.vm.synced_folder "www", "/var/www", :extra => "dmode=777,fmode=777", :nfs => true
end

Guest: Ubuntu 12.04 LTS x64

Host: Windows 8, Mac OSX 10.8, Ubuntu 13 (yes, they all run into the same problem randomly)

4

1 回答 1

8

想想我们或多或少地发现了问题的根源:

我们的 Ubuntu 12 LTS 盒子附带的 Guest Addition 版本 (4.1.x) 与主机上安装的当前 Virtualbox 版本 (4.2.x) 不匹配。所以文件同步失败。

简单的修复:

  1. 在 vm 中运行此命令sudo apt-get -y -q purge virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11以删除旧的来宾添加

  2. 安装 vagrant vbguest 插件,以便在以后自动更新uphttps ://github.com/dotless-de/vagrant-vbguest

于 2013-09-23T03:39:37.260 回答