From b2bbb54d897959b1a6de6841ff397d6ec9565a12 Mon Sep 17 00:00:00 2001 From: Coiby Xu Date: Thu, 15 Jul 2021 09:18:33 +0800 Subject: [PATCH] Check the existence of /sys/bus/ccwgroup/devices/*/online beforehand On s390x KVM machines, the following errors would show when building kdump initramfs that dumps vmcore to a remote target, $ kdumpctl rebuild /usr/lib/dracut/modules.d/99kdumpbase/module-setup.sh: line 475: /sys/bus/ccwgroup/devices/online: No such file or directory /usr/lib/dracut/modules.d/99kdumpbase/module-setup.sh: line 476: [: -ne: unary operator expected This happens because s390x KVM machines use virtual network and /sys/bus/ccwgroup/devices/ exists but is empty. Fix it by check the existence of file "/sys/bus/ccwgroup/devices/*/online". Fixes: commit 7d472515688fb330eee76dac1c39ae628398f757 ("Iterate /sys/bus/ccwgroup/devices to tell if we should set up rd.znet") BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1982474 Reported-by: Jie Li Signed-off-by: Coiby Xu t Acked-by: Kairui Song --- dracut-module-setup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 8211d14..a1f33e8 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -462,6 +462,7 @@ find_online_znet_device() { NETWORK_DEVICES=$(find $CCWGROUPBUS_DEVICEDIR) for d in $NETWORK_DEVICES do + [ ! -f "$d/online" ] && continue read ONLINE < $d/online if [ $ONLINE -ne 1 ]; then continue