On 07/22/14 at 01:59pm, WANG Chao wrote:
On 07/21/14 at 02:06pm, Vivek Goyal wrote:
> On Fri, Jul 18, 2014 at 04:14:01PM +0800, WANG Chao wrote:
> > Now upon failure kdump script might not be called at all and it might
> > not be able to execute default action. It results in a hang.
> >
> > Because we disable emergency shell and rely on kdump.sh being invoked
> > through dracut-pre-pivot hook. But it might happen that we never call
> > into dracut-pre-pivot hook because certain systemd targets could not
> > reach due to failure in their dependencies. In those cases error
> > handling code does not run and system hangs.
> >
> > To solve this problem, we need to separate the error handling code from
> > dracut-pre-pivot hook, and every time when a failure shows up, the
> > separated code can be called by the emergency service.
> >
> > By default systemd provides an emergency service which will drop us into
> > shell every time upon a critical failure. It's very convenient for us to
> > re-use the framework of systemd emergency, because we don't have to
> > touch the other parts of systemd. We can use our own script instead of
> > the default one.
> >
> > This new scheme will overwrite emergency shell and replace with kdump
> > error handling code. And this code will do the error handling as needed.
> > Now, we will not rely on dracut-pre-pivot hook running always. Instead
> > whenever error happens and it is serious enough that emergency shell
> > needed to run, now kdump error handler will run.
> >
> > Signed-off-by: WANG Chao <chaowang(a)redhat.com>
> > ---
> > dracut-kdump-emergency.service | 23 +++++++++++++++++++++++
> > dracut-kdump-error-handler.sh | 10 ++++++++++
> > dracut-module-setup.sh | 3 +++
> > kexec-tools.spec | 5 ++++-
> > 4 files changed, 40 insertions(+), 1 deletion(-)
> > create mode 100644 dracut-kdump-emergency.service
> > create mode 100755 dracut-kdump-error-handler.sh
> >
> > diff --git a/dracut-kdump-emergency.service b/dracut-kdump-emergency.service
> > new file mode 100644
> > index 0000000..6c90420
> > --- /dev/null
> > +++ b/dracut-kdump-emergency.service
> > @@ -0,0 +1,23 @@
> > +[Unit]
> > +Description=Kdump Error Handler
> > +DefaultDependencies=no
> > +After=systemd-vconsole-setup.service
> > +Wants=systemd-vconsole-setup.service
> > +
> > +[Service]
> > +Environment=HOME=/
> > +Environment=DRACUT_SYSTEMD=1
> > +Environment=NEWROOT=/sysroot
> > +WorkingDirectory=/
> > +ExecStart=/bin/kdump-error-handler.sh
> > +ExecStopPost=-/usr/bin/systemctl --fail --no-block default
> > +Type=oneshot
> > +StandardInput=tty-force
> > +StandardOutput=inherit
> > +StandardError=inherit
> > +KillMode=process
> > +IgnoreSIGPIPE=no
>
> Hi Chao,
>
> I am thinking more about the licence of this file. We have practically
> taken this file from emergency.service of dracut. And in dracut tree
> that file has following header.
>
> # This file is part of systemd.
> #
> # systemd is free software; you can redistribute it and/or modify it
> # under the terms of the GNU Lesser General Public License as published
> # by
> # the Free Software Foundation; either version 2.1 of the License, or
> # (at your option) any later version.
>
> # See systemd.special(7) for details
And I'll also remove this line. Since this is really not our case.