[elrepo] Bug in elrepo template and ?many? packages
Phil Perry
phil at elrepo.org
Wed Mar 3 16:38:15 EST 2021
On 03/03/2021 19:49, Roger Sewell wrote:
>
> Having had difficulty getting initramfs to build correctly when
> upgrading kmod-megaraid_sas from 4.18.0-193.6.3 to a test kernel based
> on 4.18.0-287, and again when downgrading, I think that I have found the
> cause, as follows:
>
> In the elrepo template at
>
> http://elrepo.org/tiki/kmodspec-el8?highlight=template
>
> there is a section of the %posttrans script reading
>
> # The same check as in weak-modules: we assume that the kernel present
> # if the symvers file exists.
> if [ -e "/boot/symvers-$k.gz" ]; then
> /usr/bin/dracut -f "$tmp_initramfs" "$k" || exit 1
>
> However, the corresponding script /sbin/weak-modules from
> kmod-25-16.el8.x86_64 contains the excerpt
>
> # find_symvers_file:
> # Since /boot/ files population process is now controlled by systemd's
> # kernel-install bash script and its plug-ins, it might be the case
> # that, while present, symvers file is not populated in /boot.
> # Let's also check for /lib/modules/$kver/symvers.gz, since that's where
> # it is populated from.
>
> and when I change the %posttrans script in kmod-megaraid_sas to instead
> of the above contain
>
> # The same check as in weak-modules: we assume that the kernel present
> # if the symvers file exists.
> if [ -e "/boot/symvers-$k.gz" -o -e "/lib/modules/$k/symvers.gz" ]; then
> /usr/bin/dracut -f "$tmp_initramfs" "$k" || exit 1
>
> then my upgrading and downgrading between kernel versions works
> correctly with yum upgrade and yum downgrade applied to the relevant
> kmod-megaraid_sas package.
>
> As far as I can see the same issue affects many other elrepo packages
> also.
>
> Please let me know whether or not you agree, as I am in no sense an
> expert.
>
> In addition, if anybody can explain to me
>
> a) why yum/dnf appears to install the new version of a package before
> removing the old version, and/or
>
> b) what the purpose of the lines of the form
>
> if rpm -q --filetriggers kmod 2> /dev/null| grep -q "Trigger for weak-modules call on kmod removal"; then
>
> and the code paragraphs that follows them is, I would be most
> grateful.
>
> Many thanks,
> Roger Sewell.
Hi Roger,
Your analysis is spot on. It's actually a known issue:
https://elrepo.org/bugs/view.php?id=1060
https://bugzilla.redhat.com/show_bug.cgi?id=1909441
https://access.redhat.com/solutions/5681371
and I had queued the fix in my local tree but for some reason not
rebuilt it for the kmod-megaraid_sas package. I'll get that rectified
and push an update out shortly.
In answer to (a), The order RPM executes scripts when upgrading a
package is as follows[1]:
1. Run the %pre section of the RPM being installed.
2. Install the files that the RPM provides.
3. Run the %post section of the RPM.
4. Run the %preun of the old package.
5. Delete any old files not overwritten by the newer version. (This
step deletes files that the new package does not require.)
6. Run the %postun hook of the old package.
[1] https://developer.ibm.com/articles/l-rpm2/
More information about the elrepo
mailing list