mkinitrd unification across distributions
 help / color / mirror / Atom feed
* [PATCH 1/2] 99fs-lib/fs-lib.sh: Let user specify the action after fail for fsck
@ 2013-05-29  6:33 Baoquan He
       [not found] ` <078c160e62c2c750efe71fc8a05dd7c5de71bde3.1369809156.git.bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Baoquan He @ 2013-05-29  6:33 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Baoquan He

The fsck is ignored when replace emergency_shell with action_on_fail,
now add it.

Signed-off-by: Baoquan He <bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 modules.d/99fs-lib/fs-lib.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules.d/99fs-lib/fs-lib.sh b/modules.d/99fs-lib/fs-lib.sh
index e1f3074..88e7348 100755
--- a/modules.d/99fs-lib/fs-lib.sh
+++ b/modules.d/99fs-lib/fs-lib.sh
@@ -7,14 +7,14 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
 fsck_ask_reboot() {
     info "note - fsck suggests reboot, if you"
     info "leave shell, booting will continue normally"
-    emergency_shell -n "(reboot ?)"
+    action_on_fail -n "(reboot ?)"
 }
 
 fsck_ask_err() {
     warn "*** An error occurred during the file system check."
     warn "*** Dropping you to a shell; the system will try"
     warn "*** to mount the filesystem(s), when you leave the shell."
-    emergency_shell -n "(Repair filesystem)"
+    action_on_fail -n "(Repair filesystem)"
 }
 
 # inherits: _ret _drv _out
-- 
1.7.1

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

* [PATCH 2/2] let user specify action after systemd start dracut-emergency
       [not found] ` <078c160e62c2c750efe71fc8a05dd7c5de71bde3.1369809156.git.bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2013-05-29  6:33   ` Baoquan He
       [not found]     ` <d493350a355dc81998fd9a0b2d543ca79c2eb0c7.1369809156.git.bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2013-05-30  6:28   ` [PATCH 1/2] 99fs-lib/fs-lib.sh: Let user specify the action after fail for fsck Harald Hoyer
  1 sibling, 1 reply; 7+ messages in thread
From: Baoquan He @ 2013-05-29  6:33 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Baoquan He

If failed to mount /sysroot, triggering OnFailure= dependencies
of initrd-xxx.service, then dracut-emergency will be started by
systemd and enter into emergency shell.

Here use action_on_fail to replace "exec sh -i -l" in
dracut-emergency.sh so that it may continue if user specify
"action_on_fail=continue" though mount root failed.

Signed-off-by: Baoquan He <bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 modules.d/98systemd/dracut-emergency.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/modules.d/98systemd/dracut-emergency.sh b/modules.d/98systemd/dracut-emergency.sh
index 8ab045e..a4a10e6 100755
--- a/modules.d/98systemd/dracut-emergency.sh
+++ b/modules.d/98systemd/dracut-emergency.sh
@@ -30,7 +30,7 @@ if getargbool 1 rd.shell -d -y rdshell || getarg rd.break -d rdbreak; then
     echo
     [ -f /etc/profile ] && . /etc/profile
     [ -z "$PS1" ] && export PS1="$_name:\${PWD}# "
-    exec sh -i -l
+    ! action_on_fail "Systemd is starting emergency shell" && exec sh -i -l
 else
     warn "$action has failed. To debug this issue add \"rd.shell rd.debug\" to the kernel command line."
     exit 1
-- 
1.7.1

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

* Re: [PATCH 2/2] let user specify action after systemd start dracut-emergency
       [not found]     ` <d493350a355dc81998fd9a0b2d543ca79c2eb0c7.1369809156.git.bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2013-05-29  6:43       ` Baoquan
       [not found]         ` <51A5A3A2.8070403-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Baoquan @ 2013-05-29  6:43 UTC (permalink / raw)
  To: Harald Hoyer; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

On 05/29/2013 02:33 PM, Baoquan He wrote:

> If failed to mount /sysroot, triggering OnFailure= dependencies
> of initrd-xxx.service, then dracut-emergency will be started by
> systemd and enter into emergency shell.
> 
> Here use action_on_fail to replace "exec sh -i -l" in
> dracut-emergency.sh so that it may continue if user specify
> "action_on_fail=continue" though mount root failed.
> 
> Signed-off-by: Baoquan He <bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  modules.d/98systemd/dracut-emergency.sh |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/modules.d/98systemd/dracut-emergency.sh b/modules.d/98systemd/dracut-emergency.sh
> index 8ab045e..a4a10e6 100755
> --- a/modules.d/98systemd/dracut-emergency.sh
> +++ b/modules.d/98systemd/dracut-emergency.sh
> @@ -30,7 +30,7 @@ if getargbool 1 rd.shell -d -y rdshell || getarg rd.break -d rdbreak; then
>      echo
>      [ -f /etc/profile ] && . /etc/profile
>      [ -z "$PS1" ] && export PS1="$_name:\${PWD}# "
> -    exec sh -i -l
> +    ! action_on_fail "Systemd is starting emergency shell" && exec sh -i -l



