All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Change the implementation of action_on_fail
@ 2013-07-22 11:32 Baoquan He
       [not found] ` <8a7ac3492f63fd2a5fa7ee57d9b9e7c8c2dd305c.1374492675.git.bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 15+ messages in thread
From: Baoquan He @ 2013-07-22 11:32 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Baoquan He

Currently when action_on_fail is enabled, the emergency_shell won't be called
either. In kdump even though user specify the default action as emergency_shell,
dracut still skip it. Now change the implementation of action_on_fail to depend
on a file which is created by kdump when making kdump initrd, then remove it
at the beginning of kdump. This can solve the explicit emergency_shell problem.

And action_on_fail won't need paramenters, remove the relevant description in
dracut man page.

Signed-off-by: Baoquan He <bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 dracut.cmdline.7.asc                         |    4 ---
 modules.d/98systemd/dracut-emergency.service |    2 +-
 modules.d/98systemd/emergency.service        |    2 +-
 modules.d/99base/dracut-lib.sh               |   28 +++++++++----------------
 4 files changed, 12 insertions(+), 24 deletions(-)

diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
index cf11d50..09c47e8 100644
--- a/dracut.cmdline.7.asc
+++ b/dracut.cmdline.7.asc
@@ -121,10 +121,6 @@ Misc
    specify the controlling terminal for the console.
    This is useful, if you have multiple "console=" arguments.
 
-**rd.action_on_fail=**_{shell|continue}_::
-   Specify the action after failure. By default it's emergency_shell.
-   'continue' means: ignore the current failure and go ahead.
-
 [[dracutkerneldebug]]
 Debug
 ~~~~~
diff --git a/modules.d/98systemd/dracut-emergency.service b/modules.d/98systemd/dracut-emergency.service
index a4b81bc..25db825 100644
--- a/modules.d/98systemd/dracut-emergency.service
+++ b/modules.d/98systemd/dracut-emergency.service
@@ -13,7 +13,7 @@ DefaultDependencies=no
 After=systemd-vconsole-setup.service
 Wants=systemd-vconsole-setup.service
 Conflicts=emergency.service emergency.target
-ConditionKernelCommandLine=!action_on_fail=continue
+ConditionPathExists=!/kdumpscripts/kdump-action.conf
 
 [Service]
 Environment=HOME=/
diff --git a/modules.d/98systemd/emergency.service b/modules.d/98systemd/emergency.service
index c19fe37..6eddbde 100644
--- a/modules.d/98systemd/emergency.service
+++ b/modules.d/98systemd/emergency.service
@@ -12,7 +12,7 @@ Description=Emergency Shell
 DefaultDependencies=no
 After=systemd-vconsole-setup.service
 Wants=systemd-vconsole-setup.service
-ConditionKernelCommandLine=!action_on_fail=continue
+ConditionPathExists=!/kdumpscripts/kdump-action.conf
 
 [Service]
 Environment=HOME=/
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 8eeebf3..18e3f32 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -1003,24 +1003,16 @@ emergency_shell()
 
 action_on_fail()
 {
-    local _action=$(getarg rd.action_on_fail= -d action_on_fail=)
-    case "$_action" in
-        continue)
-            [ "$1" = "-n" ] && shift 2
-            [ "$1" = "--shutdown" ] && shift 2
-            warn "$*"
-            warn "Not dropping to emergency shell, because 'action_on_fail=continue' was set on the kernel command line."
-            return 0
-            ;;
-        shell)
-            emergency_shell $@
-            return 1
-            ;;
-        *)
-            emergency_shell $@
-            return 1
-            ;;
-    esac
+    if [ -f "/kdumpscripts/kdump-action.conf" ]; then
+        [ "$1" = "-n" ] && shift 2
+        [ "$1" = "--shutdown" ] && shift 2
+        warn "$*"
+        warn "Not dropping to emergency shell, because 'action_on_fail=continue' was set on the kernel command line."
+        return 0
+    fi
+
+    emergency_shell $@
+    return 1
 }
 
 # Retain the values of these variables but ensure that they are unexported
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH] Change the implementation of action_on_fail
       [not found] ` <8a7ac3492f63fd2a5fa7ee57d9b9e7c8c2dd305c.1374492675.git.bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2013-07-23  9:53   ` Baoquan
  2013-07-23 10:14   ` Baoquan
  1 sibling, 0 replies; 15+ messages in thread
From: Baoquan @ 2013-07-23  9:53 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA

NACK it self.


On 07/22/2013 07:32 PM, Baoquan He wrote:
> Currently when action_on_fail is enabled, the emergency_shell won't be called
> either. In kdump even though user specify the default action as emergency_shell,
> dracut still skip it. Now change the implementation of action_on_fail to depend
> on a file which is created by kdump when making kdump initrd, then remove it
> at the beginning of kdump. This can solve the explicit emergency_shell problem.
> 
> And action_on_fail won't need paramenters, remove the relevant description in
> dracut man page.
> 
> Signed-off-by: Baoquan He <bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  dracut.cmdline.7.asc                         |    4 ---
>  modules.d/98systemd/dracut-emergency.service |    2 +-
>  modules.d/98systemd/emergency.service        |    2 +-
>  modules.d/99base/dracut-lib.sh               |   28 +++++++++----------------
>  4 files changed, 12 insertions(+), 24 deletions(-)
> 
> diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
> index cf11d50..09c47e8 100644
> --- a/dracut.cmdline.7.asc
> +++ b/dracut.cmdline.7.asc
> @@ -121,10 +121,6 @@ Misc
>     specify the controlling terminal for the console.
>     This is useful, if you have multiple "console=" arguments.
>  
> -**rd.action_on_fail=**_{shell|continue}_::
> -   Specify the action after failure. By default it's emergency_shell.
> -   'continue' means: ignore the current failure and go ahead.
> -
>  [[dracutkerneldebug]]
>  Debug
>  ~~~~~
> diff --git a/modules.d/98systemd/dracut-emergency.service b/modules.d/98systemd/dracut-emergency.service
> index a4b81bc..25db825 100644
> --- a/modules.d/98systemd/dracut-emergency.service
> +++ b/modules.d/98systemd/dracut-emergency.service
> @@ -13,7 +13,7 @@ DefaultDependencies=no
>  After=systemd-vconsole-setup.service
>  Wants=systemd-vconsole-setup.service
>  Conflicts=emergency.service emergency.target
> -ConditionKernelCommandLine=!action_on_fail=continue
> +ConditionPathExists=!/kdumpscripts/kdump-action.conf
>  
>  [Service]
>  Environment=HOME=/
> diff --git a/modules.d/98systemd/emergency.service b/modules.d/98systemd/emergency.service
> index c19fe37..6eddbde 100644
> --- a/modules.d/98systemd/emergency.service
> +++ b/modules.d/98systemd/emergency.service
> @@ -12,7 +12,7 @@ Description=Emergency Shell
>  DefaultDependencies=no
>  After=systemd-vconsole-setup.service
>  Wants=systemd-vconsole-setup.service
> -ConditionKernelCommandLine=!action_on_fail=continue
> +ConditionPathExists=!/kdumpscripts/kdump-action.conf
>  
>  [Service]
>  Environment=HOME=/
> diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
> index 8eeebf3..18e3f32 100755
> --- a/modules.d/99base/dracut-lib.sh
> +++ b/modules.d/99base/dracut-lib.sh
> @@ -1003,24 +1003,16 @@ emergency_shell()
>  
>  action_on_fail()
>  {
> -    local _action=$(getarg rd.action_on_fail= -d action_on_fail=)
> -    case "$_action" in
> -        continue)
> -            [ "$1" = "-n" ] && shift 2
> -            [ "$1" = "--shutdown" ] && shift 2
> -            warn "$*"
> -            warn "Not dropping to emergency shell, because 'action_on_fail=continue' was set on the kernel command line."
> -            return 0
> -            ;;
> -        shell)
> -            emergency_shell $@
> -            return 1
> -            ;;
> -        *)
> -            emergency_shell $@
> -            return 1
> -            ;;
> -    esac
> +    if [ -f "/kdumpscripts/kdump-action.conf" ]; then
> +        [ "$1" = "-n" ] && shift 2
> +        [ "$1" = "--shutdown" ] && shift 2
> +        warn "$*"
> +        warn "Not dropping to emergency shell, because 'action_on_fail=continue' was set on the kernel command line."
> +        return 0
> +    fi
> +
> +    emergency_shell $@
> +    return 1
>  }
>  
>  # Retain the values of these variables but ensure that they are unexported
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Change the implementation of action_on_fail
       [not found] ` <8a7ac3492f63fd2a5fa7ee57d9b9e7c8c2dd305c.1374492675.git.bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2013-07-23  9:53   ` Baoquan
@ 2013-07-23 10:14   ` Baoquan
  1 sibling, 0 replies; 15+ messages in thread
From: Baoquan @ 2013-07-23 10:14 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA

Nack it self, will repost.

On 07/22/2013 07:32 PM, Baoquan He wrote:
> Currently when action_on_fail is enabled, the emergency_shell won't be called
> either. In kdump even though user specify the default action as emergency_shell,
> dracut still skip it. Now change the implementation of action_on_fail to depend
> on a file which is created by kdump when making kdump initrd, then remove it
> at the beginning of kdump. This can solve the explicit emergency_shell problem.
> 
> And action_on_fail won't need paramenters, remove the relevant description in
> dracut man page.
> 
> Signed-off-by: Baoquan He <bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  dracut.cmdline.7.asc                         |    4 ---
>  modules.d/98systemd/dracut-emergency.service |    2 +-
>  modules.d/98systemd/emergency.service        |    2 +-
>  modules.d/99base/dracut-lib.sh               |   28 +++++++++----------------
>  4 files changed, 12 insertions(+), 24 deletions(-)
> 
> diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
> index cf11d50..09c47e8 100644
> --- a/dracut.cmdline.7.asc
> +++ b/dracut.cmdline.7.asc
> @@ -121,10 +121,6 @@ Misc
>     specify the controlling terminal for the console.
>     This is useful, if you have multiple "console=" arguments.
>  
> -**rd.action_on_fail=**_{shell|continue}_::
> -   Specify the action after failure. By default it's emergency_shell.
> -   'continue' means: ignore the current failure and go ahead.
> -
>  [[dracutkerneldebug]]
>  Debug
>  ~~~~~
> diff --git a/modules.d/98systemd/dracut-emergency.service b/modules.d/98systemd/dracut-emergency.service
> index a4b81bc..25db825 100644
> --- a/modules.d/98systemd/dracut-emergency.service
> +++ b/modules.d/98systemd/dracut-emergency.service
> @@ -13,7 +13,7 @@ DefaultDependencies=no
>  After=systemd-vconsole-setup.service
>  Wants=systemd-vconsole-setup.service
>  Conflicts=emergency.service emergency.target
> -ConditionKernelCommandLine=!action_on_fail=continue
> +ConditionPathExists=!/kdumpscripts/kdump-action.conf
>  
>  [Service]
>  Environment=HOME=/
> diff --git a/modules.d/98systemd/emergency.service b/modules.d/98systemd/emergency.service
> index c19fe37..6eddbde 100644
> --- a/modules.d/98systemd/emergency.service
> +++ b/modules.d/98systemd/emergency.service
> @@ -12,7 +12,7 @@ Description=Emergency Shell
>  DefaultDependencies=no
>  After=systemd-vconsole-setup.service
>  Wants=systemd-vconsole-setup.service
> -ConditionKernelCommandLine=!action_on_fail=continue
> +ConditionPathExists=!/kdumpscripts/kdump-action.conf
>  
>  [Service]
>  Environment=HOME=/
> diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
> index 8eeebf3..18e3f32 100755
> --- a/modules.d/99base/dracut-lib.sh
> +++ b/modules.d/99base/dracut-lib.sh
> @@ -1003,24 +1003,16 @@ emergency_shell()
>  
>  action_on_fail()
>  {
> -    local _action=$(getarg rd.action_on_fail= -d action_on_fail=)
> -    case "$_action" in
> -        continue)
> -            [ "$1" = "-n" ] && shift 2
> -            [ "$1" = "--shutdown" ] && shift 2
> -            warn "$*"
> -            warn "Not dropping to emergency shell, because 'action_on_fail=continue' was set on the kernel command line."
> -            return 0
> -            ;;
> -        shell)
> -            emergency_shell $@
> -            return 1
> -            ;;
> -        *)
> -            emergency_shell $@
> -            return 1
> -            ;;
> -    esac
> +    if [ -f "/kdumpscripts/kdump-action.conf" ]; then
> +        [ "$1" = "-n" ] && shift 2
> +        [ "$1" = "--shutdown" ] && shift 2
> +        warn "$*"
> +        warn "Not dropping to emergency shell, because 'action_on_fail=continue' was set on the kernel command line."
> +        return 0
> +    fi
> +
> +    emergency_shell $@
> +    return 1
>  }
>  
>  # Retain the values of these variables but ensure that they are unexported
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Change the implementation of action_on_fail
       [not found]                         ` <20130801142445.GB8230-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
  2013-08-01 14:54                           ` Vivek Goyal
@ 2013-08-01 14:54                           ` WANG Chao
  1 sibling, 0 replies; 15+ messages in thread
From: WANG Chao @ 2013-08-01 14:54 UTC (permalink / raw)
  To: Baoquan He; +Cc: Harald Hoyer, Vivek Goyal, initramfs-u79uwXL29TY76Z2rM5mHXA

On 08/01/13 at 10:24pm, Baoquan He wrote:
> On 07/31/13 at 04:31pm, Harald Hoyer wrote:
> > On 07/31/2013 04:29 PM, Vivek Goyal wrote:
> > > On Wed, Jul 31, 2013 at 04:25:57PM +0200, Harald Hoyer wrote:
> > > 
> > > Hi Harald,
> > > 
> > > Do you still like the parameter name "rd.action_on_fail". I think a new
> > > parameter say, "rd.no_emergecny_shell" might make more sense to reflect
> > > what we are doing.
> > > 
> > > If you like it, I can request bao to post a new patch and make appropriate
> > > changes.
> > > 
> > > Thanks
> > > Vivek
> > > 
> > 
> > You can add the rd.no_emergency_shell parser in your kdump module and touch the
> > marker file. I think that gives you more flexibility for runtime decisions.
> > You can just add and remove that file on will.
> Hi Vivek,
> 
> I agree with Harald, there's no need to add a parameter into dracut any
> more. Because currently only 2 actions are taken, 1 is emergency-shell,
> the other is continue. We can just put a file as switch, if the file exists,
> all failed action doesn't trigger emergency shell before Kdump, just
> continue. 
> 
> If you want several more actions, E.g reboot or others, we can put them
> into this file. Then in Kdump module, we can read the content and parse.
> As for modules before Kdump, they don't feel it. I think this can extend
> the 'default action' flexibly. This keep our reliability on dracut at the
> least.

Is this necessary to define more actions?

We can bypass failures (switch off emergency shell) in drauct or systemd
and eventually get down to kdump.sh. If the dump fails, "default action"
is triggered. Other unrelated failures happening before kdump.sh should
be ignored.

Thanks
WANG Chao

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Change the implementation of action_on_fail
       [not found]                         ` <20130801142445.GB8230-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
@ 2013-08-01 14:54                           ` Vivek Goyal
  2013-08-01 14:54                           ` WANG Chao
  1 sibling, 0 replies; 15+ messages in thread
From: Vivek Goyal @ 2013-08-01 14:54 UTC (permalink / raw)
  To: Baoquan He; +Cc: Harald Hoyer, initramfs-u79uwXL29TY76Z2rM5mHXA, WANG Chao

On Thu, Aug 01, 2013 at 10:24:45PM +0800, Baoquan He wrote:
> On 07/31/13 at 04:31pm, Harald Hoyer wrote:
> > On 07/31/2013 04:29 PM, Vivek Goyal wrote:
> > > On Wed, Jul 31, 2013 at 04:25:57PM +0200, Harald Hoyer wrote:
> > > 
> > > Hi Harald,
> > > 
> > > Do you still like the parameter name "rd.action_on_fail". I think a new
> > > parameter say, "rd.no_emergecny_shell" might make more sense to reflect
> > > what we are doing.
> > > 
> > > If you like it, I can request bao to post a new patch and make appropriate
> > > changes.
> > > 
> > > Thanks
> > > Vivek
> > > 
> > 
> > You can add the rd.no_emergency_shell parser in your kdump module and touch the
> > marker file. I think that gives you more flexibility for runtime decisions.
> > You can just add and remove that file on will.
> Hi Vivek,
> 
> I agree with Harald, there's no need to add a parameter into dracut any
> more. Because currently only 2 actions are taken, 1 is emergency-shell,
> the other is continue. We can just put a file as switch, if the file exists,
> all failed action doesn't trigger emergency shell before Kdump, just
> continue. 
> 
> If you want several more actions, E.g reboot or others, we can put them
> into this file. Then in Kdump module, we can read the content and parse.
> As for modules before Kdump, they don't feel it. I think this can extend
> the 'default action' flexibly. This keep our reliability on dracut at the
> least.
> 
> How do you think about it?

Bao,

Ok, status quo is fine for the time being.

Thanks
Vivek

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Change the implementation of action_on_fail
       [not found]                     ` <51F91FAC.50706-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2013-08-01 14:24                       ` Baoquan He
       [not found]                         ` <20130801142445.GB8230-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
  0 siblings, 1 reply; 15+ messages in thread
From: Baoquan He @ 2013-08-01 14:24 UTC (permalink / raw)
  To: Harald Hoyer; +Cc: Vivek Goyal, initramfs-u79uwXL29TY76Z2rM5mHXA, WANG Chao

On 07/31/13 at 04:31pm, Harald Hoyer wrote:
> On 07/31/2013 04:29 PM, Vivek Goyal wrote:
> > On Wed, Jul 31, 2013 at 04:25:57PM +0200, Harald Hoyer wrote:
> > 
> > Hi Harald,
> > 
> > Do you still like the parameter name "rd.action_on_fail". I think a new
> > parameter say, "rd.no_emergecny_shell" might make more sense to reflect
> > what we are doing.
> > 
> > If you like it, I can request bao to post a new patch and make appropriate
> > changes.
> > 
> > Thanks
> > Vivek
> > 
> 
> You can add the rd.no_emergency_shell parser in your kdump module and touch the
> marker file. I think that gives you more flexibility for runtime decisions.
> You can just add and remove that file on will.
Hi Vivek,

I agree with Harald, there's no need to add a parameter into dracut any
more. Because currently only 2 actions are taken, 1 is emergency-shell,
the other is continue. We can just put a file as switch, if the file exists,
all failed action doesn't trigger emergency shell before Kdump, just
continue. 

If you want several more actions, E.g reboot or others, we can put them
into this file. Then in Kdump module, we can read the content and parse.
As for modules before Kdump, they don't feel it. I think this can extend
the 'default action' flexibly. This keep our reliability on dracut at the
least.

How do you think about it?

Baoquan
Thanks a lot

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Change the implementation of action_on_fail
       [not found] ` <73cc07330929ba4b226f2a0623a5459cd42932b9.1374574542.git.bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
                     ` (2 preceding siblings ...)
  2013-07-31 14:27   ` Vivek Goyal
@ 2013-08-01 13:48   ` Vivek Goyal
  3 siblings, 0 replies; 15+ messages in thread
