If dump target is ipv6 address, a host should have ipv6 address ready before starting kdump service. Otherwise, kdump service fails to start due to the failure "ssh dump_server_ip mkdir -p $SAVE_PATH". And user can see message like: "Could not create root@2620:52:0:10da:46a8:42ff:fe23:3272/var/crash"
A host can get ipv6 address by three ways: Neighbor Discovery Protocol/ DHCPv6/ static.
I observe a long period (about 30s) on some machine before they got ipv6 address dynamiclly, which is never seen on ipv4 host.
Hence kdump service has a dependency on ipv6 address. But there is no good way to resolve it. One way is asking user to run the cmd "nmcli connection modify eth0 ipv6.may-fail false". But this will block systemd until ipv6 address is ready. Despite doing so, kdump can try its best (wait 1 minutes after it starts up) before failure.
Signed-off-by: Pingfan Liu piliu@redhat.com --- kdumpctl | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
diff --git a/kdumpctl b/kdumpctl index a1a6ee2..02302a1 100755 --- a/kdumpctl +++ b/kdumpctl @@ -730,9 +730,38 @@ check_ssh_config() return 0 }
+# Alternative way, using "nmcli connection modify eth0 ipv6.may-fail false" +# to force systemd to wait until ipv6 address ready. +# But it is better to let kdump wait a minute on ipv6 address +check_and_wait_ipv6_ready() +{ + local ipaddr=$1 + local ipv6_up="false" + local left=60 + + ipaddr=$(echo $ipaddr | awk -F "@" '{ print $2 }') + if is_ipv6_address $ipaddr; then + while [ $left -gt 0 ]; do + ip -f inet6 addr | grep global + if [ ${PIPESTATUS[1]} -eq 0 ]; then + ipv6_up="true" + break; + fi + left=$(expr $left - 1) + sleep 1 + done + + if [ "$ipv6_up" == "false" ]; then + echo "ipv6 address is not ready within more than 1 minute" + fi + fi +} + check_ssh_target() { local _ret + + check_and_wait_ipv6_ready $DUMP_TARGET ssh -q -i $SSH_KEY_LOCATION -o BatchMode=yes $DUMP_TARGET mkdir -p $SAVE_PATH _ret=$? if [ $_ret -ne 0 ]; then