[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, 4 months
[PATCH] kdumpctl: make reload fail proof
by Hari Bathini
When large amount of memory, about 1TB, is removed with DLPAR memory
remove operation, kdump reload could fail due to race condition with
device tree property update. In such scenario, the subsequent kdump
reload requests would also fail as reload() only proceeds if current
load status is active. Since the possibility of this race condition
couldn't be wished away due to the nature of the scenario, workaround
it by proceeding to load even if current load status is not active as
long as kdump service is active, which kdump udev rules already check
for.
Signed-off-by: Hari Bathini <hbathini(a)linux.ibm.com>
---
kdumpctl | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 048e9f5..2d21a41 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -1116,8 +1116,7 @@ reload()
{
check_current_status
if [ $? -ne 0 ]; then
- echo "Kdump is not running: [WARNING]"
- return 0
+ echo "Kdump was not running: [WARNING]"
fi
if [ $DEFAULT_DUMP_MODE == "fadump" ]; then
3 years, 10 months
[PATCH] Don't execute final_action if failure_action terminates the system
by Kairui Song
If failure_action is shutdown/reboot/halt, final_action is pointless as
the system will be already stopping. And if final_action is different
from failure_action, it will trigger a systemd race problem and cause
unexpected behavior to occur.
So let the error handler stop and exit after performing failure_action
successfully if failure_action is one of shutdown/reboot/halt.
This way, final_action will not be executed.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
kdump-lib-initramfs.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index c409dce..8530556 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -56,13 +56,13 @@ get_kdump_confs()
FAILURE_ACTION="kdump_emergency_shell"
;;
reboot)
- FAILURE_ACTION="systemctl reboot -f"
+ FAILURE_ACTION="systemctl reboot -f && exit"
;;
halt)
- FAILURE_ACTION="halt"
+ FAILURE_ACTION="halt && exit"
;;
poweroff)
- FAILURE_ACTION="systemctl poweroff -f"
+ FAILURE_ACTION="systemctl poweroff -f && exit"
;;
dump_to_rootfs)
FAILURE_ACTION="dump_to_rootfs"
--
2.21.0
3 years, 10 months
Re: [PATCH] kdump-lib-initramfs.sh: use -f option for failure_action halt
by Kairui Song
On Wed, Oct 30, 2019 at 9:02 AM d.hatayama(a)fujitsu.com
<d.hatayama(a)fujitsu.com> wrote:
>
>
> > -----Original Message-----
> > From: Kairui Song [mailto:kasong@redhat.com]
> > Sent: Monday, October 28, 2019 5:29 PM
> > To: Hatayama, Daisuke/畑山 大輔 <d.hatayama(a)fujitsu.com>
> > Subject: Re: [PATCH] kdump-lib-initramfs.sh: use -f option for failure_action
> > halt
> >
> > On Mon, Oct 28, 2019 at 11:29 AM d.hatayama(a)fujitsu.com
> > <d.hatayama(a)fujitsu.com> wrote:
> > >
> > > failure_action halt doesn't work well now. This appears to be similar
> > > to the previous issues such as
> > > b2534348199ad5010c86890a068653d970c9933d and
> > > 89565289c64aa5323278cf5722c725a58b369af8.
> >
> > Hi,
> >
> > Thanks for the patch, it looks good to me in general, but can you add
> > more detail about the problem you are trying to solve?
> > Eg, add some word about the system behavior or some error logs. Like
> > in the two commits you mentioned.
>
> I see. I'll reflect your comment in the next version.
>
> I would write that there is a message indicating halt command is executed
> but actually system is reboot, not halted together with log message.
>
> Also I a little more looked into the behavior using debug message
> with systemd.log-leve=debug. It looks that systemd-halt.service
> is once pulled-in but it is somehow not executed and finally system
> is rebooted.
>
> systemd-udevd-control.socket: Changed listening -> dead
> systemd-udevd-control.socket: Job 100 systemd-udevd-control.socket/stop finished, result=done
>
> [^[[0;32m OK ^[[0m] Closed ^[[0;1;39mudev Control Socket^[[0m.
> Kdump: Executing failure action halt
>
> ^-- failure_action halt is executed
>
> Bus private-bus-connection: changing state UNSET → OPENING
> Bus private-bus-connection: changing state OPENING → AUTHENTICATING
> Accepted new private connection.
> Bus private-bus-connection: changing state AUTHENTICATING → RUNNING
> Got message type=method_call sender=n/a destination=org.freedesktop.systemd1 path=/org/freedesktop/systemd1 interface=org.freedesktop.systemd1.Manager member=StartUnit cookie=1 reply_cookie=0 signature=ss error-name=n/a error-message=n/\
> a
> halt.target: Trying to enqueue job halt.target/start/replace-irreversibly
>
> ^-- halt.target gets started being pulled-in here
>
> Added job halt.target/start to transaction.
> Pulling in systemd-halt.service/start from halt.target/start
> Added job systemd-halt.service/start to transaction.
> Pulling in shutdown.target/start from systemd-halt.service/start
> Added job shutdown.target/start to transaction.
> Pulling in dracut-cmdline.service/stop from shutdown.target/start
> Added job dracut-cmdline.service/stop to transaction.
> Pulling in cryptsetup.target/stop from shutdown.target/start
> Added job cryptsetup.target/stop to transaction.
> ...<snip>...
> squash-root.mount: squash-root.mount lost dependency After=dev-loop0.device
> squash-root.mount: squash-root.mount lost dependency References=dev-loop0.device
> squash-root.mount: Collecting.
> Child 400 (umount) died (code=exited, status=0/SUCCESS)
> etc.mount: Child 400 belongs to etc.mount.
> etc.mount: Mount process exited, code=exited, status=0/SUCCESS
> etc.mount: Succeeded.
> etc.mount: Changed unmounting -> dead
> etc.mount: Job 181 etc.mount/stop finished, result=done
> [^[[0;32m OK ^[[0m] Unmounted ^[[0;1;39m/etc^[[0m.
> etc.mount: Collecting.
> Received SIGCHLD from PID 400 (n/a).
> inotify event for /etc/localtime
> Failed to stat /etc/localtime, ignoring: No such file or directory
> /etc/localtime doesn't exist yet, watching /etc instead.
> Timezone has been changed (now: UTC).
> Bus private-bus-connection: changing state AUTHENTICATING → RUNNING
> Got message type=method_call sender=n/a destination=org.freedesktop.systemd1 path=/org/freedesktop/systemd1 interface=org.freedesktop.systemd1.Manager member=Reboot cookie=1 reply_cookie=0 signature=n/a error-name=n/a error-message=n/aO\
> perating on architecture: x86-64
>
> Sent message type=method_return sender=org.freedesktop.systemd1 destination=n/a path=n/a interface=n/a member=n/a cookie=1 reply_cookie=1 signature=n/a error-name=n/a error-message=n/a
> Shutting down.
> Bus private-bus-connection: changing state RUNNING → CLOSING
> dev-vda.device: Failed to send unit remove signal for dev-vda.device: Connection reset by peer
> systemd-journald.service: Executing: /usr/lib/systemd/systemd-journald
> Bus private-bus-connection: changing state CLOSING → CLOSED
> [ 15.956995] Unregister pv shared memory for cpu 0
> [ 15.967559] reboot: Restarting system
> [ 15.970216] reboot: machine restart
>
> ^---- but finally system gets restarted.
>
> This behavior doesn't change even if I changed ExecStart=/usr/bin/systemctl --force halt
> in systemd-halt.service into ExecStart=/usr/bin/systemctl --force --force halt.
> systemctl halt with --force twice means systemctl calls immediately directly reboot
> system call. Thus, I think systemd somehow reboot system before entering systemd-halt.service.
>
Thanks, I remember Pingfan have encountered similar problem before,
that force shutdown turns into reboot and that seems to be a systemd
bug. CC Pingfan see if he has any idea about this.
But it's very strange that systemctl --force --force halt doesn't work
either. I can reproduce this locally with Fedora.
Also add the missing kexec(a)lists.fedoraproject.org in CC list.
--
Best Regards,
Kairui Song
3 years, 11 months
Re: [PATCH] kdump-lib-initramfs.sh: use -f option for failure_action
halt
by Dave Young
Hi Hatayama,
On 10/24/19 at 02:01am, d.hatayama(a)fujitsu.com wrote:
> failure_action halt doesn't work well now. This appears to be similar
> to the previous issues such as
> b2534348199ad5010c86890a068653d970c9933d and
> 89565289c64aa5323278cf5722c725a58b369af8.
>
> While I think we need to fix systemd shutdown process in the kdump
> kernel so halt works fine, this patch adds -f option for
> failure_action halt just as the fixes in each commits.
>
> On the other hand, final_action halt works well.
>
> Signed-off-by: HATAYAMA Daisuke <d.hatayama(a)fujitsu.com>
> ---
> kdump-lib-initramfs.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
> index 608dc6e..2a36ca7 100755
> --- a/kdump-lib-initramfs.sh
> +++ b/kdump-lib-initramfs.sh
> @@ -59,7 +59,7 @@ get_kdump_confs()
> FAILURE_ACTION="systemctl reboot -f"
> ;;
> halt)
> - FAILURE_ACTION="halt"
> + FAILURE_ACTION="halt -f"
Looks better to use "systemctl halt -f" just like reboot/poweroff?
> ;;
> poweroff)
> FAILURE_ACTION="systemctl poweroff -f"
Thanks
Dave
3 years, 11 months
Re: [PATCH] kdump-lib-initramfs.sh: use -f option for failure_action halt
by Kairui Song
On Mon, Oct 28, 2019 at 11:29 AM d.hatayama(a)fujitsu.com
<d.hatayama(a)fujitsu.com> wrote:
>
> failure_action halt doesn't work well now. This appears to be similar
> to the previous issues such as
> b2534348199ad5010c86890a068653d970c9933d and
> 89565289c64aa5323278cf5722c725a58b369af8.
Hi,
Thanks for the patch, it looks good to me in general, but can you add
more detail about the problem you are trying to solve?
Eg, add some word about the system behavior or some error logs. Like
in the two commits you mentioned.
>
> While I think we need to fix systemd shutdown process in the kdump
> kernel so halt works fine, this patch adds -f option for
> failure_action halt just as the fixes in each commits.
>
> On the other hand, final_action halt works well.
>
> Signed-off-by: HATAYAMA Daisuke <d.hatayama(a)fujitsu.com>
> ---
> kdump-lib-initramfs.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
> index 608dc6e..2a36ca7 100755
> --- a/kdump-lib-initramfs.sh
> +++ b/kdump-lib-initramfs.sh
> @@ -59,7 +59,7 @@ get_kdump_confs()
> FAILURE_ACTION="systemctl reboot -f"
> ;;
> halt)
> - FAILURE_ACTION="halt"
> + FAILURE_ACTION="halt -f"
> ;;
> poweroff)
> FAILURE_ACTION="systemctl poweroff -f"
> --
> 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, 11 months
[PATCH] mkdumprd: ensure ssh path exists before check size
by Kairui Song
check_size checks if the specified dump path on the ssh target have
enough space. And if the path doesn't exits, it will fail and exit.
mkdir_save_path_ssh should be called first to check if the path
exists, and create the path if it doesn't exits, so the size check
can always work properly.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
mkdumprd | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mkdumprd b/mkdumprd
index 50472a9..aafd808 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -429,10 +429,10 @@ do
ssh)
if strstr "$config_val" "@";
then
- check_size ssh $config_val
mkdir_save_path_ssh $config_val
+ check_size ssh $config_val
add_dracut_module "ssh-client"
- add_dracut_sshkey "$SSH_KEY_LOCATION"
+ add_dracut_sshkey "$SSH_KEY_LOCATION"
else
perror_exit "Bad ssh dump target $config_val"
fi
--
2.21.0
3 years, 11 months
[PATCH] module-setup.sh: Simplify the network setup code
by Kairui Song
Merge kdump_setup_netdev into kdump_install_net.
kdump_install_net is a wrapper of calling kdump_setup_netdev, and
it do following three extra things:
1. Sanitize and resolve the hostname
2. Resolve the route to the destination
3. Set the default gateway for once
There is currently only one caller of kdump_setup_netdev, the iscsi
network setup code, and it's doing 1 and 2 by itself. And there should
only be one default gateway in kdump enviroment, so applying 3 here is
fine.
And the comment of kdump_install_net is wrong and obsoleted, update the
comment too.
Just merge kdump_setup_netdev into kdump_install_net and always use
kdump_install_net instead.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
dracut-module-setup.sh | 88 +++++++++++++++++++-----------------------
1 file changed, 40 insertions(+), 48 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index b186b38..6a50e66 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -327,11 +327,45 @@ kdump_setup_znet() {
echo rd.znet=${NETTYPE},${SUBCHANNELS}${_options} > ${initdir}/etc/cmdline.d/30znet.conf
}
-# Setup dracut to bringup a given network interface
-kdump_setup_netdev() {
- local _netdev=$1 _srcaddr=$2
+kdump_get_ip_route()
+{
+ local _route=$(/sbin/ip -o route get to $1 2>&1)
+ [ $? != 0 ] && die "Bad kdump network destination: $1"
+ echo $_route
+}
+
+kdump_get_ip_route_field()
+{
+ if `echo $1 | grep -q $2`; then
+ echo ${1##*$2} | cut -d ' ' -f1
+ fi
+}
+
+kdump_get_remote_ip()
+{
+ local _remote=$(get_remote_host $1) _remote_temp
+ if is_hostname $_remote; then
+ _remote_temp=`getent ahosts $_remote | grep -v : | head -n 1`
+ if [ -z "$_remote_temp" ]; then
+ _remote_temp=`getent ahosts $_remote | head -n 1`
+ fi
+ _remote=`echo $_remote_temp | cut -d' ' -f1`
+ fi
+ echo $_remote
+}
+
+# Setup dracut to bring up network interface that enable
+# initramfs accessing giving destination
+# $1: destination host
+kdump_install_net() {
+ local _destaddr _srcaddr _route _netdev
local _static _proto _ip_conf _ip_opts _ifname_opts
- local _netmac=$(kdump_get_mac_addr $_netdev)
+
+ _destaddr=$(kdump_get_remote_ip $1)
+ _route=$(kdump_get_ip_route $_destaddr)
+ _srcaddr=$(kdump_get_ip_route_field "$_route" "src")
+ _netdev=$(kdump_get_ip_route_field "$_route" "dev")
+ _netmac=$(kdump_get_mac_addr $_netdev)
if [ "$(uname -m)" = "s390x" ]; then
kdump_setup_znet $_netdev
@@ -372,42 +406,8 @@ kdump_setup_netdev() {
fi
kdump_setup_dns "$_netdev"
-}
-get_ip_route_field()
-{
- if `echo $1 | grep -q $2`; then
- echo ${1##*$2} | cut -d ' ' -f1
- fi
-}
-
-#Function:kdump_install_net
-#$1: config values of net line in kdump.conf
-#$2: srcaddr of network device
-kdump_install_net() {
- local _server _netdev _srcaddr _route _serv_tmp
- local config_val="$1"
-
- _server=$(get_remote_host $config_val)
-
- if is_hostname $_server; then
- _serv_tmp=`getent ahosts $_server | grep -v : | head -n 1`
- if [ -z "$_serv_tmp" ]; then
- _serv_tmp=`getent ahosts $_server | head -n 1`
- fi
- _server=`echo $_serv_tmp | cut -d' ' -f1`
- fi
-
- _route=`/sbin/ip -o route get to $_server 2>&1`
- [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
-
- #the field in the ip output changes if we go to another subnet
- _srcaddr=$(get_ip_route_field "$_route" "src")
- _netdev=$(get_ip_route_field "$_route" "dev")
-
- kdump_setup_netdev "${_netdev}" "${_srcaddr}"
-
- #save netdev used for kdump as cmdline
+ # Save netdev used for kdump as cmdline
# Whoever calling kdump_install_net() is setting up the default gateway,
# ie. bootdev/kdumpnic. So don't override the setting if calling
# kdump_install_net() for another time. For example, after setting eth0 as
@@ -592,9 +592,6 @@ kdump_setup_iscsi_device() {
local tgt_name; local tgt_ipaddr;
local username; local password; local userpwd_str;
local username_in; local password_in; local userpwd_in_str;
- local netdev
- local srcaddr
- local idev
local netroot_str ; local initiator_str;
local netroot_conf="${initdir}/etc/cmdline.d/50iscsi.conf"
local initiator_conf="/etc/iscsi/initiatorname.iscsi"
@@ -633,12 +630,7 @@ kdump_setup_iscsi_device() {
[ -n "$username_in" ] && userpwd_in_str=":$username_in:$password_in"
- netdev=$(/sbin/ip route get to ${tgt_ipaddr} | \
- sed 's|.*dev \(.*\).*|\1|g')
- srcaddr=$(echo $netdev | awk '{ print $3; exit }')
- netdev=$(echo $netdev | awk '{ print $1; exit }')
-
- kdump_setup_netdev $netdev $srcaddr
+ kdump_install_net "$tgt_ipaddr"
# prepare netroot= command line
# FIXME: Do we need to parse and set other parameters like protocol, port
--
2.21.0
3 years, 11 months
[PATCH] kdump-lib-initramfs.sh: use -f option for failure_action halt
by HATAYAMA Daisuke
failure_action halt doesn't work well now. This appears to be similar
to the previous issues such as
b2534348199ad5010c86890a068653d970c9933d and
89565289c64aa5323278cf5722c725a58b369af8.
While I think we need to fix systemd shutdown process in the kdump
kernel so halt works fine, this patch adds -f option for
failure_action halt just as the fixes in each commits.
On the other hand, final_action halt works well.
Signed-off-by: HATAYAMA Daisuke <d.hatayama(a)fujitsu.com>
---
kdump-lib-initramfs.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index 608dc6e..2a36ca7 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -59,7 +59,7 @@ get_kdump_confs()
FAILURE_ACTION="systemctl reboot -f"
;;
halt)
- FAILURE_ACTION="halt"
+ FAILURE_ACTION="halt -f"
;;
poweroff)
FAILURE_ACTION="systemctl poweroff -f"
--
1.8.3.1
3 years, 11 months
[PATCH] kdump-lib-initramfs.sh: use -f option for failure_action halt
by d.hatayama@fujitsu.com
failure_action halt doesn't work well now. This appears to be similar
to the previous issues such as
b2534348199ad5010c86890a068653d970c9933d and
89565289c64aa5323278cf5722c725a58b369af8.
While I think we need to fix systemd shutdown process in the kdump
kernel so halt works fine, this patch adds -f option for
failure_action halt just as the fixes in each commits.
On the other hand, final_action halt works well.
Signed-off-by: HATAYAMA Daisuke <d.hatayama(a)fujitsu.com>
---
kdump-lib-initramfs.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index 608dc6e..2a36ca7 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -59,7 +59,7 @@ get_kdump_confs()
FAILURE_ACTION="systemctl reboot -f"
;;
halt)
- FAILURE_ACTION="halt"
+ FAILURE_ACTION="halt -f"
;;
poweroff)
FAILURE_ACTION="systemctl poweroff -f"
--
1.8.3.1
3 years, 11 months