Resolves: bz2089871
Currently, kexec-tools can't be updated using virt-customize because
older version of kdumpctl can't acquire instance lock for the
get-default-crashkernel subcommand. The reason is /var/lock is linked to
/run/lock however /run doesn't exist in the case of virt-customize.
This patch fixes this problem by creating /run/lock before creating the
lock file.
Note
1. The lock file is now created in /run/lock instead of /var/run/lock since
Fedora has adopted adopted /run [2] since F15.
2. %pre scriptlet now always return success since package update won't
be blocked
[1]
https://fedoraproject.org/wiki/Features/var-run-tmpfs
Fixes: 0adb0f4 ("try to reset kernel crashkernel when kexec-tools updates the default
crashkernel value")
Reported-by: Nicolas Hicher <nhicher(a)redhat.com>
Suggested-by: Laszlo Ersek <lersek(a)redhat.com>
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
kdumpctl | 18 +++++++++++++++++-
kexec-tools.spec | 2 ++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl
index 6188d47..439276d 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -47,11 +47,27 @@ if ! dlog_init; then
exit 1
fi
+# rmdir /run/lock if it's created by kdumpctl
+clean_up_run_lock()
+{
+ if [[ $(echo /run/lock/*) == /run/lock/kdump ]]; then
+ rm /run/lock/kdump
+ rmdir /run/lock
+ fi
+}
+
+trap clean_up_run_lock EXIT
+
single_instance_lock()
{
local rc timeout=5
- if ! exec 9> /var/lock/kdump; then
+ # when updating package using virt-customize, /run/lock doesn't exist
+ if [[ ! -d /run/lock ]]; then
+ mkdir /run/lock
+ fi
+
+ if ! exec 9> /run/lock/kdump; then
derror "Create file lock failed"
exit 1
fi
diff --git a/kexec-tools.spec b/kexec-tools.spec
index 9c6ea8d..b66f97e 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -269,6 +269,8 @@ if ! grep -qs "ostree" /proc/cmdline && [ $1 == 2 ]
&& grep -q get-default-crash
kdumpctl get-default-crashkernel fadump > /tmp/old_default_crashkernel_fadump
2>/dev/null
%endif
fi
+# don't block package update
+:
%post
# Initial installation
--
2.35.3