Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mariadb don't start, selinux context problem #228

Open
rnt opened this issue Dec 18, 2018 · 2 comments
Open

mariadb don't start, selinux context problem #228

rnt opened this issue Dec 18, 2018 · 2 comments
Labels
Bug Something isn't working hacktoberfest An issue highlighted for the digital ocean Hacktoberfest Event
Projects

Comments

@rnt
Copy link

rnt commented Dec 18, 2018

Cookbook version

1.5.4

Chef-client version

14.8.12

Platform Details

CentOS Linux release 7.6.1810 (Core)
Running on azure

Scenario:

Start mariadb service

Steps to Reproduce:

On CentOS 7.6 with SELINUX=enforcing, running the recipe mariadb::server.

Expected Result:

Mariadb start

Actual Result:

Mariadb fail to start.

    Error executing action `restart` on resource 'service[mysql]'
    ================================================================================
    
    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '1'
    ---- Begin output of /bin/systemctl --system restart mariadb ----
    STDOUT: 
    STDERR: Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details.
    ---- End output of /bin/systemctl --system restart mariadb ----
    Ran /bin/systemctl --system restart mariadb returned 1
    
    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cache/cookbooks/mariadb/recipes/server.rb
    
    129: service 'mysql' do
    130:   service_name node['mariadb']['mysqld']['service_name']
    131:   supports restart: true, reload: true
    132:   action [:start, :enable]
    133: end
    134: 
    
    Compiled Resource:
    ------------------
    # Declared in /var/chef/cache/cache/cookbooks/mariadb/recipes/server.rb:129:in `from_file'
    
    service("mysql") do
      action [:enable, :restart]
      default_guard_interpreter :default
      service_name "mariadb"
      enabled true
      running false
      masked false
      pattern "mysql"
      declared_type :service
      cookbook_name "mariadb"
      recipe_name "server"
      supports {:restart=>true, :reload=>true}
    end
    
    System Info:
    ------------
    chef_version=14.8.12
    platform=centos
    platform_version=7.6.1810
    ruby=ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
    program_name=chef-client worker: ppid=11236;start=12:09:19;
    executable=/opt/chef/bin/chef-client

On .err log, we see:

181218 12:15:19 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
181218 12:15:19 [Note] /usr/libexec/mysqld (mysqld 5.5.60-MariaDB) starting as process 32445 ...
181218 12:15:19 [ERROR] mysqld: File '/var/log/mysql/mariadb-bin.index' not found (Errcode: 13)
181218 12:15:19 [ERROR] Aborting

181218 12:15:19 [Note] /usr/libexec/mysqld: Shutdown complete

The file /var/log/mysql/mariadb-bin.index exists, but with no the correct selinux context.

Running restorecon -vR /var/log/mysql the output was:

restorecon reset /var/log/mysql/mariadb-bin.index context system_u:object_r:var_log_t:s0->system_u:object_r:mysqld_log_t:s0
restorecon reset /var/log/mysql/mariadb-bin.000001 context system_u:object_r:var_log_t:s0->system_u:object_r:mysqld_log_t:s0
restorecon reset /var/log/mysql/mariadb-bin.000002 context system_u:object_r:var_log_t:s0->system_u:object_r:mysqld_log_t:s0
restorecon reset /var/log/mysql/mariadb-bin.000003 context system_u:object_r:var_log_t:s0->system_u:object_r:mysqld_log_t:s0
restorecon reset /var/log/mysql/mariadb-bin.000004 context system_u:object_r:var_log_t:s0->system_u:object_r:mysqld_log_t:s0
restorecon reset /var/log/mysql/mariadb-bin.000005 context system_u:object_r:var_log_t:s0->system_u:object_r:mysqld_log_t:s0
restorecon reset /var/log/mysql/mariadb-bin.000006 context system_u:object_r:var_log_t:s0->system_u:object_r:mysqld_log_t:s0

And then, mariadb start without problems.

@sinfomicien
Copy link
Contributor

@rnt: Any chance you could submit a PR ? It would be awesome 🥇

@damacus damacus added this to Need Triage in Project H-N May 11, 2019
@github-actions
Copy link

Marking stale due to inactivity. Remove stale label or comment or this will be closed in 7 days. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.

@github-actions github-actions bot added the Stale label Sep 30, 2020
@xorimabot xorimabot removed the Stale label Sep 30, 2020
@ramereth ramereth added Bug Something isn't working hacktoberfest An issue highlighted for the digital ocean Hacktoberfest Event labels Oct 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working hacktoberfest An issue highlighted for the digital ocean Hacktoberfest Event
Projects
Project H-N
  
Need Triage
Development

No branches or pull requests

4 participants