[MDEV-11841] mysqld_safe_helper: Can't create/write to file '/var/log/mysqld.log' Created: 2017-01-19  Updated: 2017-01-19  Resolved: 2017-01-19

Status: Closed
Project: MariaDB Server
Component/s: Scripts & Clients, Server
Affects Version/s: 10.0.29
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: George L Assignee: Sergei Golubchik
Resolution: Not a Bug Votes: 0
Labels: need_feedback
Environment:
  • centos 6.8 64bit


 Description   

Latest MariaDB 10.0.29 Yum install via mariadb official yum repo for CentOS 6.8 64bit is giving folks issues when log-error is set in /etc/my.cnf. MariaDB 10.0.28 and below didn't have such issues.

[mysqld_safe] 
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mysqld.log
#nice = -5
open-files-limit = 8192

sestatus
SELinux status:                 disabled

Shutting down MySQL.. SUCCESS! 
Starting MySQL.170119 12:03:11 mysqld_safe Logging to '/var/log/mysqld.log'.
170119 12:03:11 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/bin/mysqld_safe_helper: Can't create/write to file '/var/log/mysqld.log' (Errcode: 13 "Permission denied")
 ERROR! 
service mysql stop
 ERROR! MySQL server PID file could not be found!
service mysql start
Starting MySQL.170119 12:03:13 mysqld_safe Logging to '/var/log/mysqld.log'.
170119 12:03:13 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/bin/mysqld_safe_helper: Can't create/write to file '/var/log/mysqld.log' (Errcode: 13 "Permission denied")
 ERROR! 

rpm -qa | grep MariaDB
MariaDB-compat-10.0.29-1.el6.x86_64
MariaDB-devel-10.0.29-1.el6.x86_64
MariaDB-common-10.0.29-1.el6.x86_64
MariaDB-server-10.0.29-1.el6.x86_64
MariaDB-shared-10.0.29-1.el6.x86_64
MariaDB-client-10.0.29-1.el6.x86_64



 Comments   
Comment by George L [ 2017-01-19 ]

seems affects MariaDB 10.1.21 on CentOS 6.8 64bit but CentOS 7.3 64bit seems fine

Starting MySQL.170119 13:00:03 mysqld_safe Logging to '/var/log/mysqld.log'.
170119 13:00:04 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/bin/mysqld_safe_helper: Can't create/write to file '/var/log/mysqld.log' (Errcode: 13 "Permission denied")
 ERROR! 
 ERROR! Failed to restart server.

rpm -qa | grep MariaDB
MariaDB-compat-10.1.21-1.el6.x86_64
MariaDB-common-10.1.21-1.el6.x86_64
MariaDB-server-10.1.21-1.el6.x86_64
MariaDB-shared-10.1.21-1.el6.x86_64
MariaDB-client-10.1.21-1.el6.x86_64
MariaDB-devel-10.1.21-1.el6.x86_64

Comment by Sergei Golubchik [ 2017-01-19 ]

What are permissions and the ownership of your /var/log/mysqld.log? I suspect it's only user-writable, owned by root.
MariaDB log files must be owned by mysql user (or, at least, writable by mysql user), otherwise the server won't be able to write to them.

It kind of used to work before, because mysqld_safe was doing chown for you, but arbitrarily chown-ing files is dangerous, there was a bunch of security issues recently related to that (see https://mariadb.com/kb/en/mariadb-10029-release-notes/). Now you need to make sure that mysqld is able to access all files you want it to access.

Comment by George L [ 2017-01-19 ]

yeah before /var/log/mysqld.log would have mysql:root user/group but now the file /var/log/mysqld.log doesn't exist at all as mariadb server can't create it anymore

Comment by Sergei Golubchik [ 2017-01-19 ]

Exactly. So, you need to create this file with correct ownership and privileges.
If you use some log rotating tool, it usually can do that too.

Comment by George L [ 2017-01-19 ]

Thanks Sergei

Generated at Thu Feb 08 07:53:04 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.