From: Vivek Goyal @ 2013-08-01 13:48 UTC (permalink / raw)
  To: Baoquan He; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

On Tue, Jul 23, 2013 at 06:16:00PM +0800, Baoquan He wrote:

[..]
> diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
> index 8eeebf3..2a3d831 100755
> --- a/modules.d/99base/dracut-lib.sh
> +++ b/modules.d/99base/dracut-lib.sh
> @@ -1003,24 +1003,16 @@ emergency_shell()
>  
>  action_on_fail()
>  {
> -    local _action=$(getarg rd.action_on_fail= -d action_on_fail=)
> -    case "$_action" in
> -        continue)
> -            [ "$1" = "-n" ] && shift 2
> -            [ "$1" = "--shutdown" ] && shift 2
> -            warn "$*"
> -            warn "Not dropping to emergency shell, because 'action_on_fail=continue' was set on the kernel command line."
> -            return 0
> -            ;;
> -        shell)
> -            emergency_shell $@
> -            return 1
> -            ;;
> -        *)
> -            emergency_shell $@
> -            return 1
> -            ;;
> -    esac
> +    if [ -f "$initdir/lib/dracut/no-emergency-shell" ]; then
> +        [ "$1" = "-n" ] && shift 2
> +        [ "$1" = "--shutdown" ] && shift 2
> +        warn "$*"
> +        warn "Not dropping to emergency shell, because 'action_on_fail=continue' was set on the kernel command line."

Bao,

Ok, so you have completely removed the parameter rd.action_on_fail. I got
confused with above message "'action_on_fail=continue' was set on the
kernel command line".

I see that it has been fixed in the commit and replaced with following
message.

"Not dropping to emergency shell, because $initdir/lib/dracut/no-emergency-shell exists."

This makes sense now.

Thanks
Vivek

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Change the implementation of action_on_fail
       [not found]                 ` <20130731142905.GH31151-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2013-07-31 14:31                   ` Harald Hoyer
       [not found]                     ` <51F91FAC.50706-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 15+ messages in thread
From: Harald Hoyer @ 2013-07-31 14:31 UTC (permalink / raw)
  To: Vivek Goyal; +Cc: Baoquan He, initramfs-u79uwXL29TY76Z2rM5mHXA, WANG Chao

On 07/31/2013 04:29 PM, Vivek Goyal wrote:
> On Wed, Jul 31, 2013 at 04:25:57PM +0200, Harald Hoyer wrote:
> 
> [..]
>>>> I like it.
>>>>
>>>> Vivek: would that solve one of your systemd problems?
>>>
>>> Hi Harald,
>>>
>>> Yes this should solve one of the problems of being able to call emergency
>>> shell from kdump module.
>>>
>>> I was thinking of modirying emergency.service on the fly and then reload
>>> systemd config. But I guess this solution is simpler.
>>>
>>> It also takes away the flexibility of being able to specify "reboot" or
>>> some other actions as failure actions. But nobody as asked for those
>>> yet.
>>>
>>> So yes, agreed, this will solve atleast one problem. So makes sense
>>> to take it in.
>>>
>>> Thanks
>>> Vivek
>>>
>>
>> pushed, thanks!
> 
> Hi Harald,
> 
> Do you still like the parameter name "rd.action_on_fail". I think a new
> parameter say, "rd.no_emergecny_shell" might make more sense to reflect
> what we are doing.
> 
> If you like it, I can request bao to post a new patch and make appropriate
> changes.
> 
> Thanks
> Vivek
> 

You can add the rd.no_emergency_shell parser in your kdump module and touch the
marker file. I think that gives you more flexibility for runtime decisions.
You can just add and remove that file on will.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Change the implementation of action_on_fail
       [not found]             ` <51F91E75.3070102-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2013-07-31 14:29               ` Vivek Goyal
       [not found]                 ` <20130731142905.GH31151-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 15+ messages in thread
From: Vivek Goyal @ 2013-07-31 14:29 UTC (permalink / raw)
  To: Harald Hoyer; +Cc: Baoquan He, initramfs-u79uwXL29TY76Z2rM5mHXA, WANG Chao

On Wed, Jul 31, 2013 at 04:25:57PM +0200, Harald Hoyer wrote:

[..]
> >> I like it.
> >>
> >> Vivek: would that solve one of your systemd problems?
> > 
> > Hi Harald,
> > 
> > Yes this should solve one of the problems of being able to call emergency
> > shell from kdump module.
> > 
> > I was thinking of modirying emergency.service on the fly and then reload
> > systemd config. But I guess this solution is simpler.
> > 
> > It also takes away the flexibility of being able to specify "reboot" or
> > some other actions as failure actions. But nobody as asked for those
> > yet.
> > 
> > So yes, agreed, this will solve atleast one problem. So makes sense
> > to take it in.
> > 
> > Thanks
> > Vivek
> > 
> 
> pushed, thanks!

Hi Harald,

Do you still like the parameter name "rd.action_on_fail". I think a new
parameter say, "rd.no_emergecny_shell" might make more sense to reflect
what we are doing.

If you like it, I can request bao to post a new patch and make appropriate
changes.

Thanks
Vivek

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Change the implementation of action_on_fail
       [not found] ` <73cc07330929ba4b226f2a0623a5459cd42932b9.1374574542.git.bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2013-07-23 10:25   ` Baoquan
  2013-07-31 14:07   ` Harald Hoyer
@ 2013-07-31 14:27   ` Vivek Goyal
  2013-08-01 13:48   ` Vivek Goyal
  3 siblings, 0 replies; 15+ messages in thread
From: Vivek Goyal @ 2013-07-31 14:27 UTC (permalink / raw)
  To: Baoquan He; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, Harald Hoyer

On Tue, Jul 23, 2013 at 06:16:00PM +0800, Baoquan He wrote:
> Currently when action_on_fail is enabled, the emergency_shell won't be called.
> In kdump even though user specify the default action as emergency_shell,
> dracut skip it. Now change the implementation of action_on_fail to depend
> on a file which is created by kdump when making kdump initrd, then remove it
> at the beginning of kdump. This can solve the explicit emergency_shell problem.
> 
> And action_on_fail won't need paramenters, remove the relevant description in
> dracut man page.

Bao,

I think if you are taking away the capability to specify the action on
failure, then parameter name action_on_fail does not make much sense to
me.

A new parameter named "rd.no_emergency_shell" might be better in this
case.

Thanks
Vivek

> 
> Signed-off-by: Baoquan He <bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  dracut.cmdline.7.asc                         |    4 ---
>  modules.d/98systemd/dracut-emergency.service |    2 +-
>  modules.d/98systemd/emergency.service        |    2 +-
>  modules.d/99base/dracut-lib.sh               |   28 +++++++++----------------
>  4 files changed, 12 insertions(+), 24 deletions(-)
> 
> diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
> index cf11d50..09c47e8 100644
> --- a/dracut.cmdline.7.asc
> +++ b/dracut.cmdline.7.asc
> @@ -121,10 +121,6 @@ Misc
>     specify the controlling terminal for the console.
>     This is useful, if you have multiple "console=" arguments.
>  
> -**rd.action_on_fail=**_{shell|continue}_::
> -   Specify the action after failure. By default it's emergency_shell.
> -   'continue' means: ignore the current failure and go ahead.
> -
>  [[dracutkerneldebug]]
>  Debug
>  ~~~~~
> diff --git a/modules.d/98systemd/dracut-emergency.service b/modules.d/98systemd/dracut-emergency.service
> index a4b81bc..5a6d525 100644
> --- a/modules.d/98systemd/dracut-emergency.service
> +++ b/modules.d/98systemd/dracut-emergency.service
> @@ -13,7 +13,7 @@ DefaultDependencies=no
>  After=systemd-vconsole-setup.service
>  Wants=systemd-vconsole-setup.service
>  Conflicts=emergency.service emergency.target
> -ConditionKernelCommandLine=!action_on_fail=continue
> +ConditionPathExists=!/lib/dracut/no-emergency-shell
>  
>  [Service]
>  Environment=HOME=/
> diff --git a/modules.d/98systemd/emergency.service b/modules.d/98systemd/emergency.service
> index c19fe37..5f1eaa2 100644
> --- a/modules.d/98systemd/emergency.service
> +++ b/modules.d/98systemd/emergency.service
> @@ -12,7 +12,7 @@ Description=Emergency Shell
>  DefaultDependencies=no
>  After=systemd-vconsole-setup.service
>  Wants=systemd-vconsole-setup.service
> -ConditionKernelCommandLine=!action_on_fail=continue
> +ConditionPathExists=!/lib/dracut/no-emergency-shell
>  
>  [Service]
>  Environment=HOME=/
> diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
> index 8eeebf3..2a3d831 100755
> --- a/modules.d/99base/dracut-lib.sh
> +++ b/modules.d/99base/dracut-lib.sh
> @@ -1003,24 +1003,16 @@ emergency_shell()
>  
>  action_on_fail()
>  {
> -    local _action=$(getarg rd.action_on_fail= -d action_on_fail=)
> -    case "$_action" in
> -        continue)
> -            [ "$1" = "-n" ] && shift 2
> -            [ "$1" = "--shutdown" ] && shift 2
> -            warn "$*"
> -            warn "Not dropping to emergency shell, because 'action_on_fail=continue' was set on the kernel command line."
> -            return 0
> -            ;;
> -        shell)
> -            emergency_shell $@
> -            return 1
> -            ;;
> -        *)
> -            emergency_shell $@
> -            return 1
> -            ;;
> -    esac
> +    if [ -f "$initdir/lib/dracut/no-emergency-shell" ]; then
> +        [ "$1" = "-n" ] && shift 2
> +        [ "$1" = "--shutdown" ] && shift 2
> +        warn "$*"
> +        warn "Not dropping to emergency shell, because 'action_on_fail=continue' was set on the kernel command line."
> +        return 0
> +    fi
> +
> +    emergency_shell $@
> +    return 1
>  }
>  
>  # Retain the values of these variables but ensure that they are unexported
> -- 
> 1.7.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe initramfs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Change the implementation of action_on_fail
       [not found]         ` <20130731142050.GG31151-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2013-07-31 14:25           ` Harald Hoyer
       [not found]             ` <51F91E75.3070102-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 15+ messages in thread
From: Harald Hoyer @ 2013-07-31 14:25 UTC (permalink / raw)
  To: Vivek Goyal; +Cc: Baoquan He, initramfs-u79uwXL29TY76Z2rM5mHXA, WANG Chao

On 07/31/2013 04:20 PM, Vivek Goyal wrote:
> On Wed, Jul 31, 2013 at 04:07:16PM +0200, Harald Hoyer wrote:
>> On 07/23/2013 12:16 PM, Baoquan He wrote:
>>> Currently when action_on_fail is enabled, the emergency_shell won't be called.
>>> In kdump even though user specify the default action as emergency_shell,
>>> dracut skip it. Now change the implementation of action_on_fail to depend
>>> on a file which is created by kdump when making kdump initrd, then remove it
>>> at the beginning of kdump. This can solve the explicit emergency_shell problem.
>>>
>>> And action_on_fail won't need paramenters, remove the relevant description in
>>> dracut man page.
>>
>> I like it.
>>
>> Vivek: would that solve one of your systemd problems?
> 
> Hi Harald,
> 
> Yes this should solve one of the problems of being able to call emergency
> shell from kdump module.
> 
> I was thinking of modirying emergency.service on the fly and then reload
> systemd config. But I guess this solution is simpler.
> 
> It also takes away the flexibility of being able to specify "reboot" or
> some other actions as failure actions. But nobody as asked for those
> yet.
> 
> So yes, agreed, this will solve atleast one problem. So makes sense
> to take it in.
> 
> Thanks
> Vivek
> 

