5.5.54 fails to start on Debian due refusal to create /var/run/mysqld

Bug #1661123 reported by mig5
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Fix Released
Critical
EvgeniyPatlan
5.5
Fix Released
Undecided
EvgeniyPatlan

Bug Description

Hi,

In 5.5.53-rel38.5-1, there is a portion of /usr/bin/mysqld_safe that looks like this:

---
safe_mysql_unix_port=${mysql_unix_port:-${MYSQL_UNIX_PORT:-/var/run/mysqld/mysqld.sock}}
# Make sure that directory for $safe_mysql_unix_port exists
mysql_unix_port_dir=`dirname $safe_mysql_unix_port`
if [ ! -d $mysql_unix_port_dir ]
then
  if [ ! -h $mysql_unix_port_dir ]; then
    mkdir $mysql_unix_port_dir
    chown $user $mysql_unix_port_dir
    chmod 755 $mysql_unix_port_dir
  fi
fi
---

In 5.5.54-rel38.6-1, that part of the script now looks like this:

---
# Check that directory for $safe_mysql_unix_port exists
mysql_unix_port_dir=`dirname $safe_mysql_unix_port`
if [ ! -d $mysql_unix_port_dir ]
then
  log_error "Directory '$mysql_unix_port_dir' for UNIX socket file don't exists."
  exit 1
fi
---

It no longer tries to create /var/run/mysqld (in my case). This is a bit of a crisis, as it prevents MySQL from starting.

Even worse, since apparently MySQL waits forever (at least on Debian Wheezy) to try and start on boot, a reboot of the machine will make it fail to boot. I had to reboot into recovery mode and fix the script. For some reason my Jessie machines finished booting and I resolved by mkdir /var/run/mysqld && chown mysql /var/run/mysqld by hand.

And as a minor note, 'don't exists' isn't good English. It should be 'doesn't exist'.

Revision history for this message
EvgeniyPatlan (evgeniy-patlan) wrote :

Hi.
Thanks for your report, but I wasn't able to reproduce this issue. I have checked on wheezy, jessie, xenial, yakkety
Could you please provide a bit more extended STR and may be logs from installation step.
These logs might shed some light on the situation as the needed directory should be created during package post-installation actions.

Changed in percona-server:
status: New → Incomplete
assignee: nobody → EvgeniyPatlan (evgeniy-patlan)
Revision history for this message
Oleg Motienko (motienko) wrote :

Same issue for me.
Ubuntu 16.04

percona-server-server-5.5
5.5.54-rel38.6-1.xenial
amd64

After installing of deb package it works, but after rebooting the Ubuntu it doesn't start.

Changed in percona-server:
status: Incomplete → New
Revision history for this message
Oleg Motienko (motienko) wrote :
no longer affects: ubuntu
Revision history for this message
SWick (swick) wrote :

same issue here with Trusty. After Upgrade AND a reboot Percona doesn't start anymore.
I looked at the Init Script from 5.7 and used this part as a workaround:

--- /tmp/mysql 2017-02-01 23:06:34.270319050 +0100
+++ /etc/init.d/mysql 2017-02-01 23:06:59.449692853 +0100

case "${1:-''}" in
    'start')
    sanity_checks;
    # Start daemon
    log_daemon_msg "Starting MySQL (Percona Server) database server" "mysqld"

    if mysqld_status check_alive nowarn; then

       log_progress_msg "already running"
       log_end_msg 0

    else

+ MYSQLRUN=/var/run/mysqld
+
+ if [ ! -d "${MYSQLRUN}" -a ! -L "${MYSQLRUN}" ];
+ then
+ mkdir ${MYSQLRUN}
+ chown mysql:mysql ${MYSQLRUN}
+ chmod 755 ${MYSQLRUN}
+ fi

Changed in percona-server:
status: New → In Progress
importance: Undecided → Critical
Revision history for this message
mig5 (mig5) wrote :

@EvgeniyPatlan the issue is that on most distros, /var/run (which is often a symlink to /run) is mounted as tmpfs.

So it doesn't matter of your post-install script makes the /var/run/mysqld - that dir is volatile and does not persist across reboots, and hence why the issue only occurs on fresh boot up/reboot.

I would suggest to look at how other scripts do it - most handle it in the init script like mysqld_safe did, and I believe systemd might have other methods available, but you probably have to support both since Debian Wheezy uses initd by default.

See http://askubuntu.com/questions/303120/how-folders-created-in-var-run-on-each-reboot

Revision history for this message
Hrvoje Matijakovic (hrvojem) wrote :

New packages have been pushed to repositories with incremented package version (5.5.54-rel38.6-2 for deb and 5.5.54-rel38.6.2 for rpm) to address this.

Changed in percona-server:
status: In Progress → Fix Released
Revision history for this message
SWick (swick) wrote :

fix works fine. thank you

Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-399

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.