[debian-mysql] /etc/init.d/mysql stop leaves a process but exits with 0 status

Antoine Beaupré anarcat at debian.org
Wed Jul 30 22:13:42 UTC 2014

found 609537 5.5.38-0+wheezy1

I have found this bug happening even on wheezy, on a server that doesn't
exit immediately after a mysladmin shutdown.

I find that the expectation of the shutdown procedure of Debian's
initscript is a little unreasonable: it issues a shutdown command, and
if it succeeds, doesn't wait at all before checking if the server is
actually down, then fails if the server hasn't shutdown immediately.

It seems to me it should simply wait a little while. In a production
server we run (internal issue #14187), I have found that waiting even
one second completely fixes this problems and allows me again to sleep
through the morning log rotation (!).

Please consider applying this patch to the stable release:

diff --git a/init.d/mysql b/init.d/mysql
index 983a8c2..1efd332 100755
--- a/init.d/mysql
+++ b/init.d/mysql
@@ -150,13 +150,18 @@ case "${1:-''}" in

-        if ! mysqld_status check_dead warn; then
-         log_end_msg 1
-         log_failure_msg "Please stop MySQL manually and read /usr/share/doc/mysql-server-5.5/README.Debian.gz!"
-         exit -1
-       else
-         log_end_msg 0
-        fi
+        # give it a little time to stop at least
+        for i in 1 2 3 4 5 6 7 8 9 10; do
+          if mysqld_status check_dead warn; then
+           log_end_msg 0
+            exit 0
+          fi
+         log_progress_msg "."
+          sleep 1
+        done
+       log_end_msg 1
+       log_failure_msg "MySQL failed to stop even though mysqladmin shutdown succeeded, please stop MySQL manually"
+       exit -1


Also note that telling people to RTFM is pretty much useless in this
situation, as (1) the warning doesn't actually show up on the terminal
and (2) the README doesn't actually address this situation (ie. my
"debian.cnf" file works).

I would be happy to NMU this patch into sid and shepherd it into the
next wheezy update.

Thanks for your feedback,


PS: is it possible this bug was simply forgotten after the squeeze
release? i see there was no update since 2012 to the bug yet there are
now two patches waiting for review. can we get some action here?

"Faith" means not wanting to know what is true.
                         - Friedrich Nietzshe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-mysql-maint/attachments/20140730/352d369d/attachment-0001.sig>

More information about the pkg-mysql-maint mailing list