Subscribed unsubscribe Subscribe Subscribe

Chef ServerをCentOS6.3にインストールする

http://wiki.opscode.com/display/chef/Installing+Chef+Server+using+Chef+Solo

を参考に、Chef ServerをCentOS6.3にインストールした。一部エラーが発生しつまづいたのでメモっておきます。

なお、rubyrubygems、その他必要なライブラリはCentOS標準のものをyumでインストールし、chef-soloはgemで最新(10.16.0)をインストール済みの環境です。

遭遇したエラー

chef-solo -c /etc/chef/solo.rb -j ~/chef.json -r http://s3.amazonaws.com/chef-solo/bootstrap-latest.tar.gz

の実行で以下のエラーが出る。

Generated at Tue Oct 23 20:13:15 +0900 2012
Mixlib::ShellOut::ShellCommandFailed: service[chef-expander] (chef-server::rubygems-install line 219) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /sbin/service chef-expander start ----
STDOUT: chef-expander を起動中: [失敗]
STDERR: /usr/lib/ruby/site_ruby/1.8/rubygems.rb:233:in `activate': can't activate eventmachine (~> 0.12.10, runtime) for ["chef-expander-10.16.0"], already activated eventmachine-1.0.0 for ["amqp-0.6.7", "chef-expander-10.16.0"] (Gem::LoadError)
        from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:249:in `activate'
        from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:248:in `each'
        from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:248:in `activate'
        from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:1082:in `gem'
        from /usr/sbin/chef-expander:18
---- End output of /sbin/service chef-expander start ----
Ran /sbin/service chef-expander start returned 1
/usr/lib/ruby/gems/1.8/gems/mixlib-shellout-1.1.0/lib/mixlib/shellout.rb:248:in `invalid!'
/usr/lib/ruby/gems/1.8/gems/mixlib-shellout-1.1.0/lib/mixlib/shellout.rb:234:in `error!'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/mixin/shell_out.rb:36:in `shell_out!'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/provider/service/init.rb:53:in `start_service'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/provider/service.rb:90:in `action_start'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/mixin/why_run.rb:63:in `call'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/mixin/why_run.rb:63:in `converge!'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/mixin/why_run.rb:61:in `each'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/mixin/why_run.rb:61:in `converge!'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/provider.rb:136:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/provider.rb:125:in `run_action'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/resource.rb:593:in `run_action'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/runner.rb:49:in `run_action'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/runner.rb:81:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/runner.rb:81:in `each'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/runner.rb:81:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/resource_collection.rb:94:in `execute_each_resource'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/resource_collection.rb:92:in `execute_each_resource'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/runner.rb:80:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/client.rb:378:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/client.rb:420:in `do_run'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/client.rb:176:in `run'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/application.rb:140:in `run_chef_client'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/application/solo.rb:224:in `run_application'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/application/solo.rb:216:in `loop'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/application/solo.rb:216:in `run_application'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/../lib/chef/application.rb:72:in `run'
/usr/lib/ruby/gems/1.8/gems/chef-10.16.0/bin/chef-solo:25
/usr/bin/chef-solo:19:in `load'
/usr/bin/chef-solo:19

解決策

chefのメーリングリストに解決方法があり。

http://lists.opscode.com/sympa/arc/chef/2012-09/msg00333.html

eventmachine の 1.0.0をアンインストールし、chef-soloでのインストールを再実行すれば成功した。アンインストールは下記コマンドを実行し、1.0.0の削除を選ぶ。

gem uninstall eventmachine