I have debugged the problem to root cause.  In the postinst script it
calls:

        invoke-rc.d mysql start || exit $?

Running this manually:

  # service mysql start
  Starting MySQL database server: mysqld ..
  # echo $?
  1

Tracing the script, it's a bash script, yields:

  bash -x /etc/init.d/mysql start
  ...
  + log_end_msg_post 0
  + :
  + return 0
  ++ /etc/mysql/debian-start
  + output=
  + '[' -n '' ']'

Which corresponds to this section of the init.d script.

            if mysqld_status check_alive warn; then
                log_end_msg 0
                # Now start mysqlcheck or whatever the admin wants.
                output=$(/etc/mysql/debian-start)
                [ -n "$output" ] && log_action_msg "$output"
            else

Which then falls off the bottom of the script.  Since the exit code of
the last command run is non-zero (the [ -n "$output" ] has no output)
it causes the exit code of the script to be non-zero too.

This is a deja-bug as I have debugged this before:

  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=739846

Unfortunately I failed to realize that the exit 0 was a local change I
had put in to fix this problem previously.  Making it a confusing bug
report.  And unfortunately having fixed the problem for myself I
didn't follow up on it.  My bad.

But the problem is exactly the same.  The script needs to exit 0 at
the end.  At all points when there is an error it exits non-zero.
That is all okay.  But that means that when the script exits normally
it should definitely exit 0.  Note that the previous versions of the
/etc/init.d/skeleton script included a ":" at the end to clear the
exit code and basically do the same thing.

The simplest fix is to add an "exit 0" at the bottom of the script.

Bob

Attachment: signature.asc
Description: Digital signature

Reply via email to