xforty/vagrant-drupal — Issue #11: MySQL doesn't seem to be loaded in time for a provision
Author: pearcec
Created: 2012-02-15 13:47:56+00:00
State: open
Labels: Bug, Known Issue

When I `vagrant halt`, then run `vagrant up` after initial deployment, I get this. The work around is to run `vagrant provision`. Seems MySQL isn't running quite yet.

```output
[Wed, 15 Feb 2012 14:45:19 +0100] INFO: execute[mysql-install-privileges] sh(/usr/bin/mysql -u root -p"root" < /etc/mysql/mysql_grants.sql)
[Wed, 15 Feb 2012 14:45:19 +0100] ERROR: execute[mysql-install-privileges] (mysql::server line 129) has had an error
[Wed, 15 Feb 2012 14:45:19 +0100] ERROR: template[/etc/mysql/mysql_grants.sql] (/tmp/vagrant-chef-1/chef-solo-1/cookbooks/mysql/recipes/server.rb:120:in `from_file') had an error:
execute[mysql-install-privileges] (mysql::server line 129) had an error: Chef::Exceptions::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /usr/bin/mysql -u root -p"root" < /etc/mysql/mysql_grants.sql ----
STDOUT:
STDERR: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
---- End output of /usr/bin/mysql -u root -p"root" < /etc/mysql/mysql_grants.sql ----
Ran /usr/bin/mysql -u root -p"root" < /etc/mysql/mysql_grants.sql returned 1
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/shell_out.rb:206:in `invalid!'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/shell_out.rb:192:in `error!'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/mixin/shell_out.rb:36:in `shell_out!'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/provider/execute.rb:58:in `action_run'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/resource.rb:440:in `send'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/resource.rb:440:in `run_action'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/runner.rb:45:in `run_action'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/runner.rb:53:in `run_action'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/runner.rb:51:in `each'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/runner.rb:51:in `run_action'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/runner.rb:81:in `converge'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/runner.rb:81:in `each'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/runner.rb:81:in `converge'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/resource_collection.rb:94:in `execute_each_resource'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/resource_collection.rb:92:in `execute_each_resource'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/runner.rb:76:in `converge'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/client.rb:312:in `converge'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/client.rb:160:in `run'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/application/solo.rb:192:in `run_application'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/application/solo.rb:183:in `loop'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/application/solo.rb:183:in `run_application'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/../lib/chef/application.rb:67:in `run'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/chef-solo:25
/opt/ruby/bin/chef-solo:19:in `load'
/opt/ruby/bin/chef-solo:19
[Wed, 15 Feb 2012 14:45:19 +0100] ERROR: Running exception handlers
[Wed, 15 Feb 2012 14:45:19 +0100] ERROR: Exception handlers complete
[Wed, 15 Feb 2012 14:45:19 +0100] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out
[Wed, 15 Feb 2012 14:45:19 +0100] FATAL: Chef::Exceptions::ShellCommandFailed: execute[mysql-install-privileges] (mysql::server line 129) had an error: Chef::Exceptions::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /usr/bin/mysql -u root -p"root" < /etc/mysql/mysql_grants.sql ----
STDOUT:
STDERR: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
---- End output of /usr/bin/mysql -u root -p"root" < /etc/mysql/mysql_grants.sql ----
Ran /usr/bin/mysql -u root -p"root" < /etc/mysql/mysql_grants.sql returned 1
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
```