Chef Client failed. 0 resources updated in 01 seconds - ERROR: wrong number of arguments (given 1, expected 3) - ruby

I am trying to run a simple Hazelcast cluster on Amazon EC2 following the official code sample, every step seems to be OK but when running vagrant up --provider=aws ( under the header "Let's do this thing" ) it fails as shown:
==> hazelcast2: - ohai (5.2.0)
==> hazelcast2: Installing Cookbook Gems:
==> hazelcast2: Compiling Cookbooks...
==> hazelcast2: [2017-10-24T20:03:06+00:00] INFO: The plugin path /etc/chef/ohai/plugins does not exist. Skipping...
==> hazelcast2: [2017-10-24T20:03:06+00:00] WARN:
[DEPRECATION] Plugin at /tmp/vagrant-chef/ohai/cookbook_plugins/ohai/hint.rb is a version 6 plugin.
Version 6 plugins will not be supported in Chef/Ohai 14. Please upgrade your plugin to version 7 plugin format.
For more information visit here: docs.chef.io/ohai_custom.html
==> hazelcast2:
==> hazelcast2: Running handlers:
==> hazelcast2: [2017-10-24T20:03:06+00:00] ERROR: Running exception handlers
==> hazelcast2: Running handlers complete
==> hazelcast2:
==> hazelcast2: [2017-10-24T20:03:06+00:00] ERROR: Exception handlers complete
==> hazelcast2: Chef Client failed. 0 resources updated in 01 seconds
==> hazelcast2: [2017-10-24T20:03:06+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> hazelcast2: [2017-10-24T20:03:06+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
==> hazelcast2: [2017-10-24T20:03:06+00:00] ERROR: wrong number of arguments (given 1, expected 3)
==> hazelcast2: [2017-10-24T20:03:06+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully
(exit code 1)
==> hazelcast2: An error occurred. The error will be shown after all tasks complete.
An error occurred while executing multiple actions in parallel.
Any errors that occurred are shown below.
An error occurred while executing the action on the 'hazelcast1' machine.
Please handle this error then try again:
Chef never successfully completed! Any errors should be visible in the output above.
Please fix your recipes so that they properly complete.
An error occurred while executing the action on the 'hazelcast2' machine.
Please handle this error then try again:
Chef never successfully completed! Any errors should be visible in the output above.
Please fix your recipes so that they properly complete.
/var/chef/cache/chef-stacktrace.out:
Generated at 2017-10-24 21:36:55 +0000
ArgumentError: wrong number of arguments (given 1, expected 3)
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.5.0/lib/ohai/dsl/plugin/versionvi.rb:27:in `initialize'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.5.0/lib/ohai/loader.rb:223:in `new'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.5.0/lib/ohai/loader.rb:223:in `load_v7_plugin'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.5.0/lib/ohai/loader.rb:93:in `block in load_additional'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.5.0/lib/ohai/loader.rb:90:in `collect'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.5.0/lib/ohai/loader.rb:90:in `load_additional'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.5.0/lib/ohai/system.rb:116:in `run_additional_plugins'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/run_context/cookbook_compiler.rb:119:in `compile_ohai_plugins'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/run_context/cookbook_compiler.rb:73:in `compile'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/run_context.rb:192:in `load'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/policy_builder/expand_node_object.rb:97:in `setup_run_context'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/client.rb:513:in `setup_run_context'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/client.rb:281:in `run'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/application.rb:291:in `block in fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/application.rb:279:in `fork'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/application.rb:279:in `fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/application.rb:244:in `block in run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/local_mode.rb:44:in `with_server_connectivity'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/application.rb:232:in `run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/application/client.rb:469:in `sleep_then_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/application/client.rb:458:in `block in interval_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/application/client.rb:457:in `loop'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/application/client.rb:457:in `interval_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/application/client.rb:441:in `run_application'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/application.rb:59:in `run'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/application/solo.rb:225:in `run'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/bin/chef-solo:25:in `<top (required)>'
/usr/bin/chef-solo:58:in `load'
/usr/bin/chef-solo:58:in `<main>'
Ohai version:
ohai -version
Ohai: 13.5.0
Java jdk not installed (when it should be according to the receipt):
java -version
The program 'java' can be found in the following packages:
* default-jre
* gcj-5-jre-headless
* openjdk-8-jre-headless
* gcj-4.8-jre-headless
* gcj-4.9-jre-headless
* openjdk-9-jre-headless
Try: sudo apt install <selected package>
Following the Stacktrace I got to the point where I believe it has something to do with the fact that the function:
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.5.0/lib/ohai/dsl/plugin/versionvi.rb:27:in `initialize':
def initialize(controller, plugin_path, plugin_dir_path)
super(controller.data)
#controller = controller
#version = :version6
#source = plugin_path
#plugin_dir_path = plugin_dir_path
end
... requires 3 parameters and is called with only one in:
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.5.0/lib/ohai/loader.rb:223:in 'new' in the function:
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.5.0/lib/ohai/loader.rb:223:in `load_v7_plugin'
def load_v7_plugin(plugin_class)
plugin = plugin_class.new(#controller.data)
collect_provides(plugin)
plugin
end
I repeated the steps on an Ubuntu 14.04 and on an Ubuntu 16.04 VM and I am still stuck with the same Error, any idea what I am doing wrong?
P.S. I am just following the steps in the sample.
Thank you

The important bit is probably this:
[DEPRECATION] Plugin at /tmp/vagrant-chef/ohai/cookbook_plugins/ohai/hint.rb is a version 6 plugin.
Version 6 plugins will not be supported in Chef/Ohai 14. Please upgrade your plugin to version 7 plugin format.
For more information visit here: docs.chef.io/ohai_custom.html
Figure out what is installing that plugin and check if anything is in the same folder and is an invalid plugin.

Related

Chef server 12 and Client 12 - Error 503: Service unavailable

I have a standalone Chef server hosted on a Ubuntu 14.04 machine. Installed the server by following https://learn.chef.io/install-and-manage-your-own-chef-server/linux/ by using latest versions.
When I tried to bootstrap a node, it installs client version 11.x and works. But most of the cookbooks in the market is not compatible to client 11 and requires client 12.x.
So, I supplied client version 12.x as parameter to my bootstrap command, which installs client version 12.x to the node to bootstrap. But this time I got HTTP 503 - 503 "Service Unavailable" error and not able to complete bootstrapping.
My Workstation (Mac 10.11.1)
$chef --version
Chef Development Kit Version: 0.10.0
chef-client version: 12.5.1
berks version: 4.0.1
kitchen version: 1.4.2
My Server (Ubuntu 14.04.2)
$ dpkg --status chef
Package: chef
Status: install ok installed
Priority: extra
Section: misc
Installed-Size: 107919
Maintainer: Chef Software, Inc. <maintainers#chef.io>
Architecture: amd64
Version: 11.18.12-1
Description: The full stack of chef
License: unknown
Vendor: Omnibus <omnibus#getchef.com>
Homepage: https://www.getchef.com
$ dpkg --status chef-server-core
Package: chef-server-core
Status: install ok installed
Priority: extra
Section: misc
Installed-Size: 1190291
Maintainer: Chef Software, Inc.
Architecture: amd64
Version: 12.3.1-1
Replaces: private-chef
Conflicts: private-chef
Description: The full stack of chef-server
License: unknown
Vendor: Omnibus <omnibus#getchef.com>
Homepage: https://www.chef.io
Node (Ubuntu 14.04.2)
$ chef-client -v
Chef: 12.6.0
Here is the error:
Connecting to <nodes_ip>
10.97.151.49 -----> Existing Chef installation detected
10.97.151.49 Starting the first Chef Client run...
10.97.151.49 Starting Chef Client, version 12.6.0
10.97.151.49 Creating a new client identity for web_app_ubuntu using the validator key.
10.97.151.49 [2015-12-25T14:50:47+00:00] WARN: Failed to register new client, 4 tries remaining
10.97.151.49 [2015-12-25T14:50:47+00:00] WARN: Response: HTTP 503 - 503 "Service Unavailable"
10.97.151.49 [2015-12-25T14:52:26+00:00] WARN: Failed to register new client, 3 tries remaining
10.97.151.49 [2015-12-25T14:52:26+00:00] WARN: Response: HTTP 503 - 503 "Service Unavailable"
10.97.151.49 [2015-12-25T14:54:15+00:00] WARN: Failed to register new client, 2 tries remaining
10.97.151.49 [2015-12-25T14:54:15+00:00] WARN: Response: HTTP 503 - 503 "Service Unavailable"
10.97.151.49 [2015-12-25T14:56:01+00:00] WARN: Failed to register new client, 1 tries remaining
10.97.151.49 [2015-12-25T14:56:01+00:00] WARN: Response: HTTP 503 - 503 "Service Unavailable"
10.97.151.49 [2015-12-25T14:57:48+00:00] WARN: Failed to register new client, 0 tries remaining
10.97.151.49 [2015-12-25T14:57:48+00:00] WARN: Response: HTTP 503 - 503 "Service Unavailable"
10.97.151.49
10.97.151.49 Running handlers:
10.97.151.49 [2015-12-25T14:59:36+00:00] ERROR: Running exception handlers
10.97.151.49 Running handlers complete
10.97.151.49 [2015-12-25T14:59:36+00:00] ERROR: Exception handlers complete
10.97.151.49 Chef Client failed. 0 resources updated in 10 minutes 38 seconds
10.97.151.49 [2015-12-25T14:59:36+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
10.97.151.49 [2015-12-25T14:59:36+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
10.97.151.49 [2015-12-25T14:59:36+00:00] ERROR: undefined method `closed?' for nil:NilClass
10.97.151.49 [2015-12-25T14:59:36+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Finally the stack trace at /var/chef/cache/chef-stacktrace.out
Generated at 2015-12-25 16:02:37 +0000
NoMethodError: undefined method `closed?' for nil:NilClass
/opt/chef/embedded/lib/ruby/2.1.0/net/http/response.rb:325:in `stream_check'
/opt/chef/embedded/lib/ruby/2.1.0/net/http/response.rb:199:in `read_body'
/opt/chef/embedded/lib/ruby/2.1.0/net/http/response.rb:226:in `body'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/formatters/error_inspectors/registration_error_inspector.rb:139:in `rescue in format_rest_error'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/formatters/error_inspectors/registration_error_inspector.rb:137:in `format_rest_error'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/formatters/error_inspectors/registration_error_inspector.rb:108:in `humanize_http_exception'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/formatters/error_inspectors/registration_error_inspector.rb:27:in `add_explanation'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/formatters/error_mapper.rb:32:in `registration_failed'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/formatters/base.rb:114:in `registration_failed'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/event_dispatch/dispatcher.rb:43:in `call'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/event_dispatch/dispatcher.rb:43:in `block in call_subscribers'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/event_dispatch/dispatcher.rb:34:in `each'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/event_dispatch/dispatcher.rb:34:in `call_subscribers'
(eval):2:in `registration_failed'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/client.rb:623:in `rescue in register'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/client.rb:603:in `register'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/client.rb:255:in `run'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/application.rb:261:in `block in fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/application.rb:249:in `fork'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/application.rb:249:in `fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/application.rb:215:in `block in run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/local_mode.rb:44:in `with_server_connectivity'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/application.rb:203:in `run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/application/client.rb:413:in `block in interval_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/application/client.rb:403:in `loop'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/application/client.rb:403:in `interval_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/application/client.rb:393:in `run_application'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/application.rb:58:in `run'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/bin/chef-client:26:in `<top (required)="">'
/usr/bin/chef-client:54:in `load'
/usr/bin/chef-client:54:in `<main>'
I finally figured out the issue.
I am behind a corporate proxy and the error I got "503: Service Unavailable" is not something coming from Chef Server, rather it is coming from the proxy server :(
Anyway, using "no_proxy" option and adding Chef Server's fqdn solved the issue.
Yes, this still does not answer the question how it works with chef client v11.x, but I am sure that this solved the issue :)
You probably have an old version of knife on your system. Run knife --version to confirm, you should see that it will be an older 11.x version. Track down where that copy is coming from (which knife or type -a knife) and remove it. This usually means uninstalling the gem from a pre-existing Ruby environment like RVM.

Unable to run unicorn app server on a vagrant box

I have a vagrant box on which RVM is already installed with ruby 2.0.0-p247. I have packaged the vagrant box and using that box as a base box.
Now I am trying to git clone a github private repo and start the unicorn app server, chef is errors out,here is the output of the error
==> default: stdin: is not a tty
==> default: /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find chef (>= 0) amongst [bundler-1.7.7, bundler-unload-1.0.2, executable-hooks-1.3.2, gem-wrappers-1.2.7, rubygems-bundler-1.4.4, rvm-1.11.3.9] (Gem::LoadError)
==> default: from /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
==> default: from /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in `gem'
==> default: from /usr/bin/chef-solo:22:in `<main>'
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
I am not able to debug the issue. Its ubuntu 14.04 box. Kindly help me out
Use the vagrant-omnibus plugin to install Chef. This will give Chef its own isolated Ruby environment separate from your RVM setup.

`vagrant plugin update` causing `nokogiri` complaint after updating vagrant to 1.6.2

Just updated to vagrant 1.6.2
Ran vagrant up and got the following error
Vagrant failed to initialize at a very early stage:
The plugins failed to load properly. The error message given is shown below.
undefined method `[]' for nil:NilClass
I ran vagrant up --debug and saw the following error message
ERROR vagrant: Vagrant experienced an error! Details:
ERROR vagrant: #<Vagrant::Errors::PluginLoadError: The plugins failed to load properly. The error message given is shown below.
undefined method `[]' for nil:NilClass>
ERROR vagrant: The plugins failed to load properly. The error message given is shown below.
undefined method `[]' for nil:NilClass
ERROR vagrant: /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.2/lib/vagrant.rb:265:in `rescue in <top (required)>'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.6.2/lib/vagrant.rb:261:in `<top (required)>'
/Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.2/bin/vagrant:101:in `require'
/Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.2/bin/vagrant:101:in `<main>'
Vagrant failed to initialize at a very early stage:
The plugins failed to load properly. The error message given is shown below.
undefined method `[]' for nil:NilClass
I then tried
vagrant plugin update
This produced the following complaint
Bundler, the underlying system Vagrant uses to install plugins, reported an error. The error is shown below. These errors are usually caused by misconfigured plugin installations or transient network issues. The error from Bundler is:
An error occurred while installing nokogiri (1.6.2.1), and Bundler cannot continue. Make sure that `gem install nokogiri -v '1.6.2.1'` succeeds before bundling.
So I ran
gem install nokogiri -v '1.6.2.1'
And this succeeded.
But it didn't solve the problem...
When I now run
vagrant plugin update
I still get the same error I got before installing nokogiri.
Bundler, the underlying system Vagrant uses to install plugins, reported an error. The error is shown below. These errors are usually caused by misconfigured plugin installations or transient network issues. The error from Bundler is:
An error occurred while installing nokogiri (1.6.2.1), and Bundler cannot continue. Make sure that `gem install nokogiri -v '1.6.2.1'` succeeds before bundling.
Anyone have a solution for this?
This is a Vagrant issue and is being tracked in https://github.com/mitchellh/vagrant/issues/3769.
Ok. I solved the problem for me at least.
I uninstalled vagrant 1.6.2 and installed vagrant 1.6.1

Chef does non sequential recipe execution

I followed tutorial http://gettingstartedwithchef.com/, chapter 1.
My run list is
"run_list": [ "recipe[apt]", "recipe[phpap]" ]
My default recipe of phpap cookbook
include_recipe "apache2"
include_recipe "build-essential"
include_recipe "openssl"
include_recipe "mysql::client"
include_recipe "mysql::server"
include_recipe "php"
include_recipe "php::module_mysql"
include_recipe "apache2::mod_php5"
include_recipe "mysql::ruby"
Dependencies of my cookbook
depends "apache2"
depends "mysql"
depends "php"
depends "database"
My repo has following downloaded cookbooks
apache2 aws database openssl phpap xml
apt build-essential mysql php postgresql xfs
I use chef-solo. My host has outdated apt repo info.
Old apt repo should not be a problem because the first recipe in my run list
updates it. But chef ignores apt recipe and starts from mysql one.
See log
dan#mywp3:~/chef-repo$ sudo chef-solo -c solo.rb -j web.json
Starting Chef Client, version 11.6.2
Compiling Cookbooks...
[2013-10-27T00:59:28+04:00] WARN: Cloning resource attributes for service[apache2] from prior resource (CHEF-3694)
[2013-10-27T00:59:28+04:00] WARN: Previous service[apache2]: /home/dan/chef-repo/cookbooks/apache2/recipes/default.rb:24:in `from_file'
[2013-10-27T00:59:28+04:00] WARN: Current service[apache2]: /home/dan/chef-repo/cookbooks/apache2/recipes/default.rb:210:in `from_file'
[2013-10-27T00:59:28+04:00] WARN: Cloning resource attributes for directory[/var/cache/local/preseeding] from prior resource (CHEF-3694)
[2013-10-27T00:59:28+04:00] WARN: Previous directory[/var/cache/local/preseeding]: /home/dan/chef-repo/cookbooks/apt/recipes/default.rb:76:in `block in from_file'
[2013-10-27T00:59:28+04:00] WARN: Current directory[/var/cache/local/preseeding]: /home/dan/chef-repo/cookbooks/mysql/recipes/server.rb:44:in `from_file'
[2013-10-27T00:59:28+04:00] WARN: Cloning resource attributes for directory[/var/lib/mysql] from prior resource (CHEF-3694)
[2013-10-27T00:59:28+04:00] WARN: Previous directory[/var/lib/mysql]: /home/dan/chef-repo/cookbooks/mysql/recipes/server.rb:117:in `block in from_file'
[2013-10-27T00:59:28+04:00] WARN: Current directory[/var/lib/mysql]: /home/dan/chef-repo/cookbooks/mysql/recipes/server.rb:117:in `block in from_file'
[2013-10-27T00:59:28+04:00] WARN: Cloning resource attributes for template[/etc/mysql/my.cnf] from prior resource (CHEF-3694)
[2013-10-27T00:59:28+04:00] WARN: Previous template[/etc/mysql/my.cnf]: /home/dan/chef-repo/cookbooks/mysql/recipes/server.rb:134:in `from_file'
[2013-10-27T00:59:28+04:00] WARN: Current template[/etc/mysql/my.cnf]: /home/dan/chef-repo/cookbooks/mysql/recipes/server.rb:194:in `from_file'
Recipe: mysql::client
* package[mysql-client] action install
================================================================================
Error executing action `install` on resource 'package[mysql-client]'
================================================================================
Chef::Exceptions::Exec
----------------------
apt-get -q -y install mysql-client=5.5.32-0ubuntu0.12.04.1 returned 100, expected 0
Cookbook Trace:
---------------
/home/dan/chef-repo/cookbooks/mysql/recipes/ruby.rb:44:in `block in from_file'
/home/dan/chef-repo/cookbooks/mysql/recipes/ruby.rb:43:in `each'
/home/dan/chef-repo/cookbooks/mysql/recipes/ruby.rb:43:in `from_file'
/home/dan/chef-repo/cookbooks/phpap/recipes/default.rb:20:in `from_file'
Resource Declaration:
---------------------
# In /home/dan/chef-repo/cookbooks/mysql/recipes/client.rb
46: package name
47: end
Compiled Resource:
------------------
# Declared in /home/dan/chef-repo/cookbooks/mysql/recipes/client.rb:46:in `block in from_file'
package("mysql-client") do
action :install
retries 0
retry_delay 2
package_name "mysql-client"
version "5.5.32-0ubuntu0.12.04.1"
cookbook_name :mysql
recipe_name "client"
end
================================================================================
Recipe Compile Error in /home/dan/chef-repo/cookbooks/phpap/recipes/default.rb
================================================================================
Chef::Exceptions::Exec
----------------------
package[mysql-client] (mysql::client line 46) had an error: Chef::Exceptions::Exec: apt-get -q -y install mysql-client=5.5.32-0ubuntu0.12.04.1 returned 100, expected 0
Cookbook Trace:
---------------
/home/dan/chef-repo/cookbooks/mysql/recipes/ruby.rb:44:in `block in from_file'
/home/dan/chef-repo/cookbooks/mysql/recipes/ruby.rb:43:in `each'
/home/dan/chef-repo/cookbooks/mysql/recipes/ruby.rb:43:in `from_file'
/home/dan/chef-repo/cookbooks/phpap/recipes/default.rb:20:in `from_file'
Relevant File Content:
----------------------
/home/dan/chef-repo/cookbooks/mysql/recipes/ruby.rb:
37: when 'rhel'
38: resources('yum_key[RPM-GPG-KEY-percona]').run_action(:add)
39: resources('yum_repository[percona]').run_action(:add)
40: end
41: end
42:
43: node['mysql']['client']['packages'].each do |name|
44>> resources("package[#{name}]").run_action(:install)
45: end
46:
47: chef_gem 'mysql'
48:
[2013-10-27T00:59:30+04:00] ERROR: Running exception handlers
[2013-10-27T00:59:30+04:00] ERROR: Exception handlers complete
[2013-10-27T00:59:30+04:00] FATAL: Stacktrace dumped to /home/dan/chef-solo/chef-stacktrace.out
Chef Client failed. 0 resources updated
[2013-10-27T00:59:30+04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
The host runs ubuntu 12.04.
I tried to put my own recipes before phpap in the run list but without any success.
I can workaround this with manual placing apt-get update in bash script right before chef-solo.
Is it mysql cookbook so bad? As far as I know chef ALWAYS follows run-list strait forward.
In general chef will always honor the run list. However sometimes you might want to run a resource before any others (like to configure a package manager, apt/yum/etc). What seems to be happening in the mysql ruby recipe is that the recipe is explicitly running some package installs at compile time (before chef has begun to execute resources). They fail as the apt recipe hasn't been run yet (none have).
There's a good opscode post explaining compile/execute phases here.
The offending code in mysql::ruby is
node['mysql']['client']['packages'].each do |name|
resources("package[#{name}]").run_action(:install)
end
The run_action(:install) is telling chef to run this now (at compile time).
I got phpap recipe without failure on bare ubuntu 12.04 (without any manual pre update) with following fix.
I removed recipes "build-essential" and "openssl" from phpap one.
After that change chef executes recipes as expected.
But weird behavior left unexplained.
vagrant destroy -f && vagrant up // destroy everything and start over => OK

vagrant-windows chef-solo provisioner fails with "failed to launch waiter thread:1455 (fatal)"

I'm having a problem with the vagrant-windows chef-solo provisioner failing with the error below.
The solo.rb and dna.json files are successfully written to c:/tmp/vagrant-chef-1 on the guest machine and when I manually run the powershell script sent to windows from vagrant, chef executes as expected.
Any ideas on what could be going on or how I can go about troubleshooting this?
_
Host: Mac OSX 10.8.4
Guest: Windows Server 2012
Provider: VirtualBox 4.2.14
Here's the error I'm getting...
[default] Running provisioner: VagrantPlugins::Chef::Provisioner::ChefSolo...
Generating chef JSON and uploading...
Running chef-solo...
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/run_lock.rb:58:in `flock': failed to launch waiter thread:1455 (fatal)
from C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/run_lock.rb:58:in `acquire'
from C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/client.rb:446:in `do_run'
from C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/client.rb:200:in `run'
from C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/application.rb:190:in `run_chef_client'
from C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/application/solo.rb:239:in `block in run_application'
from C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/application/solo.rb:231:in `loop'
from C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/application/solo.rb:231:in `run_application'
from C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/application.rb:73:in `run'
from C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/bin/chef-solo:25:in `<top (required)>'
from C:/opscode/chef/bin/chef-solo:23:in `load'
from C:/opscode/chef/bin/chef-solo:23:in `<main>'
ERROR warden: Error occurred: Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
ERROR warden: Error occurred: Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
ERROR warden: Error occurred: Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
ERROR vagrant: Vagrant experienced an error! Details:
ERROR vagrant: #<VagrantPlugins::Chef::Provisioner::Base::ChefError: Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.>
ERROR vagrant: Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
ERROR vagrant: /Users/David/.vagrant.d/gems/gems/vagrant-windows-1.0.3/lib/vagrant-windows/monkey_patches/chef_solo.rb:51:in `run_chef_solo_on_windows'
/Users/David/.vagrant.d/gems/gems/vagrant-windows-1.0.3/lib/vagrant-windows/monkey_patches/chef_solo.rb:12:in `block in <class:ChefSolo>'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.1.5/plugins/provisioners/chef/provisioner/chef_solo.rb:53:in `provision'
This is likely a bug in Vagrant or Vagrant Windows. I would recommended opening an issue on GitHub.

Resources