Bug 1063499

Summary: mariadb fails to start due to permissions issue on /var/log/mariadb/mariadb.log
Product: [Fedora] Fedora Reporter: Lars Kellogg-Stedman <lars>
Component: mariadbAssignee: Honza Horak <hhorak>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: aortega, derekh, hhorak, jdornak, yeylon
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1063466 Environment:
Last Closed: 2014-02-11 09:47:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1063466    
Bug Blocks:    

Description Lars Kellogg-Stedman 2014-02-10 21:14:52 UTC
+++ This bug was initially created as a clone of Bug #1063466 +++

Description of problem:

Using openstack-packstack-2013.2.1-0.29.dev956.fc20.noarch:

When trying to install RDO on Fedora 20 via "packstack --allinone", the install fails with:

  ERROR : Error appeared during Puppet run: 172.16.0.4_mysql.pp
  Error: Could not start Service[mysqld]: Execution of '/sbin/service mariadb start' returned 1: 
  You will find full trace in log /var/tmp/packstack/20140210-191647-DfRatq/manifests/172.16.0.4_mysql.pp.log
  Please check log file /var/tmp/packstack/20140210-191647-DfRatq/openstack-setup.log for more information
  Version-Release number of selected component (if applicable):

/var/tmp/packstack/20140210-191647-DfRatq/manifests/172.16.0.4_mysql.pp.log has:

  Error: Could not start Service[mysqld]: Execution of '/sbin/service mariadb start' returned 1: 
  Error: /Stage[main]/Mysql::Server/Service[mysqld]/ensure: change from stopped to running failed: Could not start Service[mysqld]: Execution of '/sbin/service mariadb start' returned 1: 
  Error: Could not start Service[mysqld]: Execution of '/sbin/service mariadb start' returned 1: 
  Error: /Stage[main]/Mysql::Server/Service[mysqld]/ensure: change from stopped to running failed: Could not start Service[mysqld]: Execution of '/sbin/service mariadb start' returned 1: 

And the journal shows:

  # journalctl -u mariadb --full --no-pager -n10
  -- Logs begin at Mon 2014-02-10 18:51:02 UTC, end at Mon 2014-02-10 19:23:09 UTC. --
  Feb 10 19:18:17 lars-f20-0 mysqld_safe[11501]: 140210 19:18:17 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
  Feb 10 19:18:17 lars-f20-0 mysqld_safe[11501]: 140210 19:18:17 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
  Feb 10 19:18:17 lars-f20-0 mysqld_safe[11501]: /usr/bin/mysqld_safe: line 138: /var/log/mariadb/mariadb.log: Permission denied
  Feb 10 19:18:17 lars-f20-0 mysqld_safe[11501]: /usr/bin/mysqld_safe: line 182: /var/log/mariadb/mariadb.log: Permission denied
  Feb 10 19:18:17 lars-f20-0 mysqld_safe[11501]: 140210 19:18:17 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
  Feb 10 19:18:17 lars-f20-0 mysqld_safe[11501]: /usr/bin/mysqld_safe: line 138: /var/log/mariadb/mariadb.log: Permission denied
  Feb 10 19:18:17 lars-f20-0 systemd[1]: mariadb.service: main process exited, code=exited, status=1/FAILURE

This is because the log file is owned by root:

  # ls -ld /var/log/mariadb/
  drwxr-x---. 2 mysql mysql 4096 Feb 10 19:18 /var/log/mariadb/
  # ls -l /var/log/mariadb/mariadb.log 
  -rw-r--r--. 1 root root 0 Feb 10 19:18 /var/log/mariadb/mariadb.log

Fixing the permissions on that file allows mariadb to start up
correctly.

  # chown mysql:mysql /var/log/mariadb/mariadb.log
  # service mariadb start
  # service mariadb status
  Redirecting to /bin/systemctl status  mariadb.service
  mariadb.service - MariaDB database server
     Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled)
     Active: active (running) since Mon 2014-02-10 19:26:53 UTC; 41s ago

--- Additional comment from Lars Kellogg-Stedman on 2014-02-10 14:35:22 EST ---

Hmm, this may actually be an selinux issue:

# audit2allow -a
#============= mysqld_safe_t ==============
allow mysqld_safe_t var_log_t:lnk_file { read getattr };

Comment 1 Lars Kellogg-Stedman 2014-02-10 21:16:10 UTC
This turns out to be a mariadb packaging issue.  After installation, /var/log/mariadb/mariadb.log exists but is owned by root, and /var/log/mysqld.log does not exist.

Comment 2 Lars Kellogg-Stedman 2014-02-10 21:28:55 UTC
*** Bug 1063466 has been marked as a duplicate of this bug. ***

Comment 3 Honza Horak 2014-02-11 09:47:39 UTC
Thanks for reporting, the fix is on the way already, feel free to test and provide karma to mark it stable sooner:
https://admin.fedoraproject.org/updates/FEDORA-2014-2137/mariadb-5.5.35-2.fc19

*** This bug has been marked as a duplicate of bug 1061045 ***