On start, PID folder is not checked
General
Escalation
General
Escalation
Description
Environment
Debian 9.4 amd64
package installed using the official apt repository
Smart Checklist
Activity
Show:
Jericho Rivera February 19, 2019 at 8:07 AM
I can't reproduce this with latest PXC 5.7.24 on Debian 9 fresh install.
root@moral-porpoise:~# systemctl status mysql
● mysql.service - LSB: Start and stop the mysql (Percona XtraDB Cluster) daemon
Loaded: loaded (/etc/init.d/mysql; generated; vendor preset: enabled)
Active: active (running) since Tue 2019-02-19 07:44:04 UTC; 21min ago
Docs: man:systemd-sysv-generator(8)
Tasks: 41 (limit: 4915)
CGroup: /system.slice/mysql.service
├─5206 /bin/sh /usr/bin/mysqld_safe
└─5567 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --wsrep-provider=/usr/lib/galera3/libgalera_smm.so --log-error=/var/log/mysqld.log --pid-file=/var/run/mys
Feb 19 07:44:02 moral-porpoise systemd[1]: mysql.service: Failed to reset devices.list: Operation not permitted
Feb 19 07:44:02 moral-porpoise systemd[1]: mysql.service: Failed to set invocation ID on control group /system.slice/mysql.service, ignoring: Operation not permitted
Feb 19 07:44:02 moral-porpoise systemd[1]: Starting LSB: Start and stop the mysql (Percona XtraDB Cluster) daemon...
Feb 19 07:44:04 moral-porpoise mysql[5162]: Starting MySQL (Percona XtraDB Cluster) database server: mysqld ..
Feb 19 07:44:04 moral-porpoise systemd[1]: Started LSB: Start and stop the mysql (Percona XtraDB Cluster) daemon.
Feb 19 07:53:18 moral-porpoise systemd[1]: mysql.service: Failed to reset devices.list: Operation not permitted
Feb 19 07:53:18 moral-porpoise systemd[1]: mysql.service: Failed to set invocation ID on control group /system.slice/mysql.service, ignoring: Operation not permitted
root@moral-porpoise:~# mysql -uroot -p -e "select @@pid_file,@@version,@@version_comment\G"
Enter password:
*************************** 1. row ***************************
@@pid_file: /var/run/mysqld/mysqld.pid
@@version: 5.7.24-26-57-log
@@version_comment: Percona XtraDB Cluster (GPL), Release rel26, Revision 65db531, WSREP version 31.33, wsrep_31.33
G R October 16, 2018 at 10:27 AM
Forgot to add : once modified this way, the server managed to start correctly again.
Cannot Reproduce
Details
Details
Details
Smart Checklist
Open Smart Checklist
Smart Checklist
Open Smart Checklist
Smart Checklist

Open Smart Checklist
Created October 16, 2018 at 10:21 AM
Updated March 6, 2024 at 10:24 PM
Resolved February 19, 2019 at 8:08 AM
Server in cluster failed to restart with following error :
2018-10-16T07:54:43.059008Z 0 [ERROR] /usr/sbin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 2 - No such file or di$
2018-10-16T07:54:43.059019Z 0 [ERROR] Can't start server: can't create PID file: No such file or directory
Turns out the directory (
/var/run/mysqld
) doesn't exist. It did at some point, because the server managed to start before, maybe a system maintenance task deleted it ? That's out of scope anyway.The problem is : the existence of the directory is not checked beforehand, so PXC does a full SST before exiting on this error, causing network usage and a large "startup" time before exiting.
The fact the folder exists could be checked at the beggining of the init script, where the following line is :
(in /etc/init.d/mysql)
pid_file=$(mysqld_get_param pid-file)
The fix I used was to replace this line by the following block :
pid_file=$(mysqld_get_param pid-file)
pid_dir=$(dirname $pid_file)
if [ ! -e $pid_dir ]; then
mkdir $pid_dir;
chown mysql:mysql $pid_dir;
fi
Of course, additionnal error management could be added in case mkdir or chown fail.