【问题标题】:Provisioning failing with Chef, Vagrant on Mac 10.7.2在 Mac 10.7.2 上使用 Chef、Vagrant 配置失败
【发布时间】:2012-01-13 17:49:05
【问题描述】:

我才刚刚开始使用 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]

通常我会销毁虚拟机并为每次新尝试做 vagrant up,但有几次我尝试 vagrant reload 和 vagrant provision 得到相同的结果。

另外,我不知道这是否正常,但我的 Mac 在进行配置时几乎完全锁定。我通常可以同时运行 2 或 3 个 vmware 虚拟机,而不会觉得它太费劲了,所以让它完全锁定是……奇怪。

【问题讨论】:

    标签: chef-infra vagrant


    【解决方案1】:

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

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

    我仍然不知道是什么导致了我们遇到的问题。可能是 VirtualBox 来宾添加版本不匹配,或者 lucid32 或 lucid64 基本框损坏/不兼容。

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

    【讨论】:

    • 嗯,我也收到了。我已经升级了 Chef gem(几个月前),但是除了警告“这个 VM 上的来宾添加与 VirtualBox 的安装版本不匹配!”之外,还出现了这个错误
    【解决方案2】:

    为响应干杯。

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

    【讨论】:

    • 已确认,也为我工作 - 我收到了 Read-only file system - /var/chef/cache/chef-stacktrace.out (Errno::EROFS) 错误,而 sudo gem update 让它们消失了。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多