On Thu, 20 Jan 2022 14:43:08 +0800
Coiby Xu <coxu(a)redhat.com> wrote:
Hi Philipp,
On Wed, Jan 19, 2022 at 04:48:57PM +0100, Philipp Rudo wrote:
>Hi Coiby,
>
>I think I found an other problem related to this location...
>
>On Wed, 19 Jan 2022 14:33:25 +0800
>Coiby Xu <coxu(a)redhat.com> wrote:
>
>> The environment variable entries in /proc/[pid]/environ are separated by
>> null bytes instead of by spaces. Update the sed regex to fix this issue.
>>
>> Note this patch also fixes a issue which is kdumpctl would try to reset
>> crashkernel even osbuild has provided custom crashkernel value.
>>
>> Fixes: ddd428a ("set up kernel crashkernel for osbuild in kernel
hook")
>> Signed-off-by: Coiby Xu <coxu(a)redhat.com>
>> ---
>> kdumpctl | 8 +++++---
>> 1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/kdumpctl b/kdumpctl
>> index 8107487..b32fac0 100755
>> --- a/kdumpctl
>> +++ b/kdumpctl
>> @@ -1578,7 +1578,7 @@ reset_crashkernel_after_update()
>>
>> _is_osbuild()
>> {
>> - [[ $(sed -n -E 's/.*(^|\s)container=(\S*).*/\2/p' <
/proc/1/environ) == bwrap-osbuild ]]
>> + [[ $(sed -n -E 's/.*(^|\x00)container=([^\x00]*).*/\2/p' <
/proc/1/environ) == bwrap-osbuild ]]
>> }
>>
>> reset_crashkernel_for_installed_kernel()
>> @@ -1590,8 +1590,10 @@ reset_crashkernel_for_installed_kernel()
>> exit 1
>> fi
>>
>> - if _is_osbuild && ! grep -qs crashkernel= /etc/kernel/cmdline; then
>> - reset_crashkernel "--kernel=$_installed_kernel"
>> + if _is_osbuild; then
>> + if ! grep -qs crashkernel= /etc/kernel/cmdline; then
>> + reset_crashkernel "--kernel=$_installed_kernel"
>
>When parsing the --kernel option in reset_crashkernel it calls
>_valid_grubby_kernel_path to verify the given path. But that
>function relies on grubby being installed which needn't be the
>case when _is_osbuild is true.
Thanks for raising up this concern!
Since kexec-tools recommends grubby, grubby has been there when the kernel
hook 92-crashkernel.install is being called.
true, I missed that. I think I also mixed up osbuild and ostree...
Btw, I was wrong that kernel recommends kexec-tools but somehow
kernel
is installed after kexec-tools for osbuild [1]. The order is also the
same when I run,
dnf install kernel-core kexec-tools --installroot=/ROOTDIR
I'm yet to find out why it's so.
I imagine that this could also be some special handling for the kernel
in dnf. Usually you want to have all programs that are included into
the initramfs to be installed before the kernel. Otherwise the
initramfs could still contain the old, buggy version of a program even
with the new, fixed version being installed. But keeping track of all
such dependencies sounds pretty difficult. Always installing the kernel
last would be a simple solution for that problem.
Thanks
Philipp
[1]
https://bugzilla.redhat.com/show_bug.cgi?id=2024976#c5
>Or am I missing something?
>
>Thanks
>Philipp
>
>> + fi
>> return
>> fi
>>
>