The kdump-capture.service will fail, if the following conds are meet up. -1. boot up a VM with the following cmd: qemu-kvm -name 'avocado-vt-vm1' -sandbox off -machine pc -nodefaults -vga cirrus \ -drive id=drive_image1,if=none,snapshot=off,aio=native,cache=none,format=qcow2,file=$guest_img \ -device virtio-blk-pci,id=image1,drive=drive_image1,bootindex=0,bus=pci.0,addr=04 \ -device virtio-net-pci,mac=9a:4d:4e:4f:50:51,id=id3DveCw,vectors=4,netdev=idgW5YRp,bus=pci.0,addr=05 \ -netdev tap,id=idgW5YRp \ -m 2048 \ -smp 4,maxcpus=4,cores=2,threads=1,sockets=2 \ -cpu 'SandyBridge',+kvm_pv_unhalt \ -vnc :0 \ -rtc base=utc,clock=host,driftfix=slew \ -boot order=cdn,once=c,menu=off,strict=off \ -enable-kvm \ -monitor stdio \ -qmp tcp:localhost:4444,server,nowait -2. in kernel cmdline with the following options: console=tty0 console=ttyS0,
Because the "-nodefaults" option in qemu cmd excludes the emulation of serial port, the ttyS0 will have no real backend device. We can observe such issue in 1st kernel by: echo teststring > /dev/console or echo teststring > /dev/ttyS0, It gets the error "-bash: echo: write error: Input/output error". Such conds cause small issue in 1st kernel, but it is a big problem for kdump-capture and emergency service.
This patch aims to work aroundthe issue in kdump-capture service: dump_fs() return value will affect the following code in dracut-kdump.sh DUMP_RETVAL=$? <--- do_kdump_post $DUMP_RETVAL if [ $? -ne 0 ]; then echo "kdump: kdump_post script exited with non-zero status!" fi
Although kdump-capture saves the vmcore successfully, but it exit 1 and fall on emergency service.
Signed-off-by: Pingfan Liu piliu@redhat.com --- kdump-lib-initramfs.sh | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index 4c0e2e2..2c18c87 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -111,6 +111,8 @@ dump_fs() sync
echo "kdump: saving vmcore complete" + # improper kernel cmdline can cause the failure of echo, we can ignore this kind of failure + return 0 }
save_vmcore_dmesg_fs() {
The invalid console param in cmdline could cause the emergency service's failure with STDIN error, and the system can not reboot or enter the shell. This patch verify the cmdline and erase the buggy param.
The invalid param can be reproduce by the following cmds -1. boot up a VM with the following cmd: qemu-kvm -name 'avocado-vt-vm1' -sandbox off -machine pc -nodefaults -vga cirrus \ -drive id=drive_image1,if=none,snapshot=off,aio=native,cache=none,format=qcow2,file=$guest_img \ -device virtio-blk-pci,id=image1,drive=drive_image1,bootindex=0,bus=pci.0,addr=04 \ -device virtio-net-pci,mac=9a:4d:4e:4f:50:51,id=id3DveCw,vectors=4,netdev=idgW5YRp,bus=pci.0,addr=05 \ -netdev tap,id=idgW5YRp \ -m 2048 \ -smp 4,maxcpus=4,cores=2,threads=1,sockets=2 \ -cpu 'SandyBridge',+kvm_pv_unhalt \ -vnc :0 \ -rtc base=utc,clock=host,driftfix=slew \ -boot order=cdn,once=c,menu=off,strict=off \ -enable-kvm \ -monitor stdio \ -qmp tcp:localhost:4444,server,nowait -2. in kernel cmdline with the following options: console=tty0 console=ttyS0,
Because the "-nodefaults" option in qemu cmd excludes the emulation of serial port, the ttyS0 will have no real backend device.
Signed-off-by: Pingfan Liu piliu@redhat.com --- kdumpctl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/kdumpctl b/kdumpctl index d7f25d9..ee1b8c4 100755 --- a/kdumpctl +++ b/kdumpctl @@ -176,6 +176,26 @@ is_dump_to_rootfs() grep "^default[[:space:]]dump_to_rootfs" /etc/kdump.conf >/dev/null }
+verify_cmdline() +{ + condevs=$(echo $1 | tr " " "\n" | grep "console=" | awk -F "=" '{ print $2 }') + echo $condevs + verified_cmdline=$1 + for condev in $condevs + do + echo "test $condev" + if [[ $condev =~ /dev/* ]]; then + echo "kexec-tools test $condev" > $condev + else + echo "kexec-tools test $condev" > /dev/$condev + fi + if [ $? -ne 0 ]; then + verified_cmdline=$(echo $verified_cmdline | sed -n "s/console=$condev/ /p") + fi + done + echo $verified_cmdline +} + # This function performs a series of edits on the command line. # Store the final result in global $KDUMP_COMMANDLINE. prepare_cmdline() @@ -211,6 +231,7 @@ prepare_cmdline() cmdline=`append_cmdline "${cmdline}" disable_cpu_apicid ${id}` fi
+ cmdline=`verify_cmdline "$cmdline"` KDUMP_COMMANDLINE=$cmdline
check_kdump_cpus
On 04/17/2017 at 03:41 PM, Pingfan Liu wrote:
The invalid console param in cmdline could cause the emergency service's failure with STDIN error, and the system can not reboot or enter the shell. This patch verify the cmdline and erase the buggy param.
I wonder if this is also a problem for the first kernel? For example, we make some systemd service failed, then emergency service tiggers, does this STDIN error happen?
Regards, Xunlei
The invalid param can be reproduce by the following cmds -1. boot up a VM with the following cmd: qemu-kvm -name 'avocado-vt-vm1' -sandbox off -machine pc -nodefaults -vga cirrus \ -drive id=drive_image1,if=none,snapshot=off,aio=native,cache=none,format=qcow2,file=$guest_img \ -device virtio-blk-pci,id=image1,drive=drive_image1,bootindex=0,bus=pci.0,addr=04 \ -device virtio-net-pci,mac=9a:4d:4e:4f:50:51,id=id3DveCw,vectors=4,netdev=idgW5YRp,bus=pci.0,addr=05 \ -netdev tap,id=idgW5YRp \ -m 2048 \ -smp 4,maxcpus=4,cores=2,threads=1,sockets=2 \ -cpu 'SandyBridge',+kvm_pv_unhalt \ -vnc :0 \ -rtc base=utc,clock=host,driftfix=slew \ -boot order=cdn,once=c,menu=off,strict=off \ -enable-kvm \ -monitor stdio \ -qmp tcp:localhost:4444,server,nowait -2. in kernel cmdline with the following options: console=tty0 console=ttyS0,
Because the "-nodefaults" option in qemu cmd excludes the emulation of serial port, the ttyS0 will have no real backend device.
Signed-off-by: Pingfan Liu piliu@redhat.com
kdumpctl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/kdumpctl b/kdumpctl index d7f25d9..ee1b8c4 100755 --- a/kdumpctl +++ b/kdumpctl @@ -176,6 +176,26 @@ is_dump_to_rootfs() grep "^default[[:space:]]dump_to_rootfs" /etc/kdump.conf >/dev/null }
+verify_cmdline() +{
- condevs=$(echo $1 | tr " " "\n" | grep "console=" | awk -F "=" '{ print $2 }')
- echo $condevs
- verified_cmdline=$1
- for condev in $condevs
- do
echo "test $condev"
if [[ $condev =~ /dev/* ]]; then
echo "kexec-tools test $condev" > $condev
else
echo "kexec-tools test $condev" > /dev/$condev
fi
if [ $? -ne 0 ]; then
verified_cmdline=$(echo $verified_cmdline | sed -n "s/console=$condev/ /p")
fi
- done
- echo $verified_cmdline
+}
# This function performs a series of edits on the command line. # Store the final result in global $KDUMP_COMMANDLINE. prepare_cmdline() @@ -211,6 +231,7 @@ prepare_cmdline() cmdline=`append_cmdline "${cmdline}" disable_cpu_apicid ${id}` fi
cmdline=`verify_cmdline "$cmdline"` KDUMP_COMMANDLINE=$cmdline
check_kdump_cpus
On 04/24/17 at 11:38am, Xunlei Pang wrote:
On 04/17/2017 at 03:41 PM, Pingfan Liu wrote:
The invalid console param in cmdline could cause the emergency service's failure with STDIN error, and the system can not reboot or enter the shell. This patch verify the cmdline and erase the buggy param.
I wonder if this is also a problem for the first kernel? For example, we make some systemd service failed, then emergency service tiggers, does this STDIN error happen?
Yes, I also think it should not be kdump specific, if it is then there should be something unclear yet..
Regards, Xunlei
The invalid param can be reproduce by the following cmds -1. boot up a VM with the following cmd: qemu-kvm -name 'avocado-vt-vm1' -sandbox off -machine pc -nodefaults -vga cirrus \ -drive id=drive_image1,if=none,snapshot=off,aio=native,cache=none,format=qcow2,file=$guest_img \ -device virtio-blk-pci,id=image1,drive=drive_image1,bootindex=0,bus=pci.0,addr=04 \ -device virtio-net-pci,mac=9a:4d:4e:4f:50:51,id=id3DveCw,vectors=4,netdev=idgW5YRp,bus=pci.0,addr=05 \ -netdev tap,id=idgW5YRp \ -m 2048 \ -smp 4,maxcpus=4,cores=2,threads=1,sockets=2 \ -cpu 'SandyBridge',+kvm_pv_unhalt \ -vnc :0 \ -rtc base=utc,clock=host,driftfix=slew \ -boot order=cdn,once=c,menu=off,strict=off \ -enable-kvm \ -monitor stdio \ -qmp tcp:localhost:4444,server,nowait -2. in kernel cmdline with the following options: console=tty0 console=ttyS0,
Because the "-nodefaults" option in qemu cmd excludes the emulation of serial port, the ttyS0 will have no real backend device.
Signed-off-by: Pingfan Liu piliu@redhat.com
kdumpctl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/kdumpctl b/kdumpctl index d7f25d9..ee1b8c4 100755 --- a/kdumpctl +++ b/kdumpctl @@ -176,6 +176,26 @@ is_dump_to_rootfs() grep "^default[[:space:]]dump_to_rootfs" /etc/kdump.conf >/dev/null }
+verify_cmdline() +{
- condevs=$(echo $1 | tr " " "\n" | grep "console=" | awk -F "=" '{ print $2 }')
- echo $condevs
- verified_cmdline=$1
- for condev in $condevs
- do
echo "test $condev"
if [[ $condev =~ /dev/* ]]; then
echo "kexec-tools test $condev" > $condev
else
echo "kexec-tools test $condev" > /dev/$condev
fi
if [ $? -ne 0 ]; then
verified_cmdline=$(echo $verified_cmdline | sed -n "s/console=$condev/ /p")
fi
- done
- echo $verified_cmdline
+}
# This function performs a series of edits on the command line. # Store the final result in global $KDUMP_COMMANDLINE. prepare_cmdline() @@ -211,6 +231,7 @@ prepare_cmdline() cmdline=`append_cmdline "${cmdline}" disable_cpu_apicid ${id}` fi
cmdline=`verify_cmdline "$cmdline"` KDUMP_COMMANDLINE=$cmdline
check_kdump_cpus
kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org
On 04/17/2017 at 03:41 PM, Pingfan Liu wrote:
The kdump-capture.service will fail, if the following conds are meet up. -1. boot up a VM with the following cmd: qemu-kvm -name 'avocado-vt-vm1' -sandbox off -machine pc -nodefaults -vga cirrus \ -drive id=drive_image1,if=none,snapshot=off,aio=native,cache=none,format=qcow2,file=$guest_img \ -device virtio-blk-pci,id=image1,drive=drive_image1,bootindex=0,bus=pci.0,addr=04 \ -device virtio-net-pci,mac=9a:4d:4e:4f:50:51,id=id3DveCw,vectors=4,netdev=idgW5YRp,bus=pci.0,addr=05 \ -netdev tap,id=idgW5YRp \ -m 2048 \ -smp 4,maxcpus=4,cores=2,threads=1,sockets=2 \ -cpu 'SandyBridge',+kvm_pv_unhalt \ -vnc :0 \ -rtc base=utc,clock=host,driftfix=slew \ -boot order=cdn,once=c,menu=off,strict=off \ -enable-kvm \ -monitor stdio \ -qmp tcp:localhost:4444,server,nowait -2. in kernel cmdline with the following options: console=tty0 console=ttyS0,
Because the "-nodefaults" option in qemu cmd excludes the emulation of serial port, the ttyS0 will have no real backend device. We can observe such issue in 1st kernel by: echo teststring > /dev/console or echo teststring > /dev/ttyS0, It gets the error "-bash: echo: write error: Input/output error". Such conds cause small issue in 1st kernel, but it is a big problem for kdump-capture and emergency service.
This patch aims to work aroundthe issue in kdump-capture service: dump_fs() return value will affect the following code in dracut-kdump.sh DUMP_RETVAL=$? <--- do_kdump_post $DUMP_RETVAL if [ $? -ne 0 ]; then echo "kdump: kdump_post script exited with non-zero status!" fi
Although kdump-capture saves the vmcore successfully, but it exit 1 and fall on emergency service.
Signed-off-by: Pingfan Liu piliu@redhat.com
Reviewed-by: Xunlei Pang xlpang@redhat.com
kdump-lib-initramfs.sh | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index 4c0e2e2..2c18c87 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -111,6 +111,8 @@ dump_fs() sync
echo "kdump: saving vmcore complete"
- # improper kernel cmdline can cause the failure of echo, we can ignore this kind of failure
- return 0
}
save_vmcore_dmesg_fs() {