sous-chefs / mysql

Development repository for the mysql cookbook
https://supermarket.chef.io/cookbooks/mysql
Apache License 2.0
338 stars 690 forks source link

fix mysql service hang on Ubuntu #453

Closed g-boros closed 8 years ago

g-boros commented 8 years ago

Description

Change the execution order of AppArmor config creation and MySQL database initialization. By default the cookbook tries to initialize the database but AppArmor will prevent this because it's configuration is not yet updated with the instance details. The cookbook does not fail at this point but moves forward in the execution and hangs at service start.

Moving the AppArmor configuration first will create the configuration to allow mysqld to access it's config file and the initialization can succeed.

Issues Resolved

https://github.com/chef-cookbooks/mysql/issues/452

Works only if the following PRs are merged: https://github.com/chef-cookbooks/mysql/pull/451 https://github.com/chef-cookbooks/mysql/pull/450

Check List

greneholt commented 8 years ago

Is there a reason this has not been merged yet? I had to create my own fork of this cookbook and merge these PRs, since the published one is utterly broken on Ubuntu right now.

klyonrad commented 8 years ago

@greneholt on which Ubuntu did you get that running? I tried your fork on 14 and 16 with a fairly minimal example and had no luck

JohGiz commented 8 years ago

I have this morning tried to get this going. And I just did a fork and tried the change in order of configure_apparmor and initialize_database and I still get the apparmor="DENIED".

WesleyE commented 8 years ago

@tas50 What do we need to get this merged? I can put in some work if that is necessary. I would love to remove my own fork and use the main repo again.

g-boros commented 8 years ago

@JohGiz: did you also merge https://github.com/chef-cookbooks/mysql/pull/451? It is also needed, otherwise the apparmor config will be incomplete

JohGiz commented 8 years ago

Yes @g-boros but the cause has to do with that code. Checked the content of /etc/apparmor.d/local/mysql/#{instance} and it misses the _mysqname in that file of some reason. Trying to figure out why that variable is not applied to the .erb template.

UPDATE: See now that the variable change is not updated from my fork so the mysql_name is not there at all as a variable.

Yes, it was my mistake. The changes was not applied from #451 After making sure it was updated in the right place it started up. So then it works! :+1:

greneholt commented 8 years ago

@klyonrad I ran it on Ubuntu 14.04, but I also had "package_name: ''" in my recipe calls to prevent the package version mismatch error.

klyonrad commented 8 years ago

I ran it on Ubuntu 14.04, but I also had "package_name: ''" in my recipe calls to prevent the package version mismatch error.

Ah right, I can confirm that this worked. After that the mysql2_chef_gem install process failed. But that is another issue. Thanks for the answer :)

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.