On Thu, Jan 20, 2022 at 04:25:19PM +0100, Philipp Rudo wrote:
On Thu, 20 Jan 2022 14:43:08 +0800
[..]
> 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.
kernel is indeed a special case for dnf and I can't help laughing out loud
when happening to read this commit message of the dnf repo,
commit 4e625f935c725893b2db7b5719febd7c4d42b44e
Author: Seth Vidal <skvidal(a)linux.duke.edu>
Date: Sun Jun 9 21:03:21 2002 +0000
ridiculous special case for the kernel.
I think I'm going to cry
But it turns out the installation order doesn't matter for our osbuild case
because posttrans scriptlet by definition means it would be executed as
the last step of a transaction i.e. it would be executed afer all packages
have been installed. So after both kexec-tools and kernel* packages are
installed, The posttrans scriptlet of the kernel-core package would
invoke kernel-install which in turn would run the kernel hooks in
/usr/lib/kernel/install.d/ including 92-crashkernel.install,
$ rpm -q --scripts -p kernel-core-5.16.2-200.fc35.x86_64.rpm
...
posttrans scriptlet (using /bin/sh):
/bin/kernel-install add 5.16.2-200.fc35.x86_64 /lib/modules/5.16.2-200.fc35.x86_64/vmlinuz
|| exit $?
Btw, although kernel is installed after kexec-tooks, kernel-core is
actually installed before kexec-tools,
Installing : kernel-core-5.14.0-39.el9.x86_64 151/163
Running scriptlet: kernel-core-5.14.0-39.el9.x86_64 151/163
...
Running scriptlet: kexec-tools-2.0.23-2.fc36.x86_64 162/163
Installing : kexec-tools-2.0.23-2.fc36.x86_64 162/163
Running scriptlet: kexec-tools-2.0.23-2.fc36.x86_64 162/163
Created symlink /etc/systemd/system/multi-user.target.want
Installing : kernel-5.14.0-39.el9.x86_64 163/163
...
Running scriptlet: kernel-core-5.14.0-39.el9.x86_64 163/163
Fortunately, kernel-core's posttrans scriptlet is guaranteed to be run
after all packages have been installed.
[2]
https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#ord...
--
Best regards,
Coiby