Allow to update kexec-tools using virt-customize for cloud base image

Resolves: bz2089871
Upstream: Fedora
Conflict: None

commit da0ca0d205
Author: Coiby Xu <coxu@redhat.com>
Date:   Tue Jun 28 14:38:28 2022 +0800

    Allow to update kexec-tools using virt-customize for cloud base image

    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>
    Reviewed-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
This commit is contained in:
Coiby Xu 2022-09-19 09:03:48 +08:00
parent bd92125753
commit 928c386f97
2 changed files with 11 additions and 2 deletions

View File

@ -44,9 +44,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

View File

@ -275,6 +275,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