Skip to content

Instantly share code, notes, and snippets.

@lvnilesh
Created November 8, 2012 15:03
Show Gist options
  • Save lvnilesh/4039324 to your computer and use it in GitHub Desktop.
Save lvnilesh/4039324 to your computer and use it in GitHub Desktop.
mysql cookbook fails : Chef::Exceptions::Exec: apt-get -q -y install mysql-client=5.5.24-0ubuntu0.12.04.1 returned 100, expected 0
I created a folder for vagrant, edited Vagrantfile, created a cookbooks folder and
git clone https://github.com/opscode-cookbooks/mysql.git
git clone https://github.com/opscode-cookbooks/build-essential.git
git clone https://github.com/opscode-cookbooks/openssl.git
and then vagrant up but chef failed.
[2012-11-08T14:52:50+00:00] INFO: *** Chef 10.14.2 ***
[2012-11-08T14:52:50+00:00] INFO: Setting the run_list to ["recipe[build-essential]", "recipe[openssl]", "recipe[mysql]", "recipe[mysql::client]", "recipe[mysql::server]"] from JSON
[2012-11-08T14:52:50+00:00] INFO: Run List is [recipe[build-essential], recipe[openssl], recipe[mysql], recipe[mysql::client], recipe[mysql::server]]
[2012-11-08T14:52:50+00:00] INFO: Run List expands to [build-essential, openssl, mysql, mysql::client, mysql::server]
[2012-11-08T14:52:50+00:00] INFO: Starting Chef Run for precise64
[2012-11-08T14:52:50+00:00] INFO: Running start handlers
[2012-11-08T14:52:50+00:00] INFO: Start handlers complete.
[2012-11-08T14:52:50+00:00] INFO: Could not find previously defined grants.sql resource
[2012-11-08T14:52:50+00:00] INFO: Processing package[build-essential] action install (build-essential::default line 51)
[2012-11-08T14:52:59+00:00] INFO: Processing package[binutils-doc] action install (build-essential::default line 51)
[2012-11-08T14:53:01+00:00] INFO: Processing package[autoconf] action install (build-essential::default line 58)
[2012-11-08T14:53:04+00:00] INFO: Processing package[flex] action install (build-essential::default line 58)
[2012-11-08T14:53:06+00:00] INFO: Processing package[bison] action install (build-essential::default line 58)
[2012-11-08T14:53:08+00:00] INFO: Processing package[mysql-client] action install (mysql::client line 46)
================================================================================
Error executing action `install` on resource 'package[mysql-client]'
================================================================================
Chef::Exceptions::Exec
----------------------
apt-get -q -y install mysql-client=5.5.24-0ubuntu0.12.04.1 returned 100, expected 0
Resource Declaration:
---------------------
# In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/mysql/recipes/client.rb
45: node['mysql']['client']['packages'].each do |mysql_pack|
46: package mysql_pack do
47: action :install
48: end
49: end
Compiled Resource:
------------------
# Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/mysql/recipes/client.rb:46:in `from_file'
package("mysql-client") do
retry_delay 2
retries 0
recipe_name "client"
action [:install]
cookbook_name :mysql
package_name "mysql-client"
end
[2012-11-08T14:53:09+00:00] ERROR: Running exception handlers
[2012-11-08T14:53:09+00:00] ERROR: Exception handlers complete
[2012-11-08T14:53:09+00:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out
[2012-11-08T14:53:09+00:00] FATAL: 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.24-0ubuntu0.12.04.1 returned 100, expected 0
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
@bhagany
Copy link

bhagany commented Jul 2, 2014

I've spent a long time on this problem, and I finally found some relevant discussions. I'm going to link to them here because this gist seems to rank pretty highly for whatever I searched:

chef-boneyard/build-essential#32
sous-chefs/apt#75
https://tickets.opscode.com/browse/COOK-4534

The basic thing that's happening here is that build-essential (usually - it could be another cookbook) is running at chef compile time, before chef gets around to actually executing the run_list. They've added an option to the apt cookbook to fix this, apparently.

In my case, I wasn't aware that an attributes file in an unrelated cookbook (an old version of the elasticsearch cookbook) was setting build-essential's compile_time attribute to true. Removing that fixed this problem for me, because build-essential would no longer run at compile time, and therefore apt would have a chance to run and update its cache (it's first in my run_list).

I hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment