[debian-mysql] Bug#739846: Bug#739846: invoke-rc.d: initscript mysql, action "start" failed.
Bob Proulx
bob at proulx.com
Tue Jun 30 08:35:42 UTC 2015
Hi James,
James Page wrote:
> On 23/02/14 05:51, Bob Proulx wrote:
> > Diff'ing the newest /etc/init.d/mysql against the previous one
> > shows this important difference:
> >
> > @@ -186,4 +186,3 @@ ;; esac
> >
> > -exit 0
> >
> > The exit 0 at the end of the script was dropped. This causes the
> > script to exit with the exit code of the last command run which is
> > usually non-zero. In the case that the script exits non-zero then
> > the upgrade fails to configure the new package.
>
> I can't see this change in the debdiff between -1 and -2 as in AFAICT
> the init script has never had an exit 0 at the end. Is it possible
> this was a local change?
You are right. It was a local change I had made previously for this
same problem. I had previously debugged that the /etc/init.d/mysql
script would exit non-zero by mistake on a normal exit and added that
to the bottom of my copy of the script.
I had also modified /etc/mysql/debian-start (hey it is a conffile
after all) to avoid printing this message:
echo "Checking for tables which need an upgrade, are corrupt or were "
echo "not closed cleanly."
I had commented that out. It is an unfortunate message IMNHO. It
runs those in the background asynchronously and therefore I don't see
the need to inform the caller. Plus it is a scary reading message and
scares people. Therefore I tried silencing it. Because of that
change the start script exits non-zero.
# Now start mysqlcheck or whatever the admin wants.
output=$(/etc/mysql/debian-start)
[ -n "$output" ] && log_action_msg "$output"
If /etc/mysql/debian-start outputs something, anything, then the test
for -n "$output" is true and then log_action_msg logs it and also
returns 0. But if /etc/mysql/debian-start emits nothing then output
is empty and -n "" is non-zero. At that point things fall through to
the bottom of the script and exits with the last exit code which means
the script exits non-zero as well. Because the action exits non-zero
the postinst script fails and dpkg --configure fails.
Would it be possible to put an exit 0 at the bottom of the script? It
would be good programming. I think it is definitely unintended to
exit non-zero when /etc/mysql/debian-start doesn't print anything.
Note that the /etc/init.d/skeleton previously included a ":" at the
bottom to essentially do the same thing in a different way. I think
ending with a ":" to be more obscure than the more explicit exit 0 and
therefore prefer the latter. But either would be the same. All of
the error handling in the script explicitly exits with a non-zero
error upon detecting an error.
Thanks,
Bob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-mysql-maint/attachments/20150630/118bac55/attachment.sig>
More information about the pkg-mysql-maint
mailing list