Hello Coiby,
thanks for the fix!
Coiby Xu [2022-12-14 14:48 +0800]:
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 13e99015..f82349cb 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -387,6 +387,7 @@ kdump_install_nic_driver() { _drivers=()
for _netif in $1; do
! ip addr show "$_netif" | grep "link/loopback" || continue
I confirm that this works, in the sense of "kdump to ssh localhost succeeds again".
But it is a bit heavy (calling `ip` and `grep`) and brittle (relying on precise output format of `ip show`, which isn't very machine-readable). I'm also worried that this might apply to other virtual devices as well, such as veth or wireguard. My laptop has a wireguard device which might also cause trouble:
$ ip link show wgpitti 4: wgpitti: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 link/none
$ ls -l /sys/class/net/wgpitti/device ls: cannot access '/sys/class/net/wgpitti/device': No such file or directory
Hence I would recommend this instead:
[ -e "/sys/class/net/$_netif/device/driver" ] || continue
and rename the commit to "skip installing driver for virtual devices" or so.
I tested this with ssh/localhost as well. It has the added benefit of not relying on "ip show" format, is more robust, more generic, and not even a new concept: that script already looks at /sys/class/net anyway.
_driver=$(_get_nic_driver "$_netif") if [[ -z $_driver ]]; then derror "Failed to get the driver of $_netif"
@@ -404,6 +405,7 @@ kdump_install_nic_driver() { _drivers+=("$_driver") done
- [[ -n ${_drivers[*]} ]] || return
This is fine of course.
instmods "${_drivers[@]}"
}
Thanks,
Martin