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.
Reported-by: Jie Li <jieli(a)redhat.com>
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
kexec-tools.spec | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/kexec-tools.spec b/kexec-tools.spec
index ac134da..6b7ef14 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -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
--
2.34.1