[PATCH] mkdumprd: allow spaces after 'path' config phrase when network dump
by Kazuhito Hagio
Without this patch, when there are two or more spaces after 'path'
configuration phrase with ssh or nfs setting, SAVE_PATH is set to
'/var/crash' in mkdumprd, and in most cases kdump service fails to
start.
ssh kdump(a)192.168.122.1
path /kdump
^^
This behavior would be too sensitive and different from the other
configurations. With this patch, mkdumprd allows such spaces.
Signed-off-by: Kazuhito Hagio <k-hagio(a)ab.jp.nec.com>
---
mkdumprd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mkdumprd b/mkdumprd
index a6f7fe8..aa0abfd 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -13,7 +13,7 @@ export IN_KDUMP=1
conf_file="/etc/kdump.conf"
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
-SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2)
+SAVE_PATH=$(awk '/^path/ {print $2}' $conf_file)
[ -z "$SAVE_PATH" ] && SAVE_PATH=$DEFAULT_PATH
# strip the duplicated "/"
SAVE_PATH=$(echo $SAVE_PATH | tr -s /)
--
2.18.0
1 year, 3 months
Re: [PATCH] kdump-error-handler.service: Remove ExecStopPost
by Kairui Song
On Wed, Nov 27, 2019 at 8:19 PM d.hatayama(a)fujitsu.com
<d.hatayama(a)fujitsu.com> wrote:
> > -----Original Message-----
> > From: Kairui Song [mailto:kasong@redhat.com]
> > Sent: Tuesday, November 26, 2019 3:05 PM
> > To: kexec(a)lists.fedoraproject.org
> > Cc: Hatayama, Daisuke/畑山 大輔 <d.hatayama(a)fujitsu.com>; Pingfan Liu
> > <piliu(a)redhat.com>; Dave Young <dyoung(a)redhat.com>; Kairui Song
> > <kasong(a)redhat.com>
> > Subject: [PATCH] kdump-error-handler.service: Remove ExecStopPost
> >
> > Currently "systemctl --fail --no-block default" will be executed on
> > kdump-error-handler exit due to the config ExecStopPost. This may makes
> > systemd try to isolate to the default target again, if both
> > final_action or failure_action failed to terminates the system.
> >
> > The execute chain will be like:
> >
> > initrd.target -> kdump.sh (failed) -> kdump-error-handler.service ->
> > failure_action -> final_action -> ExecStopPost (go to initrd.target again
> > and loop infinitely)
> >
> > Currently, reboot/shutdown/halt is guarenteen to be called by either
> > by executing failure_action or final_action. So the loop will be stopped.
> > However none of the reboot/shutdown/halt call is blocking so it might
> > have race issue, and this ExecStopPost config is not useful after all.
> >
> > Just drop the ExecStopPost to fix this potential issue.
> > ---
> > dracut-kdump-error-handler.service | 1 -
> > 1 file changed, 1 deletion(-)
> >
> > diff --git a/dracut-kdump-error-handler.service
> > b/dracut-kdump-error-handler.service
> > index 32b74ab..a23b75e 100644
> > --- a/dracut-kdump-error-handler.service
> > +++ b/dracut-kdump-error-handler.service
> > @@ -21,7 +21,6 @@ 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
> > --
> > 2.23.0
>
> [^[[0;32m OK ^[[0m] Started Setup Virtual Console.^M
> Starting Kdump Error Handler...^M
> Kdump: Executing failure action exit 0^M
> [^[[0;32m OK ^[[0m] Started Kdump Error Handler.^M
> [^[[0;32m OK ^[[0m] Started Journal Service.^M
> [ 12.857263] systemd[1]: Startup finished in 1.728s (kernel) + 0 (initrd) + 11.127s (userspace) = 12.856s.^M
> -- 1:d.hatayama@localhost:~ -- time-stamp -- Nov/27/19 7:15:34 --
>
> I tried to test with some artificial change to reproduce the issue
> and I see no infinite loop.
>
> Tested-by: HATAYAMA Daisuke <d.hatayama(a)fujitsu.com>
>
> The current behavior leads to hang finally, so maybe further
> improvement is to add service unit that runs systemctl reboot -ff
> or systemctl poweroff -ff that is started by a timer unit with
> OnBootSec=, for example.
>
Good suggestion, that could be done as an improvement later.
--
Best Regards,
Kairui Song
3 years, 9 months
[PATCH] kdump-error-handler.service: Remove ExecStopPost
by Kairui Song
Currently "systemctl --fail --no-block default" will be executed on
kdump-error-handler exit due to the config ExecStopPost. This may makes
systemd try to isolate to the default target again, if both
final_action or failure_action failed to terminates the system.
The execute chain will be like:
initrd.target -> kdump.sh (failed) -> kdump-error-handler.service ->
failure_action -> final_action -> ExecStopPost (go to initrd.target again
and loop infinitely)
Currently, reboot/shutdown/halt is guarenteen to be called by either
by executing failure_action or final_action. So the loop will be stopped.
However none of the reboot/shutdown/halt call is blocking so it might
have race issue, and this ExecStopPost config is not useful after all.
Just drop the ExecStopPost to fix this potential issue.
---
dracut-kdump-error-handler.service | 1 -
1 file changed, 1 deletion(-)
diff --git a/dracut-kdump-error-handler.service b/dracut-kdump-error-handler.service
index 32b74ab..a23b75e 100644
--- a/dracut-kdump-error-handler.service
+++ b/dracut-kdump-error-handler.service
@@ -21,7 +21,6 @@ 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
--
2.23.0
3 years, 9 months
[PATCH] module-setup.sh: No more false warning about squash module for fadump
by Kairui Song
Currently module-setup.sh will give a warning for disabling dracut
squash module for fadump, which is misleading. Don't print such warning.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
dracut-module-setup.sh | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index c7ac9e9..26d3c78 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -29,11 +29,12 @@ depends() {
fi
done
}
-
- if is_squash_available && ! is_fadump_capable; then
- _dep="$_dep squash"
- else
- dwarning "Required modules to build a squashed kdump image is missing!"
+ if ! is_fadump_capable; then
+ if is_squash_available; then
+ _dep="$_dep squash"
+ else
+ dwarning "Required modules to build a squashed kdump image is missing!"
+ fi
fi
if [ -n "$( find /sys/devices -name drm )" ] || [ -d /sys/module/hyperv_fb ]; then
--
2.23.0
3 years, 10 months
[PATCH] mkdumprd: greatly simplify dracut args parsing
by Kairui Song
Previously dracut_args is stored as an array in the shell code,
so we can just pass this array as argument to dracut.
But when trying to append new dracut argument, we have to manually
handle the quotes and spaces to ensure the appended argument is
splitted into array elements in the right way.
This is complex and hard to read or maintain. Instead, just store the
dracut_args as a plain string, and let xargs help parse it and call
dracut.
Simply passing $dracut_args or "$dracut_args" will either let dracut
consider the whole string as a single argument, or loss all the
quotes. xargs can handle it well and cover more corner cases.
Eg. one corner case before, if we have:
dracut_args --mount "/dev/sda1 /mnt/test xfs rw"
Kdump will fail, because the function add_dracut_arg() will wrongly
change the arguments into: (Notice the extra space.)
dracut_args --mount " /dev/sda1 /mnt/test xfs rw"
Instead of fixing it just use xargs instead. Tested with above config
and multiple other dracut_args values.
Resolves: bz1700136
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
mkdumprd | 45 +++++++++++----------------------------------
1 file changed, 11 insertions(+), 34 deletions(-)
diff --git a/mkdumprd b/mkdumprd
index aafd808..76ae7a0 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -17,6 +17,10 @@ SAVE_PATH=$(awk '/^path/ {print $2}' $conf_file)
[ -z "$SAVE_PATH" ] && SAVE_PATH=$DEFAULT_PATH
# strip the duplicated "/"
SAVE_PATH=$(echo $SAVE_PATH | tr -s /)
+OVERRIDE_RESETTABLE=0
+
+extra_modules=""
+dracut_args="--quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode strict -o \"plymouth dash resume ifcfg earlykdump\""
is_wdt_addition_needed() {
local active
@@ -32,40 +36,8 @@ is_wdt_addition_needed() {
return 1
}
-WDTCFG=""
-is_wdt_addition_needed
-[[ $? -eq 0 ]] && WDTCFG="-a watchdog"
-
-extra_modules=""
-dracut_args=("--quiet" "--hostonly" "--hostonly-cmdline" "--hostonly-i18n" "--hostonly-mode" "strict" "-o" "plymouth dash resume ifcfg earlykdump" $WDTCFG)
-OVERRIDE_RESETTABLE=0
-
add_dracut_arg() {
- local arg qarg is_quoted=0
- while [ $# -gt 0 ];
- do
- arg="${1//\'/\"}"
- #Handle quoted substring properly for passing it to dracut_args array.
- if [ $is_quoted -eq 0 ]; then
- if [[ "$arg" == "\"" ]] || [[ $arg != ${arg#\"} ]]; then
- is_quoted=1
- arg=${arg#\"}
- fi
- fi
- if [ $is_quoted -eq 1 ]; then
- qarg="$qarg $arg"
- if [[ "$arg" == "\"" ]] || [[ $arg != ${arg%\"} ]]; then
- is_quoted=0
- arg=${qarg%\"}
- qarg=""
- else
- shift
- continue
- fi
- fi
- dracut_args+=("$arg")
- shift
- done
+ dracut_args="$dracut_args $@"
}
add_dracut_module() {
@@ -390,6 +362,10 @@ if [ "$(uname -m)" = "s390x" ]; then
add_dracut_module "znet"
fi
+if is_wdt_addition_needed; then
+ add_dracut_arg "-a" "watchdog"
+fi
+
while read config_opt config_val;
do
# remove inline comments after the end of a directive.
@@ -463,7 +439,8 @@ if ! is_fadump_capable; then
add_dracut_arg "--no-hostonly-default-device"
fi
-dracut "${dracut_args[@]}" "$@"
+echo "$dracut_args $@" | xargs dracut
+
_rc=$?
sync
exit $_rc
--
2.23.0
3 years, 10 months
Re: [PATCH 1/3] dracut-kdump.sh: Execute the binary and script files
in /etc/kdump/{pre.d,post.d}.
by 'Dave Young'
On 11/22/19 at 04:27am, onitsuka.shinic(a)fujitsu.com wrote:
> > -----Original Message-----
> > From: Dave Young [mailto:dyoung@redhat.com]
> > Sent: Wednesday, November 13, 2019 6:44 PM
> > To: Onitsuka, Shinichi/鬼束 伸一 <onitsuka.shinic(a)fujitsu.com>
> > Cc: kexec(a)lists.fedoraproject.org
> > Subject: Re: [PATCH 1/3] dracut-kdump.sh: Execute the binary and script files in /etc/kdump/{pre.d,post.d}.
> >
> > On 11/06/19 at 04:25am, onitsuka.shinic(a)fujitsu.com wrote:
> > > This patch executes the binary and script files in /etc/kdump/{pre.d,post.d}
> > > just like kdump_pre or kdump_post directive written in /etc/kdump.conf.
> > >
> > > Signed-off-by: shin-onitsuka <onitsuka.shinic(a)fujitsu.com>
> > >
> > > ---
> > > dracut-kdump.sh | 36 ++++++++++++++++++++++++++++++++++++
> > > 1 file changed, 36 insertions(+)
> > >
> > > diff --git a/dracut-kdump.sh b/dracut-kdump.sh
> > > index 2ae1c7c..51a1f73 100755
> > > --- a/dracut-kdump.sh
> > > +++ b/dracut-kdump.sh
> > > @@ -30,15 +30,51 @@ do_dump()
> > >
> > > do_kdump_pre()
> > > {
> > > + local _ret
> > > +
> > > if [ -n "$KDUMP_PRE" ]; then
> > > "$KDUMP_PRE"
> > > + _ret=$?
> > > + if [ $_ret -ne 0 ]; then
> > > + echo "kdump: $KDUMP_PRE exited with $_ret status"
> > > + return $_ret
> > > + fi
> > > + fi
> > > +
> > > + if [ -d /etc/kdump/pre.d ]; then
> > > + for file in `find /etc/kdump/pre.d -type f | sort`; do
> >
> > Since there are no convention here about the order of those files under
> > /etc/kdump/pre.d, there could be risk with just a 'sort'?
> >
> > If in the future one want to add a new pre/post script/binary to be run
> > after some specific files existed, then there is no way to do that
> > reliably.
> >
> > I have no better idea than the dracut ways with some prefix like 01, 02,
> > etc, maybe something better can be introduced?
>
>
> I'm sorry for my late response.
> I don't understand the risk that you thought.
>
> Please tell me the concrete example of the risk.
I have no concrete example, but since the mutiple pre scripts introduced
here we should consider the order of them. make some convention
for example to document that the pre.d/* runs in alphabet order or add
some prefix like 00, 01..
In another word, at least should document about the running order is the
same as the result of the command "sort"
Thanks
Dave
3 years, 10 months
Re: [PATCH 1/3] dracut-kdump.sh: Execute the binary and script files
in /etc/kdump/{pre.d,post.d}.
by Dave Young
On 11/06/19 at 04:25am, onitsuka.shinic(a)fujitsu.com wrote:
> This patch executes the binary and script files in /etc/kdump/{pre.d,post.d}
> just like kdump_pre or kdump_post directive written in /etc/kdump.conf.
>
> Signed-off-by: shin-onitsuka <onitsuka.shinic(a)fujitsu.com>
>
> ---
> dracut-kdump.sh | 36 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 36 insertions(+)
>
> diff --git a/dracut-kdump.sh b/dracut-kdump.sh
> index 2ae1c7c..51a1f73 100755
> --- a/dracut-kdump.sh
> +++ b/dracut-kdump.sh
> @@ -30,15 +30,51 @@ do_dump()
>
> do_kdump_pre()
> {
> + local _ret
> +
> if [ -n "$KDUMP_PRE" ]; then
> "$KDUMP_PRE"
> + _ret=$?
> + if [ $_ret -ne 0 ]; then
> + echo "kdump: $KDUMP_PRE exited with $_ret status"
> + return $_ret
> + fi
> + fi
> +
> + if [ -d /etc/kdump/pre.d ]; then
> + for file in `find /etc/kdump/pre.d -type f | sort`; do
Since there are no convention here about the order of those files under
/etc/kdump/pre.d, there could be risk with just a 'sort'?
If in the future one want to add a new pre/post script/binary to be run
after some specific files existed, then there is no way to do that
reliably.
I have no better idea than the dracut ways with some prefix like 01, 02,
etc, maybe something better can be introduced?
> + "$file"
> + _ret=$?
> + if [ $_ret -ne 0 ]; then
> + echo "kdump: $file exited with $_ret status"
> + return $_ret
> + fi
> + done
> fi
> }
>
> do_kdump_post()
> {
> + local _ret
> +
> + if [ -d /etc/kdump/post.d ]; then
> + for file in `find /etc/kdump/post.d -type f | sort`; do
> + "$file" "$1"
> + _ret=$?
> + if [ $_ret -ne 0 ]; then
> + echo "kdump: $file exited with $_ret status"
> + return $_ret
> + fi
> + done
> + fi
> +
> if [ -n "$KDUMP_POST" ]; then
> "$KDUMP_POST" "$1"
> + _ret=$?
> + if [ $_ret -ne 0 ]; then
> + echo "kdump: $KDUMP_POST exited with $_ret status"
> + return $_ret
> + fi
> fi
> }
>
> --
> 1.8.3.1
> _______________________________________________
> kexec mailing list -- kexec(a)lists.fedoraproject.org
> To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org
> Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org
Thanks
Dave
3 years, 10 months
[PATCH] kdump-lib: switch to the kexec_file_load() syscall on x86_64 by default
by Lianbo Jiang
Currently, kernel enabled the kexec_file_load() syscall on x86_64
by default, so lets align it for kexec tools.
Signed-off-by: Lianbo Jiang <lijiang(a)redhat.com>
---
kdump-lib.sh | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index f393c76b9cbb..89cb08850924 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -598,10 +598,18 @@ need_64bit_headers()
# is 1 and SetupMode is 0, then secure boot is being enforced.
#
# Assume efivars is mounted at /sys/firmware/efi/efivars.
+#
+# Currently, kernel enabled the kexec_file_load on x86_64 by default, so
+# lets align it.
is_secure_boot_enforced()
{
local secure_boot_file setup_mode_file
local secure_boot_byte setup_mode_byte
+ local arch_name=`uname -m`
+
+ if [ "$arch_name" == "x86_64" ]; then
+ return 0
+ fi
secure_boot_file=$(find /sys/firmware/efi/efivars -name SecureBoot-* 2>/dev/null)
setup_mode_file=$(find /sys/firmware/efi/efivars -name SetupMode-* 2>/dev/null)
--
2.17.1
3 years, 10 months
RE: [PATCH 3/3] dracut-module-setup.sh: Install files under
/etc/kdump/{pre.d,post.d} into kdump initramfs
by d.hatayama@fujitsu.com
> -----Original Message-----
> From: d.hatayama(a)fujitsu.com [mailto:d.hatayama@fujitsu.com]
> Sent: Wednesday, November 13, 2019 6:40 PM
> To: Onitsuka, Shinichi/鬼束 伸一 <onitsuka.shinic(a)fujitsu.com>
> Cc: kexec(a)lists.fedoraproject.org; 'Kairui Song' <kasong(a)redhat.com>
> Subject: RE: [PATCH 3/3] dracut-module-setup.sh: Install files under
> /etc/kdump/{pre.d,post.d} into kdump initramfs
>
>
>
> > -----Original Message-----
> > From: Kairui Song [mailto:kasong@redhat.com]
> > Sent: Tuesday, November 12, 2019 6:08 PM
> > To: Onitsuka, Shinichi/鬼束 伸一 <onitsuka.shinic(a)fujitsu.com>
> > Cc: kexec(a)lists.fedoraproject.org
> > Subject: Re: [PATCH 3/3] dracut-module-setup.sh: Install files under
> > /etc/kdump/{pre.d,post.d} into kdump initramfs
> >
> > On Wed, Nov 6, 2019 at 12:28 PM onitsuka.shinic(a)fujitsu.com
> > <onitsuka.shinic(a)fujitsu.com> wrote:
> > >
> > > This patch installs the binary and script files under
> > /etc/kdump/{pre.d,post.d} into
> > > new initramfs of kdump.
> > >
> > > Signed-off-by: shin-onitsuka <onitsuka.shinic(a)fujitsu.com>
> > >
> > > ---
> > > dracut-module-setup.sh | 20 ++++++++++++++++++++
> > > 1 file changed, 20 insertions(+)
> > >
> > > diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
> > > index b186b38..414a184 100755
> > > --- a/dracut-module-setup.sh
> > > +++ b/dracut-module-setup.sh
> > > @@ -530,6 +530,8 @@ kdump_install_conf() {
> > > esac
> > > done <<< "$(read_strip_comments /etc/kdump.conf)"
> > >
> > > + kdump_install_preafter_conf
> > > +
> > > default_dump_target_install_conf
> > >
> > > kdump_configure_fence_kdump "${initdir}/tmp/$$-kdump.conf"
> > > @@ -537,6 +539,24 @@ kdump_install_conf() {
> > > rm -f ${initdir}/tmp/$$-kdump.conf
> > > }
> > >
> > > +# install etc/kdump/pre.d and /etc/kdump/post.d
> > > +kdump_install_preafter_conf() {
> > > + if [ -d /etc/kdump/pre.d ]; then
> > > + for file in `find /etc/kdump/pre.d`; do
> >
> > Same as in 2/3, I think it's better to find only script files with
> > executable permission.
> >
> > > + dracut_install $file
> > > + done
> > > + fi
> > > +
> > > + if [ -d /etc/kdump/post.d ]; then
> > > + for file in `find /etc/kdump/post.d`; do
> > > + dracut_install $file
> > > + done
> > > + fi
> > > +
> > > + dracut_install /usr/bin/find
> > > + dracut_install /usr/bin/sort
> >
> > If doable, I prefer to introduce as less binary as possible in the initramfs.
> > This will make find and sort always included in the initramfs, even if
> > there is no pre/post executable. Which may increase the initrmafs
> > size unnecessarily.
>
> Again, comment in similar direction with the Kairui's.
> find command is unnecessary here.
> Pattern matching in bash seems enough just like:
>
> if [ -d /etc/kdump/post.d ]; then
> for file in /etc/kdump/post.d/*; do
> if [ -x "$file" ]; then
> dracut_install $file
> fi
> done
> fi
>
sort command is also unnecessary.
Bash's pattern matching expands files in the alphabetical order.
Quoted from man 1 bash:
Pathname Expansion
After word splitting, unless the -f option has been set,
bash scans each word for the characters *, ?, and [. If one
of these characters appears, then the word is regarded as a
pattern, and replaced with an alphabetically sorted list of
filenames matching the pattern (see Pattern Matching below).
/etc/rc.d/rc in initscripts package relies on this:
https://github.com/fedora-sysv/initscripts/blob/164d1ede7161233a2a2fe6e4c...
> >
> >
> > > +}
> > > +
> > > # Default sysctl parameters should suffice for kdump kernel.
> > > # Remove custom configurations sysctl.conf & sysctl.d/*
> > > remove_sysctl_conf() {
> > > --
> > > 1.8.3.1
> > > _______________________________________________
> > > kexec mailing list -- kexec(a)lists.fedoraproject.org
> > > To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org
> > > Fedora Code of Conduct:
> > https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> > > List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> > > List Archives:
> >
> https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.or
> > g
> >
> > --
> > Best Regards,
> > Kairui Song
> > _______________________________________________
> > kexec mailing list -- kexec(a)lists.fedoraproject.org
> > To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org
> > Fedora Code of Conduct:
> > https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> > List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> > List Archives:
> >
> https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.or
> > g
> _______________________________________________
> kexec mailing list -- kexec(a)lists.fedoraproject.org
> To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org
> Fedora Code of Conduct:
> https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives:
> https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.or
> g
3 years, 10 months
RE: [PATCH 3/3] dracut-module-setup.sh: Install files under
/etc/kdump/{pre.d,post.d} into kdump initramfs
by d.hatayama@fujitsu.com
> -----Original Message-----
> From: onitsuka.shinic(a)fujitsu.com [mailto:onitsuka.shinic@fujitsu.com]
> Sent: Wednesday, November 6, 2019 1:28 PM
> To: kexec(a)lists.fedoraproject.org
> Subject: [PATCH 3/3] dracut-module-setup.sh: Install files under
> /etc/kdump/{pre.d,post.d} into kdump initramfs
>
> This patch installs the binary and script files under
> /etc/kdump/{pre.d,post.d} into
> new initramfs of kdump.
>
> Signed-off-by: shin-onitsuka <onitsuka.shinic(a)fujitsu.com>
>
> ---
> dracut-module-setup.sh | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
> index b186b38..414a184 100755
> --- a/dracut-module-setup.sh
> +++ b/dracut-module-setup.sh
> @@ -530,6 +530,8 @@ kdump_install_conf() {
> esac
> done <<< "$(read_strip_comments /etc/kdump.conf)"
>
> + kdump_install_preafter_conf
> +
> default_dump_target_install_conf
>
> kdump_configure_fence_kdump "${initdir}/tmp/$$-kdump.conf"
> @@ -537,6 +539,24 @@ kdump_install_conf() {
> rm -f ${initdir}/tmp/$$-kdump.conf
> }
>
> +# install etc/kdump/pre.d and /etc/kdump/post.d
> +kdump_install_preafter_conf() {
> + if [ -d /etc/kdump/pre.d ]; then
> + for file in `find /etc/kdump/pre.d`; do
> + dracut_install $file
I'm concerned when users put symblic link files under /etc/kdump/pre.d direcotry.
Maybe, only symbolic-link files are included into the kdump initramfs?
As below, there is inst_symlink() in /usr/lib/dracut/dracut-init.sh, and
so I guess it would at least be OK if we use inst_symlink, but
install_multiple() could handle symbolic-link files appropreately.
Could you check the behavior?
inst_symlink() {
local _hostonly_install
if [[ "$1" == "-H" ]]; then
_hostonly_install="-H"
shift
fi
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
[[ -L $1 ]] || return 1
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
}
inst_multiple() {
local _ret
$DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
_ret=$?
(($_ret != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
return $_ret
}
dracut_install() {
inst_multiple "$@"
}
> + done
> + fi
> +
> + if [ -d /etc/kdump/post.d ]; then
> + for file in `find /etc/kdump/post.d`; do
> + dracut_install $file
> + done
> + fi
> +
> + dracut_install /usr/bin/find
> + dracut_install /usr/bin/sort
> +}
> +
> # Default sysctl parameters should suffice for kdump kernel.
> # Remove custom configurations sysctl.conf & sysctl.d/*
> remove_sysctl_conf() {
> --
> 1.8.3.1
> _______________________________________________
> kexec mailing list -- kexec(a)lists.fedoraproject.org
> To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org
> Fedora Code of Conduct:
> https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives:
> https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.or
> g
3 years, 10 months