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>
This commit is contained in:
parent
2bbc7512a2
commit
311b5b100b
@ -305,19 +305,6 @@ then
|
||||
mv /etc/sysconfig/kdump.new /etc/sysconfig/kdump
|
||||
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
|
||||
%systemd_postun_with_restart kdump.service
|
||||
@ -350,6 +337,21 @@ do
|
||||
fi
|
||||
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
|
||||
/usr/sbin/kexec
|
||||
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
|
||||
|
Loading…
Reference in New Issue
Block a user