pushed, thanks!

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Change the implementation of action_on_fail
       [not found]     ` <51F91A14.4020601-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2013-07-31 14:20       ` Vivek Goyal
       [not found]         ` <20130731142050.GG31151-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 15+ messages in thread
From: Vivek Goyal @ 2013-07-31 14:20 UTC (permalink / raw)
  To: Harald Hoyer; +Cc: Baoquan He, initramfs-u79uwXL29TY76Z2rM5mHXA, WANG Chao

On Wed, Jul 31, 2013 at 04:07:16PM +0200, Harald Hoyer wrote:
> On 07/23/2013 12:16 PM, Baoquan He wrote:
> > Currently when action_on_fail is enabled, the emergency_shell won't be called.
> > In kdump even though user specify the default action as emergency_shell,
> > dracut skip it. Now change the implementation of action_on_fail to depend
> > on a file which is created by kdump when making kdump initrd, then remove it
> > at the beginning of kdump. This can solve the explicit emergency_shell problem.
> > 
> > And action_on_fail won't need paramenters, remove the relevant description in
> > dracut man page.
> 
> I like it.
> 
> Vivek: would that solve one of your systemd problems?

Hi Harald,

Yes this should solve one of the problems of being able to call emergency
shell from kdump module.

I was thinking of modirying emergency.service on the fly and then reload
systemd config. But I guess this solution is simpler.

It also takes away the flexibility of being able to specify "reboot" or
some other actions as failure actions. But nobody as asked for those
yet.

So yes, agreed, this will solve atleast one problem. So makes sense
to take it in.

Thanks
Vivek

> 
> 
> > 
> > Signed-off-by: Baoquan He <bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> > ---
> >  dracut.cmdline.7.asc                         |    4 ---
> >  modules.d/98systemd/dracut-emergency.service |    2 +-
> >  modules.d/98systemd/emergency.service        |    2 +-
> >  modules.d/99base/dracut-lib.sh               |   28 +++++++++----------------
> >  4 files changed, 12 insertions(+), 24 deletions(-)
> > 
> > diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
> > index cf11d50..09c47e8 100644
> > --- a/dracut.cmdline.7.asc
> > +++ b/dracut.cmdline.7.asc
> > @@ -121,10 +121,6 @@ Misc
> >     specify the controlling terminal for the console.
> >     This is useful, if you have multiple "console=" arguments.
> >  
> > -**rd.action_on_fail=**_{shell|continue}_::
> > -   Specify the action after failure. By default it's emergency_shell.
> > -   'continue' means: ignore the current failure and go ahead.
> > -
> >  [[dracutkerneldebug]]
> >  Debug
> >  ~~~~~
> > diff --git a/modules.d/98systemd/dracut-emergency.service b/modules.d/98systemd/dracut-emergency.service
> > index a4b81bc..5a6d525 100644
> > --- a/modules.d/98systemd/dracut-emergency.service
> > +++ b/modules.d/98systemd/dracut-emergency.service
> > @@ -13,7 +13,7 @@ DefaultDependencies=no
> >  After=systemd-vconsole-setup.service
> >  Wants=systemd-vconsole-setup.service
> >  Conflicts=emergency.service emergency.target
> > -ConditionKernelCommandLine=!action_on_fail=continue
> > +ConditionPathExists=!/lib/dracut/no-emergency-shell
> >  
> >  [Service]
> >  Environment=HOME=/
> > diff --git a/modules.d/98systemd/emergency.service b/modules.d/98systemd/emergency.service
> > index c19fe37..5f1eaa2 100644
> > --- a/modules.d/98systemd/emergency.service
> > +++ b/modules.d/98systemd/emergency.service
> > @@ -12,7 +12,7 @@ Description=Emergency Shell
> >  DefaultDependencies=no
> >  After=systemd-vconsole-setup.service
> >  Wants=systemd-vconsole-setup.service
> > -ConditionKernelCommandLine=!action_on_fail=continue
> > +ConditionPathExists=!/lib/dracut/no-emergency-shell
> >  
> >  [Service]
> >  Environment=HOME=/
> > diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
> > index 8eeebf3..2a3d831 100755
> > --- a/modules.d/99base/dracut-lib.sh
> > +++ b/modules.d/99base/dracut-lib.sh
> > @@ -1003,24 +1003,16 @@ emergency_shell()
> >  
> >  action_on_fail()
> >  {
> > -    local _action=$(getarg rd.action_on_fail= -d action_on_fail=)
> > -    case "$_action" in
> > -        continue)
> > -            [ "$1" = "-n" ] && shift 2
> > -            [ "$1" = "--shutdown" ] && shift 2
> > -            warn "$*"
> > -            warn "Not dropping to emergency shell, because 'action_on_fail=continue' was set on the kernel command line."
> > -            return 0
> > -            ;;
> > -        shell)
> > -            emergency_shell $@
> > -            return 1
> > -            ;;
> > -        *)
> > -            emergency_shell $@
> > -            return 1
> > -            ;;
> > -    esac
> > +    if [ -f "$initdir/lib/dracut/no-emergency-shell" ]; then
> > +        [ "$1" = "-n" ] && shift 2
> > +        [ "$1" = "--shutdown" ] && shift 2
> > +        warn "$*"
> > +        warn "Not dropping to emergency shell, because 'action_on_fail=continue' was set on the kernel command line."
> > +        return 0
> > +    fi
> > +
> > +    emergency_shell $@
> > +    return 1
> >  }
> >  
> >  # Retain the values of these variables but ensure that they are unexported
> > 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Change the implementation of action_on_fail
       [not found] ` <73cc07330929ba4b226f2a0623a5459cd42932b9.1374574542.git.bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2013-07-23 10:25   ` Baoquan
@ 2013-07-31 14:07   ` Harald Hoyer
       [not found]     ` <51F91A14.4020601-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2013-07-31 14:27   ` Vivek Goyal
  2013-08-01 13:48   ` Vivek Goyal
  3 siblings, 1 reply; 15+ messages in thread
From: Harald Hoyer @ 2013-07-31 14:07 UTC (permalink / raw)
  To: Baoquan He; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, WANG Chao, Vivek Goyal

On 07/23/2013 12:16 PM, Baoquan He wrote:
> Currently when action_on_fail is enabled, the emergency_shell won't be called.
> In kdump even though user specify the default action as emergency_shell,
> dracut skip it. Now change the implementation of action_on_fail to depend
> on a file which is created by kdump when making kdump initrd, then remove it
> at the beginning of kdump. This can solve the explicit emergency_shell problem.
> 
> And action_on_fail won't need paramenters, remove the relevant description in
> dracut man page.

I like it.

Vivek: would that solve one of your systemd problems?


> 
> Signed-off-by: Baoquan He <bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  dracut.cmdline.7.asc                         |    4 ---
>  modules.d/98systemd/dracut-emergency.service |    2 +-
>  modules.d/98systemd/emergency.service        |    2 +-
>  modules.d/99base/dracut-lib.sh               |   28 +++++++++----------------
>  4 files changed, 12 insertions(+), 24 deletions(-)
> 
> diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
> index cf11d50..09c47e8 100644
> --- a/dracut.cmdline.7.asc
> +++ b/dracut.cmdline.7.asc
> @@ -121,10 +121,6 @@ Misc
>     specify the controlling terminal for the console.
>     This is useful, if you have multiple "console=" arguments.
>  
> -**rd.action_on_fail=**_{shell|continue}_::
> -   Specify the action after failure. By default it's emergency_shell.
> -   'continue' means: ignore the current failure and go ahead.
> -
>  [[dracutkerneldebug]]
>  Debug
>  ~~~~~
> diff --git a/modules.d/98systemd/dracut-emergency.service b/modules.d/98systemd/dracut-emergency.service
> index a4b81bc..5a6d525 100644
> --- a/modules.d/98systemd/dracut-emergency.service
> +++ b/modules.d/98systemd/dracut-emergency.service
> @@ -13,7 +13,7 @@ DefaultDependencies=no
>  After=systemd-vconsole-setup.service
>  Wants=systemd-vconsole-setup.service
>  Conflicts=emergency.service emergency.target
> -ConditionKernelCommandLine=!action_on_fail=continue
> +ConditionPathExists=!/lib/dracut/no-emergency-shell
>  
>  [Service]
>  Environment=HOME=/
> diff --git a/modules.d/98systemd/emergency.service b/modules.d/98systemd/emergency.service
> index c19fe37..5f1eaa2 100644
> --- a/modules.d/98systemd/emergency.service
> +++ b/modules.d/98systemd/emergency.service
> @@ -12,7 +12,7 @@ Description=Emergency Shell
>  DefaultDependencies=no
>  After=systemd-vconsole-setup.service
>  Wants=systemd-vconsole-setup.service
> -ConditionKernelCommandLine=!action_on_fail=continue
> +ConditionPathExists=!/lib/dracut/no-emergency-shell
>  
>  [Service]
>  Environment=HOME=/
> diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
> index 8eeebf3..2a3d831 100755
> --- a/modules.d/99base/dracut-lib.sh
> +++ b/modules.d/99base/dracut-lib.sh
> @@ -1003,24 +1003,16 @@ emergency_shell()
>  
>  action_on_fail()
>  {
> -    local _action=$(getarg rd.action_on_fail= -d action_on_fail=)
> -    case "$_action" in
> -        continue)
> -            [ "$1" = "-n" ] && shift 2
> -            [ "$1" = "--shutdown" ] && shift 2
> -            warn "$*"
> -            warn "Not dropping to emergency shell, because 'action_on_fail=continue' was set on the kernel command line."
> -            return 0
> -            ;;
> -        shell)
> -            emergency_shell $@
> -            return 1
> -            ;;
> -        *)
> -            emergency_shell $@
> -            return 1
> -            ;;
> -    esac
> +    if [ -f "$initdir/lib/dracut/no-emergency-shell" ]; then
> +        [ "$1" = "-n" ] && shift 2
> +        [ "$1" = "--shutdown" ] && shift 2
> +        warn "$*"
> +        warn "Not dropping to emergency shell, because 'action_on_fail=continue' was set on the kernel command line."
> +        return 0
> +    fi
> +
> +    emergency_shell $@
> +    return 1
>  }
>  
>  # Retain the values of these variables but ensure that they are unexported
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Change the implementation of action_on_fail
       [not found] ` <73cc07330929ba4b226f2a0623a5459cd42932b9.1374574542.git.bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2013-07-23 10:25   ` Baoquan
  2013-07-31 14:07   ` Harald Hoyer
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 15+ messages in thread
From: Baoquan @ 2013-07-23 10:25 UTC (permalink / raw)
  To: Harald Hoyer; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

