Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 516232 - dev-db/mysql-init-scripts-2.0_pre1-r7 - fails if chroot enabled; pidfile and socket path calculated incorrectly.
Summary: dev-db/mysql-init-scripts-2.0_pre1-r7 - fails if chroot enabled; pidfile and ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux MySQL bugs team
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2014-07-03 20:59 UTC by Hank Leininger
Modified: 2014-08-21 13:55 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
patch /etc/init.d/mysql to correctly handle DBs with chroot= set in /etc/mysql/my.cnf (mysql_init.d_chroot_socket.patch,557 bytes, patch)
2014-07-03 21:00 UTC, Hank Leininger
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hank Leininger 2014-07-03 20:59:12 UTC
/etc/init.d/mysql cannot start mysqld if chroot= is enabled in my.cnf

This is because the init script reads the pidfile= and socket= out of the [mysqld] section of mysqld.conf, but those paths will be relative to chroot top if chroot is defined:
<pre>
[mysqld]
chroot                                          = /var/chroot/mysql/
...
socket                                          = /var/run/mysqld/mysqld.sock
pid-file                                        = /var/run/mysqld/mysqld.pid
log-error                                       = /var/log/mysql/mysqld.err
</pre>

In this case the actual files are /var/chroot/mysql/var/run/mysqld/mysqld.pid and /var/chroot/mysql/var/run/mysqld/mysqld.sock, but init.d/mysql doesn't figure that out.  During "start", the ewaitfile on "${socket}" fails, and during "stop", the real pidfile isn't consulted so mysqld is left still running.

The fix is simple, check if chroot= is defined in the [mysqld] section, and if so prepend that to the expected pidfile and socket paths.  Will attach a diff.

Reproducible: Always
Comment 1 Hank Leininger 2014-07-03 21:00:04 UTC
Created attachment 380136 [details, diff]
patch /etc/init.d/mysql to correctly handle DBs with chroot= set in /etc/mysql/my.cnf
Comment 2 Brian Evans (RETIRED) gentoo-dev 2014-08-06 03:49:38 UTC
Shouldn't the datadir variable also be included? 
This way the script will correctly check for the ${chroot}/${datadir}/mysql directory.

I may be wrong in interpreting this.
Comment 3 Brian Evans (RETIRED) gentoo-dev 2014-08-21 13:55:00 UTC
Committed with mysql-init-scripts-2.0