How to fix "vagrant up" error "uninitialized constant VagrantPlugins::HostDarwin::Cap::Version" - vagrant

When doing vagrant up I get this error:
==> default: Exporting NFS shared folders...
Traceback (most recent call last):
106: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/batch_action.rb:86:in `block (2 levels) in run'
105: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/machine.rb:201:in `action'
.....
/opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/plugins/hosts/darwin/cap/path.rb:20:in `resolve_host_path': uninitialized constant VagrantPlugins::HostDarwin::Cap::Version (NameError)
I updated Vagrant and VirtualBox. How can I fix this?

The solution is to run this command:
sudo curl -o /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/plugins/hosts/darwin/cap/path.rb https://raw.githubusercontent.com/hashicorp/vagrant/42db2569e32a69e604634462b633bb14ca20709a/plugins/hosts/darwin/cap/path.rb
This command was found here.

I also had the same error:
uninitialized constant VagrantPlugins::HostDarwin::Cap::Version (NameError)
Downgrading Vagrant from 2.2.19 to 2.2.18 fixed it for me.

Fixed vagrant 2.2.19 with this patch contributed to https://github.com/hashicorp/vagrant/issues/12583:
+ $ diff -u /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/plugins/hosts/darwin/cap/path.rb.backup-20220104 path.rb
--- /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/plugins/hosts/darwin/cap/path.rb.backup-20220104 2022-01-04 12:35:09.000000000 +0100
+++ path.rb 2022-01-04 12:35:21.000000000 +0100
## -17,7 +17,8 ##
def self.resolve_host_path(env, path)
path = File.expand_path(path)
# Only expand firmlink paths on Catalina
- return path if !CATALINA_CONSTRAINT.satisfied_by?(Cap::Version.version(env))
+ host_version = env.host.capability(:version)
+ return path if !CATALINA_CONSTRAINT.satisfied_by?(host_version)
firmlink = firmlink_map.detect do |mount_path, data_path|
path.start_with?(mount_path)

Related

Puppet module upgrade fails - permission denied # rb_file_s_rename

In my modules directory I have some modules from Puppet Forge, among others e.g. puppetlabs/stdlib.
I tried the module upgrade with the following command:
puppet module --modulepath . upgrade puppetlabs-stdlib --ignore-changes.
But I received the following error message:
Error: Permission denied # rb_file_s_rename - (/home/pk/.puppet/cache/puppet-module/cache/tmp20220620-5150-1b9vqt0/puppetlabs-stdlib-5.2.0, /home/pk/.puppet/cache/puppet-module/cache/puppetlabs-stdlib20220620-5150-1be31tk)
What could be the reason for the error and how can I fix it?
Detailed: Commands and terminal output
$ puppet module --modulepath . upgrade puppetlabs-stdlib
/usr/lib/ruby/vendor_ruby/puppet/util.rb:50: warning: Insecure world writable dir /mnt/c in PATH, mode 040777
Notice: Preparing to upgrade 'puppetlabs-stdlib' ...
Notice: Found 'puppetlabs-stdlib' (v5.1.0) in /mnt/c/Users/pk/Puppet_Project/modules ...
Error: Could not upgrade module 'puppetlabs-stdlib' (v5.1.0 -> latest)
Installed module has had changes made locally
Use `puppet module upgrade --ignore-changes` to upgrade this module anyway
Why changes should have been made in the module puppetlabs-stdlib is not clear to me, maybe a converted line end or a changed encoding, the change should be discarded in any case.
$ puppet module --modulepath . upgrade puppetlabs-stdlib --ignore-changes
/usr/lib/ruby/vendor_ruby/puppet/util.rb:50: warning: Insecure world writable dir /mnt/c in PATH, mode 040777
Notice: Preparing to upgrade 'puppetlabs-stdlib' ...
Notice: Found 'puppetlabs-stdlib' (v5.1.0) in /mnt/c/Users/pk/Puppet_Project/modules ...
Notice: Downloading from https://forgeapi.puppet.com ...
Error: Permission denied # rb_file_s_rename - (/home/pk/.puppet/cache/puppet-module/cache/tmp20220620-5150-1b9vqt0/puppetlabs-stdlib-5.2.0, /home/pk/.puppet/cache/puppet-module/cache/puppetlabs-stdlib20220620-5150-1be31tk)
/usr/lib/ruby/2.5.0/fileutils.rb:471:in `rename'
/usr/lib/ruby/2.5.0/fileutils.rb:471:in `block in mv'
/usr/lib/ruby/2.5.0/fileutils.rb:1463:in `block in fu_each_src_dest'
/usr/lib/ruby/2.5.0/fileutils.rb:1479:in `fu_each_src_dest0'
/usr/lib/ruby/2.5.0/fileutils.rb:1461:in `fu_each_src_dest'
/usr/lib/ruby/2.5.0/fileutils.rb:460:in `mv'
/usr/lib/ruby/vendor_ruby/puppet/module_tool/applications/unpacker.rb:86:in `move_into'
/usr/lib/ruby/vendor_ruby/puppet/module_tool/applications/unpacker.rb:13:in `unpack'
/usr/lib/ruby/vendor_ruby/puppet/forge.rb:210:in `unpack'
/usr/lib/ruby/vendor_ruby/puppet/forge.rb:174:in `prepare'
/usr/lib/ruby/vendor_ruby/puppet/module_tool/applications/upgrader.rb:189:in `block in run'
/usr/lib/ruby/vendor_ruby/puppet/module_tool/applications/upgrader.rb:189:in `each'
/usr/lib/ruby/vendor_ruby/puppet/module_tool/applications/upgrader.rb:189:in `run'
/usr/lib/ruby/vendor_ruby/puppet/face/module/upgrade.rb:73:in `block (3 levels) in <top (required)>'
/usr/lib/ruby/vendor_ruby/puppet/interface/action.rb+eval[wrapper]:264:in `upgrade'
/usr/lib/ruby/vendor_ruby/puppet/application/face_base.rb:247:in `main'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:383:in `run_command'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:375:in `block in run'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:665:in `exit_on_fail'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:375:in `run'
/usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:137:in `run'
/usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:73:in `execute'
/usr/bin/puppet:5:in `<main>'
$ ll ~/.puppet/cache/puppet-module/cache/
total 0
drwxr-xr-x 1 pk pk 4096 Jun 20 12:24 ./
drwxr-xr-x 1 pk pk 4096 Jun 20 12:24 ../
You see, I am working with WSL on Windows.
I think that warning: Insecure world writable dir /mnt/c in PATH, mode 040777 should not cause the error Permission denied # rb_file_s_rename. Looking at the cache folder, my user has write permissions, how the permissions of the chache files are set I don't know exactly unfortunately.
Not all upgrades fail
I also upgraded the derdanne/nfs package in the same way, without any problems.
$ puppet module --modulepath . upgrade derdanne-nfs --ignore-changes
/usr/lib/ruby/vendor_ruby/puppet/util.rb:50: warning: Insecure world writable dir /mnt/c in PATH, mode 040777
Notice: Preparing to upgrade 'derdanne-nfs' ...
Notice: Found 'derdanne-nfs' (v2.1.2) in /mnt/c/Users/pk/Puppet_Project/modules ...
Notice: Downloading from https://forgeapi.puppet.com ...
Notice: Upgrading -- do not interrupt ...
/mnt/c/Users/pk/Puppet_Project/modules
└── derdanne-nfs (v2.1.2 -> v2.1.8)
The message "Installed module has had changes made locally" suggests that at some point a file or directory in the module structure has been changed by a local user, if that local user wasn't the owner of the home directory or the change was done by someone who was root or sudo then you're going to get these permissions problems.
I doubt checking "~/.puppet/cache/puppet-module/cache/" will help, your problem is likely to be buried way down under /mnt/c/Users/pk/Puppet_Project/modules/stdlib and there are a lot of files under there.
I would try the following;
Copy /mnt/c/Users/pk/Puppet_Project/modules/stdlib to some backup location as it's probably not possible to figure out what's been changed on this module and you may need to refer back to it.
Delete the module from the system, rm -rf /mnt/c/Users/pk/Puppet_Project/modules/stdlib.
Reinstall the original version to get you back to a reasonable state puppet module --modulepath . install puppetlabs-stdlib --version 5.1.0.
Then run your upgrade command puppet module --modulepath . upgrade puppetlabs-stdlib.
But it's worth being really careful about this, the current version of stdlib is 8.2.0 and a lot of modules haven't caught up with this version yet. If you go to that version you're likely to find other modules with a dependency of stdlib below version 8 so I'd probably run puppet module --modulepath . upgrade puppetlabs-stdlib --ignore-changes --version 7.1.0 as most modules on the forge have a version that'll be fine with version 7.

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

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.

chef client failed to read machine metadata

I have a few servers installed with chef.
one of them started to fail when running
sudo chef-client -j /etc/chef/first-boot.json
ONLY on one of the machines
when debugging, the error is
Re-raising exception: NoMethodError - undefined method `[]' for nil:NilClass
The trace is
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/data_collector/messages/helpers.rb:133:in `read_node_uuid'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/data_collector/messages/helpers.rb:111:in `node_uuid'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/data_collector/messages.rb:40:in `run_start_message'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/data_collector.rb:130:in `block in run_started'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/data_collector.rb:307:in `disable_reporter_on_error'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/data_collector.rb:128:in `run_started'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/event_dispatch/dispatcher.rb:43:in `call'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/event_dispatch/dispatcher.rb:43:in `block in call_subscribers'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/event_dispatch/dispatcher.rb:34:in `each'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/event_dispatch/dispatcher.rb:34:in `call_subscribers'
The line is
metadata["node_uuid"]
The metadata is coming by reading data_collector_metadata.json file
def metadata
Chef::JSONCompat.parse(Chef::FileCache.load(metadata_filename))
rescue Chef::Exceptions::FileNotFound
{}
end
I'm struggling with this ... why is this working on some servers and on this it does not
Found out what was the issue.
The difference was the chef-client version
the Startup script reinstalls chef with the latest version.
Using this bash
curl -L "https://www.opscode.com/chef/install.sh" | bash
I've modified to a version specific bash
curl -LO https://omnitruck.chef.io/install.sh && sudo bash ./install.sh -v 12.15.19 && rm install.sh
And it worked

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