On Fri, Apr 2, 2021 at 10:01 AM HAGIO KAZUHITO(萩尾 一仁) k-hagio-ab@nec.com wrote:
Hi,
I hit the following issue and wrote this patch, but I found later that it might be better to fix the dracut nfs/ssh-client modules in this case. but I'm not familiar with dracut.. could I have any comments?
Hi Kazu,
I agree with you that we better frix it in dracut, I made a simple patch below, can you have a look or try it? https://github.com/ryncsn/dracut/commit/c69c223f649e1392e09b6c89bf2df00e9006...
And I think after the dracut fix, we still need to detect for host/nss file change in kdumpctl and rebuild the initramfs on change. Should be a simple change.
Thanks, Kazu
From f39a89d5da01cb5f27ff4b1c8a81d6b58601e80c Mon Sep 17 00:00:00 2001 From: Kazuhito Hagio k-hagio-ab@nec.com Subject: [PATCH] Add /etc/hosts to kdump initramfs for nfs/ssh dump
Currently the /etc/hosts file is not contained in kdump initramfs by default. Hosts that depend only on /etc/hosts to resolve IP address (i.e. do not have DNS servers) can start kdump service with hostname nfs/ssh configuration, but fail in resolving the target server's IP address on the 2nd kernel:
mount[355]: mount.nfs: Failed to resolve server dumpsrv: Name or service not known ... systemd[1]: kdumproot-dump.mount: Mount process exited, code=exited, status=32/n/a systemd[1]: kdumproot-dump.mount: Failed with result 'exit-code'. systemd[1]: Failed to mount /kdumproot/dump.
Add the /etc/hosts file to kdump initramfs when nfs/ssh dump is configured. The /etc/nsswitch.conf file is also required for ssh dump according to a test.
Signed-off-by: Kazuhito Hagio k-hagio-ab@nec.com
dracut-module-setup.sh | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 8316589b3ac8..c59750810cf0 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -874,6 +874,10 @@ install() { # nfs/ssh dump will need to get host ip in second kernel and need to call 'ip' tool, see get_host_ip for more detail if is_nfs_dump_target || is_ssh_dump_target; then inst "ip"
# For hosts that depend only on /etc/hosts to resolve IP address.
# /etc/nsswitch.conf is also required for ssh dump.
inst "/etc/hosts"
inst "/etc/nsswitch.conf"
fi
# For the lvm type target under kdump, in /etc/lvm/lvm.conf we can
-- 2.18.4
Hi Kairui,
-----Original Message-----
On Fri, Apr 2, 2021 at 10:01 AM HAGIO KAZUHITO(萩尾 一仁) k-hagio-ab@nec.com wrote:
Hi,
I hit the following issue and wrote this patch, but I found later that it might be better to fix the dracut nfs/ssh-client modules in this case. but I'm not familiar with dracut.. could I have any comments?
Hi Kazu,
I agree with you that we better frix it in dracut, I made a simple patch below, can you have a look or try it? https://github.com/ryncsn/dracut/commit/c69c223f649e1392e09b6c89bf2df00e9006...
Thank you for the patch, I confirmed that both nfs/ssh kdump works well with it.
And I think after the dracut fix, we still need to detect for host/nss file change in kdumpctl and rebuild the initramfs on change. Should be a simple change.
Yes, certainly.
Thanks, Kazu
Thanks, Kazu
From f39a89d5da01cb5f27ff4b1c8a81d6b58601e80c Mon Sep 17 00:00:00 2001 From: Kazuhito Hagio k-hagio-ab@nec.com Subject: [PATCH] Add /etc/hosts to kdump initramfs for nfs/ssh dump
Currently the /etc/hosts file is not contained in kdump initramfs by default. Hosts that depend only on /etc/hosts to resolve IP address (i.e. do not have DNS servers) can start kdump service with hostname nfs/ssh configuration, but fail in resolving the target server's IP address on the 2nd kernel:
mount[355]: mount.nfs: Failed to resolve server dumpsrv: Name or service not known ... systemd[1]: kdumproot-dump.mount: Mount process exited, code=exited, status=32/n/a systemd[1]: kdumproot-dump.mount: Failed with result 'exit-code'. systemd[1]: Failed to mount /kdumproot/dump.
Add the /etc/hosts file to kdump initramfs when nfs/ssh dump is configured. The /etc/nsswitch.conf file is also required for ssh dump according to a test.
Signed-off-by: Kazuhito Hagio k-hagio-ab@nec.com
dracut-module-setup.sh | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 8316589b3ac8..c59750810cf0 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -874,6 +874,10 @@ install() { # nfs/ssh dump will need to get host ip in second kernel and need to call 'ip' tool, see get_host_ip
for more detail
if is_nfs_dump_target || is_ssh_dump_target; then inst "ip"
# For hosts that depend only on /etc/hosts to resolve IP address.
# /etc/nsswitch.conf is also required for ssh dump.
inst "/etc/hosts"
inst "/etc/nsswitch.conf"
fi
# For the lvm type target under kdump, in /etc/lvm/lvm.conf we can
-- 2.18.4
-- Best Regards, Kairui Song