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 which however doesn't exist in the case of virt-customize.
This patch fixes this problem by using /tmp/kdump.lock as the lock file if /run/lock doesn't exist.
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@redhat.com Suggested-by: Laszlo Ersek lersek@redhat.com Suggested-by: Philipp Rudo prudo@redhat.com Signed-off-by: Coiby Xu coxu@redhat.com --- v2 - use /tmp/kdump.lock as the lock file if /run/lock doesn't exist [Philipp]
--- kdumpctl | 11 +++++++++-- kexec-tools.spec | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/kdumpctl b/kdumpctl index 6188d47..29bf533 100755 --- a/kdumpctl +++ b/kdumpctl @@ -49,9 +49,16 @@ fi
single_instance_lock() { - local rc timeout=5 + local rc timeout=5 lockfile
- if ! exec 9> /var/lock/kdump; then + if [[ -d /run/lock ]]; then + lockfile=/run/lock/kdump + else + # when updating package using virt-customize, /run/lock doesn't exist + lockfile=/tmp/kdump.lock + fi + + if ! exec 9> $lockfile; 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