在Mac 10.7.2上使用Chef,Vagrant配置失败

时间:2012-01-06 18:21:48

标签: chef vagrant

我刚刚开始使用Vagrant和Chef,但我得到了我认为非常奇怪的错误。

每个人都可以使用简单的虚拟机而且没有厨师,但是当我在其中粘贴一些收件人失败时。

这是我从Vagrantfile调用的主配方的当前default.rb。它主要来自这个blog / tutorial

r = execute "apt-get update" do
  user "root"
  command "apt-get update"
  action :nothing
end
r.run_action(:run)

include_recipe "php"
include_recipe "apache2"
include_recipe "mysql"

php apache2和mysql配方直接来自opscode社区网站。

如果我只是将其中一个食谱放进去,那么它就可以正常加载。 有时两个很好,但是如果我把所有三个都放进去,那么最后一个似乎会导致错误。我已经改变了顺序,它总是导致错误的最后一个。这是错误 - 每次都一样,但在这种情况下,php是三个中的最后一个,你可以看到它无法安装:

[default] [Fri, 06 Jan 2012 10:01:33 -0800] INFO: Processing package[php5] action install (php::package line 32)
: stdout
[default] [Fri, 06 Jan 2012 10:04:52 -0800] ERROR: package[php5] (php::package line 32) has had an error
: stdout
[default] [Fri, 06 Jan 2012 10:04:52 -0800] ERROR: Running exception handlers
: stdout
[default] [Fri, 06 Jan 2012 10:04:52 -0800] ERROR: Exception handlers complete
: stdout
[default] /opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/file_cache.rb:54:in `initialize': stderr
[default] : : stderr
[default] Read-only file system - /tmp/vagrant-chef-1/chef-stacktrace.out: stderr
[default]  (: stderr
[default] Errno::EROFS: stderr
[default] )
: stderr
[default]   from /opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/file_cache.rb:54:in `open'
: stderr
[default]   from /opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/file_cache.rb:54:in `store'
: stderr
[default]   from /opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/application.rb:133:in `debug_stacktrace'
: stderr
[default]   from /opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/application/solo.rb:210:in `run_application'
: stderr
[default]   from /opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/application/solo.rb:183:in `loop'
: stderr
[default]   from /opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/application/solo.rb:183:in `run_application'
: stderr
[default]   from /opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/application.rb:66:in `run'
: stderr
[default]   from /opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/chef-solo:25
    from /opt/ruby/bin/chef-solo:19:in `load'
    from /opt/ruby/bin/chef-solo:19
: stderr
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

chef-solo -c /tmp/vagrant-chef-1/solo.rb -j /tmp/vagrant-chef-1/dna.json

The output of the command prior to failing is outputted below:

[no output]

通常情况下,我正在摧毁虚拟机并为每次尝试做出流浪汉,但有几次我尝试了流浪汉重新加载和流浪汉提供相同的结果。

另外,我不知道这是否正常,但我的Mac在进行配置时几乎完全锁定。我通常可以同时运行2或3个vmware vms而不会觉得它太过挣扎,所以它完全锁定是......奇怪的。

2 个答案:

答案 0 :(得分:2)

我有一个非常相似的错误,但似乎找到了解决方案。

尝试了很多东西(不同的基本框,不同的VirtualBox版本,一次又一次地尝试)后,我终于通过构建自己的Vagrant基础框取得了进展。我按照Vagrant(base box build)和Chef(chef-solo install)网站上的说明进行操作。虽然这需要一段时间而且很棘手我现在对基盒的状态有了更好的信心并且更加快乐。

我仍然不知道是什么原因引起了我们的问题。也许这是VirtualBox guest添加版本中的不匹配或者lucid32或lucid64基本框中的损坏/不兼容。

作为参考,我安装了Ubuntu服务器11.10并从包中安装了Chef。如果有需求,我很乐意在某处上传我的(700mb)oneiric64基本图像。

答案 1 :(得分:2)

为回应干杯。

原来,我有一些依赖宝石的旧版本。一旦Id完成了宝石更新,问题就消失了。