#11 [draft] allow to update kexec-tools using virt-customize for cloud base image
Closed 2 years ago by coiby. Opened 2 years ago by coiby.
rpms/ coiby/kexec-tools virtcustomize_fix  into  rawhide

@@ -0,0 +1,2 @@ 

+ f /run/lock/kdump 0600 root root -

+ r! /run/lock/kdump

file modified
+1 -1
@@ -51,7 +51,7 @@ 

  {

  	local rc timeout=5

  

- 	if ! exec 9> /var/lock/kdump; then

+ 	if ! exec 9> /run/lock/kdump; then

  		derror "Create file lock failed"

  		exit 1

  	fi

file modified
+13
@@ -44,6 +44,7 @@ 

  Source34: crashkernel-howto.txt

  Source35: kdump-migrate-action.sh

  Source36: kdump-restart.sh

+ Source37: kdump-tempfiles.conf

  

  #######################################

  # These are sources for mkdumpramfs
@@ -196,6 +197,8 @@ 

  install -m 755 %{SOURCE20} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib.sh

  install -m 755 %{SOURCE23} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib-initramfs.sh

  install -m 755 %{SOURCE31} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-logger.sh

+ mkdir -p $RPM_BUILD_ROOT%{_tmpfilesdir}

+ install -m644 %{SOURCE37} $RPM_BUILD_ROOT%{_tmpfilesdir}/kdump-tempfiles.conf

  %ifarch ppc64 ppc64le

  install -m 755 %{SOURCE32} $RPM_BUILD_ROOT/usr/sbin/mkfadumprd

  install -m 755 %{SOURCE35} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-migrate-action.sh
@@ -262,6 +265,11 @@ 

  mv $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/* $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/

  

  %pre

+ # Although current "kdumpctl get-default-crashkernel" doesn't require single,

+ # older kdumpctl still does. Maybe in next release of Fedora/RHEL, we can

+ # create /run/lock in %post scriptlet instead.

+ echo "%(cat %SOURCE37)" | systemd-tmpfiles create

+ 

  # save the old default crashkernel values to /tmp/ when upgrading the package

  if ! grep -qs "ostree" /proc/cmdline && [ $1 == 2 ] && grep -q get-default-crashkernel /usr/bin/kdumpctl; then

    kdumpctl get-default-crashkernel kdump > /tmp/old_default_crashkernel 2>/dev/null
@@ -270,6 +278,9 @@ 

  %endif

  fi

  

+ # always return 0 so RPM update won't be blocked by failture of scriplet

+ :

+ 

  %post

  # Initial installation

  %systemd_post kdump.service
@@ -390,6 +401,8 @@ 

  %{_prefix}/lib/systemd/system-generators/kdump-dep-generator.sh

  %{_prefix}/lib/kernel/install.d/60-kdump.install

  %{_prefix}/lib/kernel/install.d/92-crashkernel.install

+ %{_tmpfilesdir}/kdump-tempfiles.conf

+ %ghost /run/lock/kdump

  %doc News

  %license COPYING

  %doc TODO

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.

This patch fixes this problem by creating /run with systemd-tmpfiles [1].
Also use /run/lock instead of /var/run/lock since Fedora has adopted
/run [2] since F15.

Note currently, we call systemd-tmpfiles in the %pre scriptlet because
old versions of kdumpctl still require single instance lock. When this
is not the case e.g. in the future release of Fedora, we can call
systemd-tmpfiles in the %post RPM scriptlet instead.

[1] https://fedoraproject.org/wiki/Packaging:Tmpfiles.d
[2] https://fedoraproject.org/wiki/Features/var-run-tmpfs

Reported-by: Nicolas Hicher nhicher@redhat.com
Suggested-by: Laszlo Ersek lersek@redhat.com

Build succeeded.

Build succeeded.

Pull-Request has been closed by coiby

2 years ago