Re: [PATCH 3/4] kdumpctl: Check the update of the binary and script
files in /etc/kdump/{pre.d,post.d}
by piliu
On 05/04/2020 09:06 AM, onitsuka.shinic(a)fujitsu.com wrote:
> This patch checks the update of the binary and script files in
> /etc/kdump/{pre.d,post.d} for initramfs of kdump.
> When kdumpd service is started or restarted, initramfs of kdump is recreated
> by new the binary and script files, if the binary and script files in
> /etc/kdump/{pre.d,post.d} are updated.
Sorry, but the commit log is a little misleading.
This patch just adds the pre/post in modified checklist, not do the
updating check by itself.
For the code part, it looks good to me.
Thanks,
Pingfan
>
> Signed-off-by: Shinichi Onitsuka <onitsuka.shinic(a)fujitsu.com>
> ---
> kdumpctl | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/kdumpctl b/kdumpctl
> index 2da3846..ef2926d 100755
> --- a/kdumpctl
> +++ b/kdumpctl
> @@ -339,9 +339,23 @@ check_files_modified()
>
> EXTRA_BINS=`grep ^kdump_post $KDUMP_CONFIG_FILE | cut -d\ -f2`
> CHECK_FILES=`grep ^kdump_pre $KDUMP_CONFIG_FILE | cut -d\ -f2`
> + if [ -d /etc/kdump/post.d ]; then
> + for file in /etc/kdump/post.d/*; do
> + if [ -x "$file" ]; then
> + POST_FILES="$POST_FILES $file"
> + fi
> + done
> + fi
> + if [ -d /etc/kdump/pre.d ]; then
> + for file in /etc/kdump/pre.d/*; do
> + if [ -x "$file" ]; then
> + PRE_FILES="$PRE_FILES $file"
> + fi
> + done
> + fi
> CORE_COLLECTOR=`grep ^core_collector $KDUMP_CONFIG_FILE | cut -d\ -f2`
> CORE_COLLECTOR=`type -P $CORE_COLLECTOR`
> - EXTRA_BINS="$EXTRA_BINS $CHECK_FILES"
> + EXTRA_BINS="$EXTRA_BINS $CHECK_FILES $POST_FILES $PRE_FILES"
> CHECK_FILES=`grep ^extra_bins $KDUMP_CONFIG_FILE | cut -d\ -f2-`
> EXTRA_BINS="$EXTRA_BINS $CHECK_FILES"
> files="$KDUMP_CONFIG_FILE $kdump_kernel $EXTRA_BINS $CORE_COLLECTOR"
>
3 years, 10 months
Re: [PATCH 2/4] dracut-module-setup.sh: Install files under
/etc/kdump/{pre.d,post.d} into kdump initramfs
by piliu
On 05/04/2020 09:05 AM, 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: Shinichi Onitsuka <onitsuka.shinic(a)fujitsu.com>
> ---
> dracut-module-setup.sh | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
> index 7a2c7b4..bad60f2 100755
> --- a/dracut-module-setup.sh
> +++ b/dracut-module-setup.sh
> @@ -521,6 +521,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"
> @@ -528,6 +530,29 @@ kdump_install_conf() {
> rm -f ${initdir}/tmp/$$-kdump.conf
> }
>
> +# install etc/kdump/pre.d and /etc/kdump/post.d
> +kdump_install_preafter_conf() {
It is a little hard to name properly, but "_pre_post_" is better. Or
anything else?
Thanks,
Pingfan
> + if [ -d /etc/kdump/pre.d ]; then
> + for file in /etc/kdump/pre.d/*; do
> + if [ -x "$file" ]; then
> + dracut_install $file
> + else
> + echo "$file is not executable"
> + fi
> + done
> + fi
> +
> + if [ -d /etc/kdump/post.d ]; then
> + for file in /etc/kdump/post.d/*; do
> + if [ -x "$file" ]; then
> + dracut_install $file
> + else
> + echo "$file is not executable"
> + fi
> + done
> + fi
> +}
> +
> # Remove user custom configurations sysctl.conf & sysctl.d/*
> # and apply some optimization for kdump
> overwrite_sysctl_conf() {
>
3 years, 10 months
[PATCH] kdump.sysconfig: Remove the option 'log_buf_len' from kdump command line
by Lianbo Jiang
The option 'log_buf_len' in the kernel command line will make kernel
dynamically allocate memory (system ram) from memblock and always hold
the memory allocated. If the size of this option is misused such as
'log_buf_len=64M'. This may cause a short of memory for kdump kernel,
because the size of memory is usually limited in kdump kernel.
In order to avoid this problem, need to remove this option from the
kdump kernel command line.
Signed-off-by: Lianbo Jiang <lijiang(a)redhat.com>
---
kdump.sysconfig | 2 +-
kdump.sysconfig.aarch64 | 2 +-
kdump.sysconfig.i386 | 2 +-
kdump.sysconfig.ppc64 | 2 +-
kdump.sysconfig.ppc64le | 2 +-
kdump.sysconfig.s390x | 2 +-
kdump.sysconfig.x86_64 | 2 +-
7 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/kdump.sysconfig b/kdump.sysconfig
index df518d64afd8..7c5641a6d8ac 100644
--- a/kdump.sysconfig
+++ b/kdump.sysconfig
@@ -17,7 +17,7 @@ KDUMP_COMMANDLINE=""
# This variable lets us remove arguments from the current kdump commandline
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
# NOTE: some arguments such as crashkernel will always be removed
-KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet"
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
diff --git a/kdump.sysconfig.aarch64 b/kdump.sysconfig.aarch64
index d5d762436eca..cbe611869e65 100644
--- a/kdump.sysconfig.aarch64
+++ b/kdump.sysconfig.aarch64
@@ -17,7 +17,7 @@ KDUMP_COMMANDLINE=""
# This variable lets us remove arguments from the current kdump commandline
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
# NOTE: some arguments such as crashkernel will always be removed
-KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet"
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
diff --git a/kdump.sysconfig.i386 b/kdump.sysconfig.i386
index c31a8cbe3077..61d940718c66 100644
--- a/kdump.sysconfig.i386
+++ b/kdump.sysconfig.i386
@@ -17,7 +17,7 @@ KDUMP_COMMANDLINE=""
# This variable lets us remove arguments from the current kdump commandline
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
# NOTE: some arguments such as crashkernel will always be removed
-KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet"
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
diff --git a/kdump.sysconfig.ppc64 b/kdump.sysconfig.ppc64
index 1f954521fd6d..6c091a74a74f 100644
--- a/kdump.sysconfig.ppc64
+++ b/kdump.sysconfig.ppc64
@@ -17,7 +17,7 @@ KDUMP_COMMANDLINE=""
# This variable lets us remove arguments from the current kdump commandline
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
# NOTE: some arguments such as crashkernel will always be removed
-KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet"
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
diff --git a/kdump.sysconfig.ppc64le b/kdump.sysconfig.ppc64le
index 1f954521fd6d..6c091a74a74f 100644
--- a/kdump.sysconfig.ppc64le
+++ b/kdump.sysconfig.ppc64le
@@ -17,7 +17,7 @@ KDUMP_COMMANDLINE=""
# This variable lets us remove arguments from the current kdump commandline
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
# NOTE: some arguments such as crashkernel will always be removed
-KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet"
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
diff --git a/kdump.sysconfig.s390x b/kdump.sysconfig.s390x
index abd45a2f332d..958eb8f24ca3 100644
--- a/kdump.sysconfig.s390x
+++ b/kdump.sysconfig.s390x
@@ -17,7 +17,7 @@ KDUMP_COMMANDLINE=""
# This variable lets us remove arguments from the current kdump commandline
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
# NOTE: some arguments such as crashkernel will always be removed
-KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet"
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
diff --git a/kdump.sysconfig.x86_64 b/kdump.sysconfig.x86_64
index a43a97062500..95a26a4d0833 100644
--- a/kdump.sysconfig.x86_64
+++ b/kdump.sysconfig.x86_64
@@ -17,7 +17,7 @@ KDUMP_COMMANDLINE=""
# This variable lets us remove arguments from the current kdump commandline
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
# NOTE: some arguments such as crashkernel will always be removed
-KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet"
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
--
2.17.1
3 years, 10 months
[PATCH v2] Introduce get_kdump_mntpoint_from_target and fix duplicated /
by Kairui Song
User a helper to get the path to mount dump target in kdump kernel, and
fix duplicated '/' in the mount path problem.
Fixes: bz1785371
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
kdump-lib.sh | 19 +++++++++++++++++++
kdumpctl | 7 +------
mkdumprd | 20 +++++---------------
3 files changed, 25 insertions(+), 21 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index b079f27..2157c34 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -258,6 +258,25 @@ get_mntpoint_from_target()
findmnt -k -f -n -r -o TARGET --source $1
}
+# Get the path where the target will be mounted in kdump kernel
+# $1: kdump target device
+get_kdump_mntpoint_from_target()
+{
+ local _mntpoint=$(get_mntpoint_from_target $1)
+
+ # mount under /sysroot if dump to root disk or mount under
+ # /kdumproot/$_mntpoint in other cases in 2nd kernel. systemd
+ # will be in charge to umount it.
+ if [ "$_mntpoint" = "/" ];then
+ _mntpoint="/sysroot"
+ else
+ _mntpoint="/kdumproot/$_mntpoint"
+ fi
+
+ # strip duplicated "/"
+ echo $_mntpoint | tr -s "/"
+}
+
# get_option_value <option_name>
# retrieves value of option defined in kdump.conf
get_option_value() {
diff --git a/kdumpctl b/kdumpctl
index fb264c3..081720e 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -480,12 +480,7 @@ check_dump_fs_modified()
return 2
fi
- if [[ "$_target" = "$(get_root_fs_device)" ]]; then
- _new_mntpoint="/sysroot"
- else
- _new_mntpoint="/kdumproot/$(get_mntpoint_from_target $_target)"
- fi
-
+ _new_mntpoint="$(get_kdump_mntpoint_from_target $_target)"
_dracut_args=$(lsinitrd $TARGET_INITRD -f usr/lib/dracut/build-parameter.txt)
if [[ -z "$_dracut_args" ]];then
echo "Warning: No dracut arguments found in initrd"
diff --git a/mkdumprd b/mkdumprd
index 35f5eed..f3e9336 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -51,21 +51,12 @@ add_dracut_sshkey() {
# caller should ensure $1 is valid and mounted in 1st kernel
to_mount() {
- local _dev=$1 _source _target _fstype _options _mntopts _pdev
+ local _dev=$1 _source _new_mntpoint _fstype _options _mntopts _pdev
_source=$(findmnt -k -f -n -r -o SOURCE $_dev)
- _target=$(get_mntpoint_from_target $_dev)
- # mount under /sysroot if dump to root disk or mount under
- #/kdumproot/$_target in other cases in 2nd kernel. systemd
- #will be in charge to umount it.
-
- if [ "$_target" = "/" ];then
- _target="/sysroot"
- else
- _target="/kdumproot/$_target"
- fi
-
_fstype=$(findmnt -k -f -n -r -o FSTYPE $_dev)
+ _new_mntpoint=$(get_kdump_mntpoint_from_target $_dev)
+
[[ -e /etc/fstab ]] && _options=$(findmnt --fstab -f -n -r -o OPTIONS $_dev)
if [ -z "$_options" ]; then
_options=$(findmnt -k -f -n -r -o OPTIONS $_dev)
@@ -85,14 +76,13 @@ to_mount() {
# only mount the dump target when needed.
_options="$_options,noauto"
- _mntopts="$_target $_fstype $_options"
- #for non-nfs _dev converting to use udev persistent name
+ _mntopts="$_new_mntpoint $_fstype $_options"
+ # for non-nfs _dev converting to use udev persistent name
if [ -b "$_source" ]; then
_pdev="$(get_persistent_dev $_source)"
if [ -z "$_pdev" ]; then
return 1
fi
-
else
_pdev=$_dev
fi
--
2.25.3
3 years, 10 months
Re: [PATCH 1/4] kdump.conf: Specify /etc/kdump/{pre.d,post.d} interface
by Kairui Song
On Mon, May 4, 2020 at 9:04 AM onitsuka.shinic(a)fujitsu.com
<onitsuka.shinic(a)fujitsu.com> wrote:
>
> This patch discribe /etc/kdump/{pre.d,post.d} interface.
>
> Signed-off-by: Shinichi Onitsuka <onitsuka.shinic(a)fujitsu.com>
> ---
> kdump.conf | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
Hi, there are some minor problems:
>
> diff --git a/kdump.conf b/kdump.conf
> index 1f0fc2d..e2e8c54 100644
> --- a/kdump.conf
> +++ b/kdump.conf
> @@ -79,13 +79,23 @@
> # or script after the vmcore dump process terminates.
> # The exit status of the current dump process is fed to
> # the executable binary or script as its first argument.
> +# If /etc/kdump/post.d directory is exist, All files in
> +# the directory are collectively sorted and executed in
> +# lexical order, before binary or script specified
> +# kdump_post parameter is executed.
> #
> # kdump_pre <binary | script>
> # - Works like the "kdump_post" directive, but instead of running
> # after the dump process, runs immediately before it.
> # Exit status of this binary is interpreted as follows:
> -# 0 - continue with dump process as usual
> -# non 0 - reboot the system
> +# 0 - continue with dump process as usual
> +# non 0 - reboot the system
> +# If /etc/kdump/pre.d directory is exist, All files in
I think "If /etc/kdump/pre.d directory exists, all files in"... looks better.
> +# the directory are collectively sorted and executed in
> +# lexical order, after binary or script specified
> +# kdump_pre parameter is executed.
> +# Even if the binary or script in /etc/kdump/pre.d directory
> +# returns non 0 exit status, the processing is continued.
> #
> # extra_bins <binaries | shell scripts>
> # - This directive allows you to specify additional binaries or
Also, I think it's better to move the doc commit after the code change.
> --
> 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
--
Best Regards,
Kairui Song
3 years, 10 months
[PATCH] fadump: update fadump-howto.txt with some more
troubleshooting help
by Hari Bathini
On journaling filesystems like XFS, bootloader is likely to pick up
older initrd (without vmcore capture scripts) if system crashes right
after initrd update, as the bootloader (read GRUB) may not replay
filesystem log before reading the initrd from disk. Added steps to
workaround that problem.
Signed-off-by: Hari Bathini <hbathini(a)linux.ibm.com>
---
fadump-howto.txt | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/fadump-howto.txt b/fadump-howto.txt
index 89675a1..c891e37 100644
--- a/fadump-howto.txt
+++ b/fadump-howto.txt
@@ -129,8 +129,24 @@ Then, start up kdump as well:
This should turn on the firmware assisted functionality in kernel by
echo'ing 1 to /sys/kernel/fadump_registered, leaving the system ready
-to capture a vmcore upon crashing. To test this out, you can force-crash
-your system by echo'ing a c into /proc/sysrq-trigger:
+to capture a vmcore upon crashing. For journaling filesystems like XFS an
+additional step is required to ensure bootloader does not pick the
+older initrd (without vmcore capture scripts):
+
+ * If /boot is a separate partition, run the below commands as the root user,
+ or as a user with CAP_SYS_ADMIN rights:
+
+ # fsfreeze -f
+ # fsfreeze -u
+
+ * If /boot is not a separate partition, reboot the system.
+
+After reboot check if the kdump service is up and running with:
+
+ # systemctl status kdump.service
+
+To test out whether FADump is configured properly, you can force-crash your
+system by echo'ing a 'c' into /proc/sysrq-trigger:
# echo c > /proc/sysrq-trigger
3 years, 10 months
Re: [PATCH v2] Append both nofail and x-systemd.before to kdump mount target
by Kairui Song
Thanks for the test! That warning is expected and we can't avoid that
unless the underlying bug is fixed, but we really need to revert the
previous workaround which is failing NFSv3 (maybe multipath/FCoE or
any other target that require extra services), I'll backport them to
RHEL then.
On Fri, May 15, 2020 at 2:42 AM HAGIO KAZUHITO(萩尾 一仁)
<k-hagio-ab(a)nec.com> wrote:
>
> > -----Original Message-----
> > Hi, Kazu,
> >
> > You commented on my previous patch 'Partially Revert "Don't mount the
> > dump target unless needed"'
> > that patch is failing in RHEL for the vfs issue, could you help have a
> > try of this new workaround?
> >
> > There might be still a warning but it should not fail kdump.
> >
> > I got following log in my test:
> >
> > [ 8.723761] systemd[1]: kdumproot-mnt-nfs.mount: Mount process
> > finished, but there is no mount.
> > [ 8.725684] systemd[1]: kdumproot-mnt-nfs.mount: Failed with result
> > 'protocol'.
> > [ 8.727500] systemd[1]: Failed to mount /kdumproot/mnt/nfs.
> > [FAILED] Failed to mount /kdumproot/mnt/nfs.
> > See 'systemctl status kdumproot-mnt-nfs.mount' for details.
> > [ 8.752847] systemd[1]: Started Reload Configuration from the Real Root.
> > [ OK ] Started Reload Configuration from the Real Root.
> > [ 8.756231] systemd[1]: Reached target Initrd File Systems.
> > [ OK ] Reached target Initrd File Systems.
> > [ 8.760391] systemd[1]: Reached target Initrd Default Target.
> > [ OK ] Reached target Initrd Default Target.
> > [ 8.764978] systemd[1]: Starting dracut pre-pivot and cleanup hook...
> > Starting dracut pre-pivot and cleanup hook...
> > [ OK ] Started dracut pre-pivot and cleanup hook.
> > Starting Kdump Vmcore Save Service...
> > [ 8.950571] systemd[1]: Started dracut pre-pivot and cleanup hook.
> > [ 8.952191] systemd[1]: Starting Kdump Vmcore Save Service...
> > kdump: dump target is 192.168.122.1:/srv/local/nfs
> > kdump: saving to
> > /kdumproot/mnt/nfs//var/crash/192.168.122.97-2020-05-13-04:53:56/
> > kdump: saving vmcore-dmesg.txt
> > kdump: saving vmcore-dmesg.txt complete
> > kdump: saving vmcore
> > Copying data : [100.0 %] \
> > eta: 0s
> > kdump: saving vmcore complete
> >
> > kdump works, despite there is an warning caused by the kernel vfs bug,
> > the warning will be gone after that bug is fixed.
>
> Hi Kairui,
>
> I've tried this patch replaced with "nofail,x-systemd.before=initrd-fs.target",
> and sometimes see the same "Failed to mount" messages above, but kdump works.
>
> Thanks!
> Kazu
>
> >
> >
> > On Wed, May 13, 2020 at 5:32 PM Kairui Song <kasong(a)redhat.com> wrote:
> > >
> > > By this point, there is still an unresolved vfs kernel issue that blocks
> > > systemd from mounting the dump target properly from time to time. To
> > > prevent systemd from failing by mounting the dump target, we can add
> > > nofail option to the kdump mount point.
> > >
> > > But adding nofail will wipe out default dependency of the mount point,
> > > see commit 94a7b43, so systemd randomize the order of calling kdump.sh
> > > and mounting the dump target and lead to unexpected behavior.
> > > However we can use x-systemd.before to ensure the mount is done
> > > in right order.
> > >
> > > In dracut-kdump-capture.service, we have "After=initrd.target",
> > > and look at dracut.bootup.7, systems start processing of fstab by
> > > initrd-fs.target, so set "After=initrd.target" could ensure the mount
> > > is ready before pre-pivot and kdump-capture service.
> > >
> > > Now with both nofail and x-systemd.before=initrd.target, systemd
> > > will try to mount the dump target before calling kdump, and even if the
> > > mount failed, kdump.sh will still be called and try to mount again. See
> > > dump_fs function, which will try to mount if the target is not mounted.
> > > Kdump will only fail if both mount attemp fails.
> > >
> > > Else if the kdump target mount failed or unstable, systemd will directly
> > > jump to kdump failure action, and kdump fails.
> > >
> > > This should improve the robustness in general with no other risk.
> > > ---
> > > mkdumprd | 3 +++
> > > 1 file changed, 3 insertions(+)
> > >
> > > diff --git a/mkdumprd b/mkdumprd
> > > index cedf536..7ab06fa 100644
> > > --- a/mkdumprd
> > > +++ b/mkdumprd
> > > @@ -83,6 +83,9 @@ to_mount() {
> > > # drop nofail or nobootwait
> > > _options=$(echo $_options | sed 's/\(^\|,\)nofail\($\|,\)/\1/g')
> > > _options=$(echo $_options | sed 's/\(^\|,\)nobootwait\($\|,\)/\1/g')
> > > + # use both nofail and x-systemd.before to ensure systemd will try best to
> > > + # mount it before kdump starts, this is an attempt to improve robustness
> > > + _options="$_options,nofail,x-systemd.before=initrd.target"
> > >
> > > _mntopts="$_target $_fstype $_options"
> > > #for non-nfs _dev converting to use udev persistent name
> > > --
> > > 2.26.2
> > >
> >
> >
> > --
> > 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.org
--
Best Regards,
Kairui Song
3 years, 10 months
[PATCH v2] Append both nofail and x-systemd.before to kdump mount target
by Kairui Song
By this point, there is still an unresolved vfs kernel issue that blocks
systemd from mounting the dump target properly from time to time. To
prevent systemd from failing by mounting the dump target, we can add
nofail option to the kdump mount point.
But adding nofail will wipe out default dependency of the mount point,
see commit 94a7b43, so systemd randomize the order of calling kdump.sh
and mounting the dump target and lead to unexpected behavior.
However we can use x-systemd.before to ensure the mount is done
in right order.
In dracut-kdump-capture.service, we have "After=initrd.target",
and look at dracut.bootup.7, systems start processing of fstab by
initrd-fs.target, so set "After=initrd.target" could ensure the mount
is ready before pre-pivot and kdump-capture service.
Now with both nofail and x-systemd.before=initrd.target, systemd
will try to mount the dump target before calling kdump, and even if the
mount failed, kdump.sh will still be called and try to mount again. See
dump_fs function, which will try to mount if the target is not mounted.
Kdump will only fail if both mount attemp fails.
Else if the kdump target mount failed or unstable, systemd will directly
jump to kdump failure action, and kdump fails.
This should improve the robustness in general with no other risk.
---
mkdumprd | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mkdumprd b/mkdumprd
index cedf536..7ab06fa 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -83,6 +83,9 @@ to_mount() {
# drop nofail or nobootwait
_options=$(echo $_options | sed 's/\(^\|,\)nofail\($\|,\)/\1/g')
_options=$(echo $_options | sed 's/\(^\|,\)nobootwait\($\|,\)/\1/g')
+ # use both nofail and x-systemd.before to ensure systemd will try best to
+ # mount it before kdump starts, this is an attempt to improve robustness
+ _options="$_options,nofail,x-systemd.before=initrd.target"
_mntopts="$_target $_fstype $_options"
#for non-nfs _dev converting to use udev persistent name
--
2.26.2
3 years, 10 months
[PATCH] Append both nofail and x-systemd.before to kdump mount target
by Kairui Song
By this point, there is still an unresolved vfs kernel issue that blocks
systemd from mounting the dump target properly from time to time. To
prevent systemd from failing by mounting the dump target, we can add
nofail option to the kdump mount point.
But adding nofail will wipe out default dependency of the mount point,
see commit 94a7b43, so systemd randomize the order of calling kdump.sh
and mounting the dump target and lead to unexpected behavior.
However we can use x-systemd.before to ensure the mount is done
in right order.
With both nofail and x-systemd.before=kdump-capture.service, systemd
will try to mount the dump target before calling kdump, and even if the
mount failed, kdump.sh still be called and try to mount again. See
dump_fs function, which will try to mount if the target is not mounted.
Kdump will only fail if both mount attemp fails.
Else if the kdump target mount failed or unstable, systemd will directly
jump to kdump failure action, and kdump fails.
This should improve the robustness in general with no other risk.
---
mkdumprd | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mkdumprd b/mkdumprd
index cedf536..26e71ba 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -83,6 +83,9 @@ to_mount() {
# drop nofail or nobootwait
_options=$(echo $_options | sed 's/\(^\|,\)nofail\($\|,\)/\1/g')
_options=$(echo $_options | sed 's/\(^\|,\)nobootwait\($\|,\)/\1/g')
+ # use both nofail and x-systemd.before to ensure systemd will try best to
+ # mount it before kdump starts, this is an attempt to improve robustness
+ _options="$_options,nofail,x-systemd.before=kdump-capture.service"
_mntopts="$_target $_fstype $_options"
#for non-nfs _dev converting to use udev persistent name
--
2.26.2
3 years, 10 months
Re: Design for kexec/kexec-load system service
by RuiRui Yang
Fix the list address.
On 05/12/20 at 12:10pm, Dave Young wrote:
> Hi Bhupesh,
>
> Thanks for raising up the topic.
> On 05/12/20 at 12:21am, Bhupesh Sharma wrote:
> > Hi All,
> >
> > Dave and I talked a bit last week about having a service for
> > kexec/kexec-load similar to what we have for kdump right now in
> > RHEL/Fedora (/usr/lib/systemd/system/kdump.service).
> > My plan is to enable it first in Fedora and then in RHEL-8.
> >
> > Now, similar two services 'kexec-load.service' and 'kexec.service'
> > also exist in other distribution(s) like Suse (see:
> > <https://documentation.suse.com/sles/15-SP1/html/SLES-all/cha-tuning-kexec...>
> > for example). I talked to a Suse guy privately today on IRC and he
> > mentioned the following steps they use on Suse to run kexec:
> >
> > To use Kexec, ensure the respective service is enabled and running:
> > > sudo systemctl enable kexec-load.service
> > > sudo systemctl start kexec-load.service
> >
> > > systemctl kexec (try rebooting into a new Kernel with Kexec)
> >
> > On our RHEL kexec-tools, we also seem to have a left-over 'kexec'
> > service, but it seems broken currently. See some logs from my arm64
> > board below:
> > [root@cav-sabre-cn99xx-01 ~]# systemctl kexec
> > Failed to open "/boot/efi/loader/loader.conf": No such file or directory
> > Failed to read boot config from "/boot/efi/loader/loader.conf": No
> > such file or directory
> > Failed to load bootspec config from "/boot/efi/loader": No such file
> > or directory
>
> It seems work fine on my x86 legacy vm.
>
> Actually we do not need to use systemctl kexec, just run "reboot" it
> will go to kexec path automatically.
>
> >
> > So, I am thinking to having two services (similar to Suse) for Fedora
> > and RHEL as well:
> > - One for kexec-load (i.e. kexec -l or kexec -l -s),
> > - Second for kexec'ing into 2nd kernel (i.e. kexec -e).
>
> The second one is up to systemd and installed by default so if we have
> any bugs just open to systemd then.
>
> >
> > I wanted to get more opinions from the team about this (having 2
> > services or 1, naming etc), before I send the first Fedora patch for
> > review
> > Here is some RFC code I have added so far:
> >
> > For the 1st RFC, I am thinking of having a simple service like (it
> > actually executes a new executable '/usr/sbin/kexecctl') :
> >
> > /usr/lib/systemd/system/kexec-load.service
> > ------------------------------------------------------------
> > [Unit]
> > Description=loads the kernel
> > Documentation=man:kexec(8)
> > DefaultDependencies=no
> > Before=shutdown.target umount.target final.target
> >
> > [Service]
> > Type=oneshot
> > ExecStart=/usr/sbin/kexecctl
>
> "kexectl"? and maybe also need some "start" "stop" "restart" "reload" etc
>
> >
> > [Install]
> > WantedBy=kexec.target
>
> The default behavior of systemctl kexec is
>
> * run kexec reboot in case kexec kernel loaded
> * otherwise just go to physical reboot
>
> So it is not strictly blocked by us:
> https://lists.freedesktop.org/archives/systemd-devel/2012-March/004764.html
>
> But there are above discussion we can refer to.
>
> >
> > A simple implementation of ''/usr/sbin/kexecctl' looks like this (we
> > can add further details as we go further):
> >
> > /usr/sbin/kexecctl:
> > -------------------------
> >
> > standard_kexec_args="-l"
>
> It would be good to use a sysconfig like kdump so that people can tune
> the args easily, eg.
>
> /etc/sysconfig/kexec
>
> > load_kexec()
> > {
> > KEXEC_ARGS=$(prepare_kexec_args "${KEXEC_ARGS}")
> >
> > if [ "$KEXEC_FILE_LOAD" == "on" ]; then
> > echo "Using kexec file based syscall."
> > KEXEC_ARGS="$KEXEC_ARGS -s"
> > fi
> >
> > $KEXEC $KEXEC_ARGS $standard_kexec_args \
> > --initrd=$TARGET_INITRD $kdump_kernel
> > if [ $? == 0 ]; then
> > echo "kexec: loaded kexec kernel"
> > return 0
> > else
> > echo "kexec: failed to load kexec kernel" >&2
> > if [ "$KEXEC_FILE_LOAD" == "on" ]; then
> > echo "kexec_file_load() failed, please try kexec_load()" >&2
> > fi
> > return 1
> > fi
> > }
> >
> > Please help me by sharing your comments.
> >
> > Thanks,
> > Bhupesh
> >
>
> Thanks
> Dave
3 years, 10 months