! action_on_fail "Systemd is starting emergency shell" && exec sh -i -l
------->
action_on_fail "Systemd is starting emergency shell"


I think 1st line should be changed to 2nd line. I am wondering why
emergency_shell is not used directly here, instead "exec sh -i -l".

Hi Harald,

May I repost the 2/2 by removing "exec sh -i -l"?

Baoquan
Thanks a lot



>  else
>      warn "$action has failed. To debug this issue add \"rd.shell rd.debug\" to the kernel command line."
>      exit 1


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

* Re: [PATCH 2/2] let user specify action after systemd start dracut-emergency
       [not found]         ` <51A5A3A2.8070403-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2013-05-29  7:03           ` Baoquan
       [not found]             ` <51A5A828.5040700-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Baoquan @ 2013-05-29  7:03 UTC (permalink / raw)
  To: Harald Hoyer; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

On 05/29/2013 02:43 PM, Baoquan wrote:

>> If failed to mount /sysroot, triggering OnFailure= dependencies
>> > of initrd-xxx.service, then dracut-emergency will be started by
>> > systemd and enter into emergency shell.
>> > 
>> > Here use action_on_fail to replace "exec sh -i -l" in
>> > dracut-emergency.sh so that it may continue if user specify
>> > "action_on_fail=continue" though mount root failed.
>> > 
>> > Signed-off-by: Baoquan He <bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>> > ---
>> >  modules.d/98systemd/dracut-emergency.sh |    2 +-
>> >  1 files changed, 1 insertions(+), 1 deletions(-)
>> > 
>> > diff --git a/modules.d/98systemd/dracut-emergency.sh b/modules.d/98systemd/dracut-emergency.sh
>> > index 8ab045e..a4a10e6 100755
>> > --- a/modules.d/98systemd/dracut-emergency.sh
>> > +++ b/modules.d/98systemd/dracut-emergency.sh
>> > @@ -30,7 +30,7 @@ if getargbool 1 rd.shell -d -y rdshell || getarg rd.break -d rdbreak; then
>> >      echo
>> >      [ -f /etc/profile ] && . /etc/profile
>> >      [ -z "$PS1" ] && export PS1="$_name:\${PWD}# "
>> > -    exec sh -i -l
>> > +    ! action_on_fail "Systemd is starting emergency shell" && exec sh -i -l
> 
> 
> ! action_on_fail "Systemd is starting emergency shell" && exec sh -i -l
> ------->
> action_on_fail "Systemd is starting emergency shell"
> 

Well, I was wrong. Looks like the dracut-emergency will hang there, not
interactive.

will post again.

Baoquan
Thanks a lot

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

* Re: [PATCH 2/2] let user specify action after systemd start dracut-emergency
       [not found]             ` <51A5A828.5040700-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2013-05-29  8:54               ` Harald Hoyer
       [not found]                 ` <51A5C256.6070107-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Harald Hoyer @ 2013-05-29  8:54 UTC (permalink / raw)
  To: Baoquan; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

On 05/29/2013 09:03 AM, Baoquan wrote:
> On 05/29/2013 02:43 PM, Baoquan wrote:
> 
>>> If failed to mount /sysroot, triggering OnFailure= dependencies
>>>> of initrd-xxx.service, then dracut-emergency will be started by
>>>> systemd and enter into emergency shell.
>>>>
>>>> Here use action_on_fail to replace "exec sh -i -l" in
>>>> dracut-emergency.sh so that it may continue if user specify
>>>> "action_on_fail=continue" though mount root failed.
>>>>
>>>> Signed-off-by: Baoquan He <bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>>>> ---
>>>>  modules.d/98systemd/dracut-emergency.sh |    2 +-
>>>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>>>
>>>> diff --git a/modules.d/98systemd/dracut-emergency.sh b/modules.d/98systemd/dracut-emergency.sh
>>>> index 8ab045e..a4a10e6 100755
>>>> --- a/modules.d/98systemd/dracut-emergency.sh
>>>> +++ b/modules.d/98systemd/dracut-emergency.sh
>>>> @@ -30,7 +30,7 @@ if getargbool 1 rd.shell -d -y rdshell || getarg rd.break -d rdbreak; then
>>>>      echo
>>>>      [ -f /etc/profile ] && . /etc/profile
>>>>      [ -z "$PS1" ] && export PS1="$_name:\${PWD}# "
>>>> -    exec sh -i -l
>>>> +    ! action_on_fail "Systemd is starting emergency shell" && exec sh -i -l
>>
>>
>> ! action_on_fail "Systemd is starting emergency shell" && exec sh -i -l
>> ------->
>> action_on_fail "Systemd is starting emergency shell"
>>
> 
> Well, I was wrong. Looks like the dracut-emergency will hang there, not
> interactive.
> 
> will post again.
> 
> Baoquan
> Thanks a lot
> 

