update kernel crashkernel in posttrans RPM scriptlet when updating kexec-tools
Resolves: bz2051822
Upstream: Fedora
Conflict: None
commit 311b5b100b
Author: Coiby Xu <coxu@redhat.com>
Date: Fri Feb 11 13:11:17 2022 +0800
update kernel crashkernel in posttrans RPM scriptlet when updating kexec-tools
When doing in-place upgrading using leapp on x86_64, kdumpcl can't
acquire instance lock when running in %post RPM scriplet on x86_64,
localhost upgrade[1306]: /bin/kdumpctl: line 49: /var/lock/kdump: No such file or directory
localhost upgrade[1306]: kdump: Create file lock failed
and running "touch /var/lock/dkump" also fails with
"No such file or directory". Thus kdumpctl can't be run in %post
scriptlet. But kdumpctl can be run in %posttrans RPM scriplet.
Besides, it's better to update crashkernel after the kernel has been
updated. So let's update kernel crashkernel in the %posttrans
scriptlet which will be run in the end of a transaction i.e. after
the kernel has been updated.
Note for %posttrans scriptlet, "$1 == 1" means both installing a new
package and upgrading a package.
[1] https://github.com/apptainer/singularity/issues/2386#issuecomment-474747054
Reported-by: Jie Li <jieli@redhat.com>
Signed-off-by: Coiby Xu <coxu@redhat.com>
Reviewed-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Coiby Xu <coxu@redhat.com>
This commit is contained in:
parent
e2d1f68d0f
commit
06b51aac41
@ -306,19 +306,6 @@ then
|
|||||||
mv /etc/sysconfig/kdump.new /etc/sysconfig/kdump
|
mv /etc/sysconfig/kdump.new /etc/sysconfig/kdump
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# try to reset kernel crashkernel value to new default value when upgrading
|
|
||||||
# the package
|
|
||||||
if ! grep -qs "ostree" /proc/cmdline && [ $1 == 2 ]; then
|
|
||||||
kdumpctl reset-crashkernel-after-update
|
|
||||||
rm /tmp/old_default_crashkernel 2>/dev/null
|
|
||||||
%ifarch ppc64 ppc64le
|
|
||||||
rm /tmp/old_default_crashkernel_fadump 2>/dev/null
|
|
||||||
%endif
|
|
||||||
# dnf would complain about the exit code not being 0. To keep it happy,
|
|
||||||
# always return 0
|
|
||||||
:
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
%systemd_postun_with_restart kdump.service
|
%systemd_postun_with_restart kdump.service
|
||||||
@ -351,6 +338,21 @@ do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
%posttrans
|
||||||
|
# try to reset kernel crashkernel value to new default value when upgrading
|
||||||
|
# the package
|
||||||
|
if ! grep -qs "ostree" /proc/cmdline && [ $1 == 1 ]; then
|
||||||
|
kdumpctl reset-crashkernel-after-update
|
||||||
|
rm /tmp/old_default_crashkernel 2>/dev/null
|
||||||
|
%ifarch ppc64 ppc64le
|
||||||
|
rm /tmp/old_default_crashkernel_fadump 2>/dev/null
|
||||||
|
%endif
|
||||||
|
# dnf would complain about the exit code not being 0. To keep it happy,
|
||||||
|
# always return 0
|
||||||
|
:
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
%files
|
%files
|
||||||
/usr/sbin/kexec
|
/usr/sbin/kexec
|
||||||
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
|
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
|
||||||
|
Loading…
Reference in New Issue
Block a user