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

mysql service start hangs on Ubuntu #452

Closed g-boros closed 7 years ago

g-boros commented 8 years ago

Cookbook version

8.0.1

Chef-client version

12.12.15

Platform Details

Vagrant with ubuntu/trusty64

Scenario:

Creating a new MySQL instance fails with the install hanging at service start

Steps to Reproduce:

My cookbook:

Chef::Log.info('Update package repository')

apt_update 'apt update'  do
  action :update
  only_if { platform_family?('debian') }
end

Chef::Log.info('Installing MySQL')

mysql_service 'rangerdb' do
  action [:create, :start]
  port '3306'
  initial_root_password 'whatever'
end

Vagrantfile:

  config.vm.box = "ubuntu/trusty64"
  config.vm.provider "virtualbox" do |vb|
    vb.memory = "1024"
  end

  config.vm.provision "file", source: "~/.chef", destination: "~/"
  config.vm.provision "chef_client" do |chef|
    chef.chef_server_url = "https://api.chef.io/organizations/xx"
    chef.validation_key_path = "~/.chef/xx-validator.pem"
    chef.validation_client_name = "~/.chef/xx-validator.pem"
    chef.add_recipe "mysql_test"
    chef.validation_client_name = "xx-validator"
  end

Expected Result:

Install completes without errors

Actual Result:

==> default: * bash[rangerdb initial records] action run
==> default:
==> default:         [execute] Installing MySQL system tables...
==> default:                   Could not open required defaults file: /etc/mysql-rangerdb/my.cnf
==> default:                   Fatal error in defaults handling. Program aborted
==> default:
==> default:                   Installation of system tables failed!  Examine the logs in
==> default:                   /var/lib/mysql-rangerdb for more information.
==> default:
==> default:                   You can try to start the mysqld daemon with:
==> default:
==> default:
==> default:     shell> /usr/sbin/mysqld --skip-grant &
==> default:

...

==> default:         +
==> default:         +kill timeout 300
==> default:         +
==> default:         +pre-start script
==> default:         +[ -d /run/mysql-rangerdb ] || install -m 755 -o mysql -g mysql -d /run/mysql-rangerdb
==> default:         +[ -d /run/mysql-rangerdb ] || install -m 755 -o mysql -g mysql -d /run/mysql-rangerdb
==> default:         +end script
==> default:         +
==> default:         +exec /usr/sbin/mysqld --defaults-file=/etc/mysql-rangerdb/my.cnf
==> default:         +
==> default:         +post-start script
==> default:         +/usr/sbin/mysql-rangerdb-wait-ready
==> default:         +end script
==> default: [2016-08-11T16:46:28+00:00] INFO: template[/etc/init/mysql-rangerdb.conf] owner changed to 0
==> default: [2016-08-11T16:46:28+00:00] INFO: template[/etc/init/mysql-rangerdb.conf] group changed to 0
==> default: [2016-08-11T16:46:28+00:00] INFO: template[/etc/init/mysql-rangerdb.conf] mode changed to 644
==> default:
==> default: - change mode from '' to '0644'
==> default:
==> default: - change owner from '' to 'root'
==> default:
==> default: - change group from '' to 'root'
==> default:
==> default:
==> default:
==> default: * service[mysql-rangerdb] action start

bash[rangerdb initial records] fails but does not block the cookbook and then MySQL service start hangs because of the uninitialized database.

error.log is empty

/var/log/kern/log:

Aug 11 16:46:23 vagrant-ubuntu-trusty-64 kernel: [   79.525800] type=1400 audit(1470933983.824:16): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql-rangerdb/my.cnf" pid=5475 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=109
tas50 commented 7 years ago

Closing this out since it was fixed

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.