Sorry, this is V2.

Hi Harald,

Now kdump is blocked by 'default shell' malfunction problems. Before I
wanted to split the _emergencu_shell, seems you don't like it. Now we
can only use a file to enalbe/disable emergency_shell, then in kdump
removing this file can solve our problem.

What's your opinion?

Baoquan
Thanks a lot

On 07/23/2013 06:16 PM, Baoquan He wrote:
> Currently when action_on_fail is enabled, the emergency_shell won't be called.
> In kdump even though user specify the default action as emergency_shell,
> dracut skip it. Now change the implementation of action_on_fail to depend
> on a file which is created by kdump when making kdump initrd, then remove it
> at the beginning of kdump. This can solve the explicit emergency_shell problem.
> 
> And action_on_fail won't need paramenters, remove the relevant description in
> dracut man page.
> 
> Signed-off-by: Baoquan He <bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  dracut.cmdline.7.asc                         |    4 ---
>  modules.d/98systemd/dracut-emergency.service |    2 +-
>  modules.d/98systemd/emergency.service        |    2 +-
>  modules.d/99base/dracut-lib.sh               |   28 +++++++++----------------
>  4 files changed, 12 insertions(+), 24 deletions(-)
> 
> diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
> index cf11d50..09c47e8 100644
> --- a/dracut.cmdline.7.asc
> +++ b/dracut.cmdline.7.asc
> @@ -121,10 +121,6 @@ Misc
>     specify the controlling terminal for the console.
>     This is useful, if you have multiple "console=" arguments.
>  
> -**rd.action_on_fail=**_{shell|continue}_::
> -   Specify the action after failure. By default it's emergency_shell.
> -   'continue' means: ignore the current failure and go ahead.
> -
>  [[dracutkerneldebug]]
>  Debug
>  ~~~~~
> diff --git a/modules.d/98systemd/dracut-emergency.service b/modules.d/98systemd/dracut-emergency.service
> index a4b81bc..5a6d525 100644
> --- a/modules.d/98systemd/dracut-emergency.service
> +++ b/modules.d/98systemd/dracut-emergency.service
> @@ -13,7 +13,7 @@ DefaultDependencies=no
>  After=systemd-vconsole-setup.service
>  Wants=systemd-vconsole-setup.service
>  Conflicts=emergency.service emergency.target
> -ConditionKernelCommandLine=!action_on_fail=continue
> +ConditionPathExists=!/lib/dracut/no-emergency-shell
>  
>  [Service]
>  Environment=HOME=/
> diff --git a/modules.d/98systemd/emergency.service b/modules.d/98systemd/emergency.service
> index c19fe37..5f1eaa2 100644
> --- a/modules.d/98systemd/emergency.service
> +++ b/modules.d/98systemd/emergency.service
> @@ -12,7 +12,7 @@ Description=Emergency Shell
>  DefaultDependencies=no
>  After=systemd-vconsole-setup.service
>  Wants=systemd-vconsole-setup.service
> -ConditionKernelCommandLine=!action_on_fail=continue
> +ConditionPathExists=!/lib/dracut/no-emergency-shell
>  
>  [Service]
>  Environment=HOME=/
> diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
> index 8eeebf3..2a3d831 100755
> --- a/modules.d/99base/dracut-lib.sh
> +++ b/modules.d/99base/dracut-lib.sh
> @@ -1003,24 +1003,16 @@ emergency_shell()
>  
>  action_on_fail()
>  {
> -    local _action=$(getarg rd.action_on_fail= -d action_on_fail=)
> -    case "$_action" in
> -        continue)
> -            [ "$1" = "-n" ] && shift 2
> -            [ "$1" = "--shutdown" ] && shift 2
> -            warn "$*"
> -            warn "Not dropping to emergency shell, because 'action_on_fail=continue' was set on the kernel command line."
> -            return 0
> -            ;;
> -        shell)
> -            emergency_shell $@
> -            return 1
> -            ;;
> -        *)
> -            emergency_shell $@
> -            return 1
> -            ;;
> -    esac
> +    if [ -f "$initdir/lib/dracut/no-emergency-shell" ]; then
> +        [ "$1" = "-n" ] && shift 2
> +        [ "$1" = "--shutdown" ] && shift 2
> +        warn "$*"
> +        warn "Not dropping to emergency shell, because 'action_on_fail=continue' was set on the kernel command line."
> +        return 0
> +    fi
> +
> +    emergency_shell $@
> +    return 1
>  }
>  
>  # Retain the values of these variables but ensure that they are unexported
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH] Change the implementation of action_on_fail
@ 2013-07-23 10:16 Baoquan He
       [not found] ` <73cc07330929ba4b226f2a0623a5459cd42932b9.1374574542.git.bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 15+ messages in thread
From: Baoquan He @ 2013-07-23 10:16 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Baoquan He

Currently when action_on_fail is enabled, the emergency_shell won't be called.
In kdump even though user specify the default action as emergency_shell,
dracut skip it. Now change the implementation of action_on_fail to depend
on a file which is created by kdump when making kdump initrd, then remove it
at the beginning of kdump. This can solve the explicit emergency_shell problem.

And action_on_fail won't need paramenters, remove the relevant description in
dracut man page.

Signed-off-by: Baoquan He <bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 dracut.cmdline.7.asc                         |    4 ---
 modules.d/98systemd/dracut-emergency.service |    2 +-
 modules.d/98systemd/emergency.service        |    2 +-
 modules.d/99base/dracut-lib.sh               |   28 +++++++++----------------
 4 files changed, 12 insertions(+), 24 deletions(-)

diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
index cf11d50..09c47e8 100644
--- a/dracut.cmdline.7.asc
+++ b/dracut.cmdline.7.asc
@@ -121,10 +121,6 @@ Misc
    specify the controlling terminal for the console.
    This is useful, if you have multiple "console=" arguments.
 
-**rd.action_on_fail=**_{shell|continue}_::
-   Specify the action after failure. By default it's emergency_shell.
-   'continue' means: ignore the current failure and go ahead.
-
 [[dracutkerneldebug]]
 Debug
 ~~~~~
diff --git a/modules.d/98systemd/dracut-emergency.service b/modules.d/98systemd/dracut-emergency.service
index a4b81bc..5a6d525 100644
--- a/modules.d/98systemd/dracut-emergency.service
+++ b/modules.d/98systemd/dracut-emergency.service
@@ -13,7 +13,7 @@ DefaultDependencies=no
 After=systemd-vconsole-setup.service
 Wants=systemd-vconsole-setup.service
 Conflicts=emergency.service emergency.target
-ConditionKernelCommandLine=!action_on_fail=continue
+ConditionPathExists=!/lib/dracut/no-emergency-shell
 
 [Service]
 Environment=HOME=/
diff --git a/modules.d/98systemd/emergency.service b/modules.d/98systemd/emergency.service
index c19fe37..5f1eaa2 100644
--- a/modules.d/98systemd/emergency.service
+++ b/modules.d/98systemd/emergency.service
@@ -12,7 +12,7 @@ Description=Emergency Shell
 DefaultDependencies=no
 After=systemd-vconsole-setup.service
 Wants=systemd-vconsole-setup.service
-ConditionKernelCommandLine=!action_on_fail=continue
+ConditionPathExists=!/lib/dracut/no-emergency-shell
 
 [Service]
 Environment=HOME=/
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 8eeebf3..2a3d831 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -1003,24 +1003,16 @@ emergency_shell()
 
 action_on_fail()
 {
-    local _action=$(getarg rd.action_on_fail= -d action_on_fail=)
-    case "$_action" in
-        continue)
-            [ "$1" = "-n" ] && shift 2
-            [ "$1" = "--shutdown" ] && shift 2
-            warn "$*"
-            warn "Not dropping to emergency shell, because 'action_on_fail=continue' was set on the kernel command line."
-            return 0
-            ;;
-        shell)
-            emergency_shell $@
-            return 1
-            ;;
-        *)
-            emergency_shell $@
-            return 1
-            ;;
-    esac
+    if [ -f "$initdir/lib/dracut/no-emergency-shell" ]; then
+        [ "$1" = "-n" ] && shift 2
+        [ "$1" = "--shutdown" ] && shift 2
+        warn "$*"
+        warn "Not dropping to emergency shell, because 'action_on_fail=continue' was set on the kernel command line."
+        return 0
+    fi
+
+    emergency_shell $@
+    return 1
 }
 
 # Retain the values of these variables but ensure that they are unexported
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-08-01 14:54 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-22 11:32 [PATCH] Change the implementation of action_on_fail Baoquan He
     [not found] ` <8a7ac3492f63fd2a5fa7ee57d9b9e7c8c2dd305c.1374492675.git.bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-07-23  9:53   ` Baoquan
2013-07-23 10:14   ` Baoquan
2013-07-23 10:16 Baoquan He
     [not found] ` <73cc07330929ba4b226f2a0623a5459cd42932b9.1374574542.git.bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-07-23 10:25   ` Baoquan
2013-07-31 14:07   ` Harald Hoyer
     [not found]     ` <51F91A14.4020601-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-07-31 14:20       ` Vivek Goyal
     [not found]         ` <20130731142050.GG31151-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-07-31 14:25           ` Harald Hoyer
     [not found]             ` <51F91E75.3070102-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-07-31 14:29               ` Vivek Goyal
     [not found]                 ` <20130731142905.GH31151-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-07-31 14:31                   ` Harald Hoyer
     [not found]                     ` <51F91FAC.50706-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-08-01 14:24                       ` Baoquan He
     [not found]                         ` <20130801142445.GB8230-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2013-08-01 14:54                           ` Vivek Goyal
2013-08-01 14:54                           ` WANG Chao
2013-07-31 14:27   ` Vivek Goyal
2013-08-01 13:48   ` Vivek Goyal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.