Previously /boot is asumed as the default dir where kernel and initrd is put. However, the directory containing the running kernel image on Atomic systems differs in each installation. Usually something like:
/boot/ostree/rhel-atomic-host-b50a015b637c353dc6554c851f8a1212b60d6121a7316715e4a63e2a4113cd72
This means that kdump will not find vmlinuz when installed on an Atomic host, and thus the kdump service will fail to start.
In this patch, get the sub directory where kernel is put and append it to /boot.
Note: If user change KDUMP_BOOTDIR to other directory, then he need to take care of all related things himself. Otherswise situation will become complicated.
Signed-off-by: Baoquan He bhe@redhat.com --- kdumpctl | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/kdumpctl b/kdumpctl index 1c97405..aac1118 100755 --- a/kdumpctl +++ b/kdumpctl @@ -292,6 +292,15 @@ get_pcs_cluster_modified_files() echo $modified_files }
+adjust_boot_dir() +{ + #If user specify different boot dir then /boot, he need take care of + # the whole thing like /boot//ostree/rhel-atomicxxxx/vmlinuz-xxx + [ $KDUMP_BOOTDIR != "/boot" ] && return + eval $(cat /proc/cmdline | grep "BOOT_IMAGE" | cut -d' ' -f1) + KDUMP_BOOTDIR=$KDUMP_BOOTDIR$(dirname $BOOT_IMAGE) +} + setup_target_initrd() { if [ $DEFAULT_DUMP_MODE == "fadump" ]; then @@ -311,6 +320,8 @@ check_rebuild() local _force_rebuild force_rebuild="0" local initramfs_has_fadump
+ adjust_boot_dir + if [ -z "$KDUMP_KERNELVER" ]; then kdump_kver=`uname -r` else
On 01/28/15 at 04:29pm, Baoquan He wrote:
Previously /boot is asumed as the default dir where kernel and initrd is put. However, the directory containing the running kernel image on Atomic systems differs in each installation. Usually something like:
/boot/ostree/rhel-atomic-host-b50a015b637c353dc6554c851f8a1212b60d6121a7316715e4a63e2a4113cd72
This means that kdump will not find vmlinuz when installed on an Atomic host, and thus the kdump service will fail to start.
In this patch, get the sub directory where kernel is put and append it to /boot.
Note: If user change KDUMP_BOOTDIR to other directory, then he need to take care of all related things himself. Otherswise situation will become complicated.
Signed-off-by: Baoquan He bhe@redhat.com
kdumpctl | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/kdumpctl b/kdumpctl index 1c97405..aac1118 100755 --- a/kdumpctl +++ b/kdumpctl @@ -292,6 +292,15 @@ get_pcs_cluster_modified_files() echo $modified_files }
+adjust_boot_dir() +{
- #If user specify different boot dir then /boot, he need take care of
- # the whole thing like /boot//ostree/rhel-atomicxxxx/vmlinuz-xxx
- [ $KDUMP_BOOTDIR != "/boot" ] && return
eval $(cat /proc/cmdline | grep "BOOT_IMAGE" | cut -d' ' -f1)
KDUMP_BOOTDIR=$KDUMP_BOOTDIR$(dirname $BOOT_IMAGE)
+}
setup_target_initrd() { if [ $DEFAULT_DUMP_MODE == "fadump" ]; then @@ -311,6 +320,8 @@ check_rebuild() local _force_rebuild force_rebuild="0" local initramfs_has_fadump
- adjust_boot_dir
- if [ -z "$KDUMP_KERNELVER" ]; then kdump_kver=`uname -r` else
Hi, Bao
check_rebuild() { [snip] kdump_kernel="${KDUMP_BOOTDIR}/${KDUMP_IMG}-${kdump_kver}${KDUMP_IMG_EXT}" setup_target_initrd [snip]
The first use of KDUMP_BOOTDIR is in check_rebuild, so should move the adjust_boot_dir to check_rebuild or at the beggining of kdumpctl and after sourcing sysconfig
Otherwise, it looks good
Thanks Dave
On 01/28/15 at 04:56pm, Dave Young wrote:
On 01/28/15 at 04:29pm, Baoquan He wrote:
Previously /boot is asumed as the default dir where kernel and initrd is put. However, the directory containing the running kernel image on Atomic systems differs in each installation. Usually something like:
/boot/ostree/rhel-atomic-host-b50a015b637c353dc6554c851f8a1212b60d6121a7316715e4a63e2a4113cd72
This means that kdump will not find vmlinuz when installed on an Atomic host, and thus the kdump service will fail to start.
In this patch, get the sub directory where kernel is put and append it to /boot.
Note: If user change KDUMP_BOOTDIR to other directory, then he need to take care of all related things himself. Otherswise situation will become complicated.
Signed-off-by: Baoquan He bhe@redhat.com
kdumpctl | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/kdumpctl b/kdumpctl index 1c97405..aac1118 100755 --- a/kdumpctl +++ b/kdumpctl @@ -292,6 +292,15 @@ get_pcs_cluster_modified_files() echo $modified_files }
+adjust_boot_dir() +{
- #If user specify different boot dir then /boot, he need take care of
- # the whole thing like /boot//ostree/rhel-atomicxxxx/vmlinuz-xxx
- [ $KDUMP_BOOTDIR != "/boot" ] && return
eval $(cat /proc/cmdline | grep "BOOT_IMAGE" | cut -d' ' -f1)
KDUMP_BOOTDIR=$KDUMP_BOOTDIR$(dirname $BOOT_IMAGE)
+}
setup_target_initrd() { if [ $DEFAULT_DUMP_MODE == "fadump" ]; then @@ -311,6 +320,8 @@ check_rebuild() local _force_rebuild force_rebuild="0" local initramfs_has_fadump
- adjust_boot_dir
- if [ -z "$KDUMP_KERNELVER" ]; then kdump_kver=`uname -r` else
Hi, Bao
check_rebuild() { [snip] kdump_kernel="${KDUMP_BOOTDIR}/${KDUMP_IMG}-${kdump_kver}${KDUMP_IMG_EXT}" setup_target_initrd [snip]
The first use of KDUMP_BOOTDIR is in check_rebuild, so should move the adjust_boot_dir to check_rebuild or at the beggining of kdumpctl and after sourcing sysconfig
Otherwise, it looks good
Hmm, I missed the diff context line.
Acked-by: Dave Young dyoung@redhat.com
On 01/28/15 at 04:29pm, Baoquan He wrote:
Previously /boot is asumed as the default dir where kernel and initrd is put. However, the directory containing the running kernel image on Atomic systems differs in each installation. Usually something like:
/boot/ostree/rhel-atomic-host-b50a015b637c353dc6554c851f8a1212b60d6121a7316715e4a63e2a4113cd72
This means that kdump will not find vmlinuz when installed on an Atomic host, and thus the kdump service will fail to start.
In this patch, get the sub directory where kernel is put and append it to /boot.
Note: If user change KDUMP_BOOTDIR to other directory, then he need to take care of all related things himself. Otherswise situation will become complicated.
Signed-off-by: Baoquan He bhe@redhat.com
kdumpctl | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/kdumpctl b/kdumpctl index 1c97405..aac1118 100755 --- a/kdumpctl +++ b/kdumpctl @@ -292,6 +292,15 @@ get_pcs_cluster_modified_files() echo $modified_files }
+adjust_boot_dir() +{
- #If user specify different boot dir then /boot, he need take care of
- # the whole thing like /boot//ostree/rhel-atomicxxxx/vmlinuz-xxx
- [ $KDUMP_BOOTDIR != "/boot" ] && return
eval $(cat /proc/cmdline | grep "BOOT_IMAGE" | cut -d' ' -f1)
KDUMP_BOOTDIR=$KDUMP_BOOTDIR$(dirname $BOOT_IMAGE)
+}
setup_target_initrd() { if [ $DEFAULT_DUMP_MODE == "fadump" ]; then @@ -311,6 +320,8 @@ check_rebuild() local _force_rebuild force_rebuild="0" local initramfs_has_fadump
- adjust_boot_dir
- if [ -z "$KDUMP_KERNELVER" ]; then kdump_kver=`uname -r` else
It looks good to me.
Thanks Minfei
-- 1.8.5.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On Wed, Jan 28, 2015 at 04:29:52PM +0800, Baoquan He wrote:
Previously /boot is asumed as the default dir where kernel and initrd is put. However, the directory containing the running kernel image on Atomic systems differs in each installation. Usually something like:
/boot/ostree/rhel-atomic-host-b50a015b637c353dc6554c851f8a1212b60d6121a7316715e4a63e2a4113cd72
This means that kdump will not find vmlinuz when installed on an Atomic host, and thus the kdump service will fail to start.
In this patch, get the sub directory where kernel is put and append it to /boot.
Note: If user change KDUMP_BOOTDIR to other directory, then he need to take care of all related things himself. Otherswise situation will become complicated.
Bao,
I don't think that we should adjust boot directory unconditionally. What if I put a vmlinuz in /boot dir for testing and I want to test it? kdump will not use that vmlinuz.
I think a better approach is to first look for vmlinuz in /boot direct as specified by user and if you don't find one there, then you adjust the directory. That will make sure that existing users of the functionality are not broken.
Thanks Vivek
Signed-off-by: Baoquan He bhe@redhat.com
kdumpctl | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/kdumpctl b/kdumpctl index 1c97405..aac1118 100755 --- a/kdumpctl +++ b/kdumpctl @@ -292,6 +292,15 @@ get_pcs_cluster_modified_files() echo $modified_files }
+adjust_boot_dir() +{
- #If user specify different boot dir then /boot, he need take care of
- # the whole thing like /boot//ostree/rhel-atomicxxxx/vmlinuz-xxx
- [ $KDUMP_BOOTDIR != "/boot" ] && return
eval $(cat /proc/cmdline | grep "BOOT_IMAGE" | cut -d' ' -f1)
KDUMP_BOOTDIR=$KDUMP_BOOTDIR$(dirname $BOOT_IMAGE)
+}
setup_target_initrd() { if [ $DEFAULT_DUMP_MODE == "fadump" ]; then @@ -311,6 +320,8 @@ check_rebuild() local _force_rebuild force_rebuild="0" local initramfs_has_fadump
- adjust_boot_dir
- if [ -z "$KDUMP_KERNELVER" ]; then kdump_kver=`uname -r` else
-- 1.8.5.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 01/28/15 at 09:40am, Vivek Goyal wrote:
On Wed, Jan 28, 2015 at 04:29:52PM +0800, Baoquan He wrote:
Previously /boot is asumed as the default dir where kernel and initrd is put. However, the directory containing the running kernel image on Atomic systems differs in each installation. Usually something like:
/boot/ostree/rhel-atomic-host-b50a015b637c353dc6554c851f8a1212b60d6121a7316715e4a63e2a4113cd72
This means that kdump will not find vmlinuz when installed on an Atomic host, and thus the kdump service will fail to start.
In this patch, get the sub directory where kernel is put and append it to /boot.
Note: If user change KDUMP_BOOTDIR to other directory, then he need to take care of all related things himself. Otherswise situation will become complicated.
Bao,
I don't think that we should adjust boot directory unconditionally. What if I put a vmlinuz in /boot dir for testing and I want to test it? kdump will not use that vmlinuz.
It's the same for /boot/vmlinuz. Say now KDUMP_BOOTDIR is /boot, then for /boot/vmlinuz-xxx, in /proc/cmdline it should be "BOOT_IMAGE=/boot/vmlinuz-xxx". So with this patch it will be "/" using dirname. It's OK to append "/" to /boot.
I am nor sure whether I get your meaning.
This patch relies on a assumption that kenrel and initrd are in the same dir and 1st kernel and 2nd kenrel is the same. Otherwise user need specify everything themselves.
On Wed, Jan 28, 2015 at 11:31:51PM +0800, Baoquan He wrote:
On 01/28/15 at 09:40am, Vivek Goyal wrote:
On Wed, Jan 28, 2015 at 04:29:52PM +0800, Baoquan He wrote:
Previously /boot is asumed as the default dir where kernel and initrd is put. However, the directory containing the running kernel image on Atomic systems differs in each installation. Usually something like:
/boot/ostree/rhel-atomic-host-b50a015b637c353dc6554c851f8a1212b60d6121a7316715e4a63e2a4113cd72
This means that kdump will not find vmlinuz when installed on an Atomic host, and thus the kdump service will fail to start.
In this patch, get the sub directory where kernel is put and append it to /boot.
Note: If user change KDUMP_BOOTDIR to other directory, then he need to take care of all related things himself. Otherswise situation will become complicated.
Bao,
I don't think that we should adjust boot directory unconditionally. What if I put a vmlinuz in /boot dir for testing and I want to test it? kdump will not use that vmlinuz.
It's the same for /boot/vmlinuz. Say now KDUMP_BOOTDIR is /boot, then for /boot/vmlinuz-xxx, in /proc/cmdline it should be "BOOT_IMAGE=/boot/vmlinuz-xxx". So with this patch it will be "/" using dirname. It's OK to append "/" to /boot.
I am nor sure whether I get your meaning.
Bao, say you are booted into with BOOT_IMAGE=/boot/ostree/<foo1>/<foo2>/ dir. Now for debugging I drop my own vmlinuz in /boot/ directory. In that case kdump should load /boot/vmlinuz and not /boot/ostree/<foo1>/<foo2>/vmlinuz.
Thanks Vivek
On 01/28/15 at 12:49pm, Vivek Goyal wrote:
On Wed, Jan 28, 2015 at 11:31:51PM +0800, Baoquan He wrote:
On 01/28/15 at 09:40am, Vivek Goyal wrote:
On Wed, Jan 28, 2015 at 04:29:52PM +0800, Baoquan He wrote:
Previously /boot is asumed as the default dir where kernel and initrd is put. However, the directory containing the running kernel image on Atomic systems differs in each installation. Usually something like:
/boot/ostree/rhel-atomic-host-b50a015b637c353dc6554c851f8a1212b60d6121a7316715e4a63e2a4113cd72
This means that kdump will not find vmlinuz when installed on an Atomic host, and thus the kdump service will fail to start.
In this patch, get the sub directory where kernel is put and append it to /boot.
Note: If user change KDUMP_BOOTDIR to other directory, then he need to take care of all related things himself. Otherswise situation will become complicated.
Bao,
I don't think that we should adjust boot directory unconditionally. What if I put a vmlinuz in /boot dir for testing and I want to test it? kdump will not use that vmlinuz.
It's the same for /boot/vmlinuz. Say now KDUMP_BOOTDIR is /boot, then for /boot/vmlinuz-xxx, in /proc/cmdline it should be "BOOT_IMAGE=/boot/vmlinuz-xxx". So with this patch it will be "/" using dirname. It's OK to append "/" to /boot.
I am nor sure whether I get your meaning.
Bao, say you are booted into with BOOT_IMAGE=/boot/ostree/<foo1>/<foo2>/ dir. Now for debugging I drop my own vmlinuz in /boot/ directory. In that case kdump should load /boot/vmlinuz and not /boot/ostree/<foo1>/<foo2>/vmlinuz.
For the case you mentioned we can fix as below:
Set default value in sysconfig as blank like below: KDUMP_BOOTDIR=""
In kdumpctl code we can set the default value as /boot, as for atomic case we can set the default value as /boot/ostree/...
So if user want a debug kernel under /boot they need specify /boot in sysconfig or we will use our internal default directory name.
Thanks Dave
On Wed, Jan 28, 2015 at 04:29:52PM +0800, Baoquan He wrote:
Previously /boot is asumed as the default dir where kernel and initrd is put. However, the directory containing the running kernel image on Atomic systems differs in each installation. Usually something like:
/boot/ostree/rhel-atomic-host-b50a015b637c353dc6554c851f8a1212b60d6121a7316715e4a63e2a4113cd72
This means that kdump will not find vmlinuz when installed on an Atomic host, and thus the kdump service will fail to start.
In this patch, get the sub directory where kernel is put and append it to /boot.
Note: If user change KDUMP_BOOTDIR to other directory, then he need to take care of all related things himself. Otherswise situation will become complicated.
Signed-off-by: Baoquan He bhe@redhat.com
kdumpctl | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/kdumpctl b/kdumpctl index 1c97405..aac1118 100755 --- a/kdumpctl +++ b/kdumpctl @@ -292,6 +292,15 @@ get_pcs_cluster_modified_files() echo $modified_files }
+adjust_boot_dir() +{
Also let us put some comments before this function to explain why we are doing this? Explain that in atomic host configurations, /boot does not have kernel.
Thanks Vivek
- #If user specify different boot dir then /boot, he need take care of
- # the whole thing like /boot//ostree/rhel-atomicxxxx/vmlinuz-xxx
- [ $KDUMP_BOOTDIR != "/boot" ] && return
eval $(cat /proc/cmdline | grep "BOOT_IMAGE" | cut -d' ' -f1)
KDUMP_BOOTDIR=$KDUMP_BOOTDIR$(dirname $BOOT_IMAGE)
+}
setup_target_initrd() { if [ $DEFAULT_DUMP_MODE == "fadump" ]; then @@ -311,6 +320,8 @@ check_rebuild() local _force_rebuild force_rebuild="0" local initramfs_has_fadump
- adjust_boot_dir
- if [ -z "$KDUMP_KERNELVER" ]; then kdump_kver=`uname -r` else
-- 1.8.5.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On Wed, Jan 28, 2015 at 04:29:52PM +0800, Baoquan He wrote:
[..]
+adjust_boot_dir() +{
- #If user specify different boot dir then /boot, he need take care of
- # the whole thing like /boot//ostree/rhel-atomicxxxx/vmlinuz-xxx
- [ $KDUMP_BOOTDIR != "/boot" ] && return
eval $(cat /proc/cmdline | grep "BOOT_IMAGE" | cut -d' ' -f1)
This is assuming that BOOT_IMAGE is always first field in the command line. I think one should always be able to change the order by simple editing of grub.cfg. So let us not make this assumption.
Thanks Vivek
On 01/28/15 at 02:01pm, Vivek Goyal wrote:
On Wed, Jan 28, 2015 at 04:29:52PM +0800, Baoquan He wrote:
[..]
+adjust_boot_dir() +{
- #If user specify different boot dir then /boot, he need take care of
- # the whole thing like /boot//ostree/rhel-atomicxxxx/vmlinuz-xxx
- [ $KDUMP_BOOTDIR != "/boot" ] && return
eval $(cat /proc/cmdline | grep "BOOT_IMAGE" | cut -d' ' -f1)
This is assuming that BOOT_IMAGE is always first field in the command line. I think one should always be able to change the order by simple editing of grub.cfg. So let us not make this assumption.
I discussed this yetoday with Bao, finally we found that grub is passing the BOOT_IMAGE as 1st cmdline param.
linux16 /vmlinuz.. linuxefi /vmlinuz...
The first param is the kernel file, grub will convert it to BOOT_IMAGE=/vmlinuz... and then pass to kernel for booting.
If you specify vmlinuz not as 1st param to linux16/linuxefi then kernel boot will fail. So this should be ok to me.
Thanks Dave
On 01/29/15 at 09:51am, Dave Young wrote:
On 01/28/15 at 02:01pm, Vivek Goyal wrote:
On Wed, Jan 28, 2015 at 04:29:52PM +0800, Baoquan He wrote:
[..]
+adjust_boot_dir() +{
- #If user specify different boot dir then /boot, he need take care of
- # the whole thing like /boot//ostree/rhel-atomicxxxx/vmlinuz-xxx
- [ $KDUMP_BOOTDIR != "/boot" ] && return
eval $(cat /proc/cmdline | grep "BOOT_IMAGE" | cut -d' ' -f1)
This is assuming that BOOT_IMAGE is always first field in the command line. I think one should always be able to change the order by simple editing of grub.cfg. So let us not make this assumption.
I discussed this yetoday with Bao, finally we found that grub is passing the BOOT_IMAGE as 1st cmdline param.
linux16 /vmlinuz.. linuxefi /vmlinuz...
The first param is the kernel file, grub will convert it to BOOT_IMAGE=/vmlinuz... and then pass to kernel for booting.
If you specify vmlinuz not as 1st param to linux16/linuxefi then kernel boot will fail. So this should be ok to me.
BTW, I have a comment for finding the BOOT_IMAGE below: https://bugzilla.redhat.com/show_bug.cgi?id=1185460#c7
Both Bao's approach and mine are ok to me.
Thanks Dave
On 01/28/15 at 02:01pm, Vivek Goyal wrote:
On Wed, Jan 28, 2015 at 04:29:52PM +0800, Baoquan He wrote:
[..]
+adjust_boot_dir() +{
- #If user specify different boot dir then /boot, he need take care of
- # the whole thing like /boot//ostree/rhel-atomicxxxx/vmlinuz-xxx
- [ $KDUMP_BOOTDIR != "/boot" ] && return
eval $(cat /proc/cmdline | grep "BOOT_IMAGE" | cut -d' ' -f1)
This is assuming that BOOT_IMAGE is always first field in the command line. I think one should always be able to change the order by simple editing of grub.cfg. So let us not make this assumption.
I had a test and it have to be at the head, otherwise it can't find vmlinuz-xxx. This can make code simple and easier to read. And kernel produce the /proc/cmdline, it should always be that BOOT_IMAGE is the first field in cmdline. If later a different situation reported, we can change it like Dave suggested.
Anyway, I think for now this way is enough. If you or someone else insist that this is not good, I can change.
Thanks Vivek