Does adding ConditionKernelCommandLine=!action_on_fail=continue to the [Unit]
section of dracut-emergency.service work for you?

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

* Re: [PATCH 2/2] let user specify action after systemd start dracut-emergency
       [not found]                 ` <51A5C256.6070107-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2013-05-29  9:15                   ` Baoquan
  0 siblings, 0 replies; 7+ messages in thread
From: Baoquan @ 2013-05-29  9:15 UTC (permalink / raw)
  To: Harald Hoyer; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

On 05/29/2013 04:54 PM, Harald Hoyer wrote:

>>> >>
>>> >> ! action_on_fail "Systemd is starting emergency shell" && exec sh -i -l
>>> >> ------->
>>> >> action_on_fail "Systemd is starting emergency shell"
>>> >>
>> > 
>> > Well, I was wrong. Looks like the dracut-emergency will hang there, not
>> > interactive.
>> > 
>> > will post again.
>> > 
>> > Baoquan
>> > Thanks a lot
>> > 
> Does adding ConditionKernelCommandLine=!action_on_fail=continue to the [Unit]
> section of dracut-emergency.service work for you?


It is also good. But I tried it just now, it didn't work. I don't know why.

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

* Re: [PATCH 1/2] 99fs-lib/fs-lib.sh: Let user specify the action after fail for fsck
       [not found] ` <078c160e62c2c750efe71fc8a05dd7c5de71bde3.1369809156.git.bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2013-05-29  6:33   ` [PATCH 2/2] let user specify action after systemd start dracut-emergency Baoquan He
@ 2013-05-30  6:28   ` Harald Hoyer
  1 sibling, 0 replies; 7+ messages in thread
From: Harald Hoyer @ 2013-05-30  6:28 UTC (permalink / raw)
  To: Baoquan He; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

On 05/29/2013 08:33 AM, Baoquan He wrote:
> The fsck is ignored when replace emergency_shell with action_on_fail,
> now add it.
> 
> Signed-off-by: Baoquan He <bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  modules.d/99fs-lib/fs-lib.sh |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/modules.d/99fs-lib/fs-lib.sh b/modules.d/99fs-lib/fs-lib.sh
> index e1f3074..88e7348 100755
> --- a/modules.d/99fs-lib/fs-lib.sh
> +++ b/modules.d/99fs-lib/fs-lib.sh
> @@ -7,14 +7,14 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
>  fsck_ask_reboot() {
>      info "note - fsck suggests reboot, if you"
>      info "leave shell, booting will continue normally"
> -    emergency_shell -n "(reboot ?)"
> +    action_on_fail -n "(reboot ?)"
>  }
>  
>  fsck_ask_err() {
>      warn "*** An error occurred during the file system check."
>      warn "*** Dropping you to a shell; the system will try"
>      warn "*** to mount the filesystem(s), when you leave the shell."
> -    emergency_shell -n "(Repair filesystem)"
> +    action_on_fail -n "(Repair filesystem)"
>  }
>  
>  # inherits: _ret _drv _out
> 

Applied, thanks!

commit 679fa7ed3c0f4c827bfc6885d34f56713fe85c1e

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

end of thread, other threads:[~2013-05-30  6:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-29  6:33 [PATCH 1/2] 99fs-lib/fs-lib.sh: Let user specify the action after fail for fsck Baoquan He
     [not found] ` <078c160e62c2c750efe71fc8a05dd7c5de71bde3.1369809156.git.bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-29  6:33   ` [PATCH 2/2] let user specify action after systemd start dracut-emergency Baoquan He
     [not found]     ` <d493350a355dc81998fd9a0b2d543ca79c2eb0c7.1369809156.git.bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-29  6:43       ` Baoquan
     [not found]         ` <51A5A3A2.8070403-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-29  7:03           ` Baoquan
     [not found]             ` <51A5A828.5040700-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-29  8:54               ` Harald Hoyer
     [not found]                 ` <51A5C256.6070107-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-29  9:15                   ` Baoquan
2013-05-30  6:28   ` [PATCH 1/2] 99fs-lib/fs-lib.sh: Let user specify the action after fail for fsck Harald Hoyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox