Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1930108

Summary: kpatch-patch RPM package does not mark /var/lib/kpatch/$(uname -r) as part of the RPM package
Product: Red Hat Enterprise Linux 8 Reporter: Archana Pandey <arpandey>
Component: kpatchAssignee: Artem Savkov <asavkov>
kpatch sub component: kpatch-utility QA Contact: zhijwang <zhijwang>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: unspecified CC: asavkov, bhu, dbohanno, kpatch-maint, redakkan, rhandlin, ykopkova, zhijwang
Version: 8.2Keywords: Triaged
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: 8.5   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: kpatch-0.9.2-5.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of:
: 1954356 (view as bug list) Environment:
Last Closed: 2021-11-09 19:28:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1954356    

Description Archana Pandey 2021-02-18 11:36:10 UTC
Description of problem:

After uninstalling kpatch-patch-$(uname -r) respective directory doesn't get removed from /var/lib/kpatch/.
Probable cause appears that directory /var/lib/kpatch/$(uname-r) not being marked as part of rpm package.

Version-Release number of selected component (if applicable):
[root@kvm-02-guest03 /]# rpm -qa kpatch
kpatch-0.6.1-6.el8.noarch

[root@kvm-02-guest03 /]# uname -r
4.18.0-193.el8.x86_64
[root@kvm-02-guest03 /]# 

[root@kvm-02-guest03 /]# rpm -qa kpatch-patch*
kpatch-patch-4_18_0-193-1-7.el8.x86_64
[root@kvm-02-guest03 /]#

How reproducible:


Steps to Reproduce:
[root@kvm-02-guest03 /]# kpatch list
Loaded patch modules:
kpatch_4_18_0_193_1_7 [enabled]

Installed patch modules:
kpatch_4_18_0_193_1_7 (4.18.0-193.el8.x86_64)
[root@kvm-02-guest03 /]# 
[root@kvm-02-guest03 /]# rpm -qf /var/lib/kpatch/4.18.0-193.el8.x86_64/kpatch-4_18_0-193-1-7.ko
file /var/lib/kpatch/4.18.0-193.el8.x86_64/kpatch-4_18_0-193-1-7.ko is not owned by any package
[root@kvm-02-guest03 /]# 
[root@kvm-02-guest03 /]# 
[root@kvm-02-guest03 /]# yum remove "kpatch-patch = $(uname -r)"
Updating Subscription Management repositories.
Dependencies resolved.
======================================================================================================================================================
 Package                                  Architecture            Version                       Repository                                       Size
======================================================================================================================================================
Removing:
 kpatch-patch-4_18_0-193                  x86_64                  1-7.el8                       @rhel-8-for-x86_64-baseos-rpms                   75 k
Removing unused dependencies:
 binutils                                 x86_64                  2.30-79.el8                   @rhel-8-for-x86_64-baseos-rpms                   24 M
 kpatch                                   noarch                  0.6.1-6.el8                   @beaker-BaseOS                                   15 k

Transaction Summary
======================================================================================================================================================
Remove  3 Packages

Freed space: 24 M
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                              1/1 
  Running scriptlet: kpatch-patch-4_18_0-193-1-7.el8.x86_64                                                                                       1/1 
  Erasing          : kpatch-patch-4_18_0-193-1-7.el8.x86_64                                                                                       1/3 
  Running scriptlet: kpatch-patch-4_18_0-193-1-7.el8.x86_64                                                                                       1/3 
uninstalling kpatch-4_18_0-193-1-7.ko (4.18.0-193.el8.x86_64)

  Erasing          : kpatch-0.6.1-6.el8.noarch                                                                                                    2/3 
  Running scriptlet: kpatch-0.6.1-6.el8.noarch                                                                                                    2/3 
  Running scriptlet: binutils-2.30-79.el8.x86_64                                                                                                  3/3 
  Erasing          : binutils-2.30-79.el8.x86_64                                                                                                  3/3 
  Running scriptlet: binutils-2.30-79.el8.x86_64                                                                                                  3/3 
  Verifying        : binutils-2.30-79.el8.x86_64                                                                                                  1/3 
  Verifying        : kpatch-0.6.1-6.el8.noarch                                                                                                    2/3 
  Verifying        : kpatch-patch-4_18_0-193-1-7.el8.x86_64                                                                                       3/3 
Installed products updated.

Removed:
  binutils-2.30-79.el8.x86_64                   kpatch-0.6.1-6.el8.noarch                   kpatch-patch-4_18_0-193-1-7.el8.x86_64                  

Complete!
[root@kvm-02-guest03 /]# 
[root@kvm-02-guest03 /]# ll /var/lib/kpatch/
total 0
drwxr-xr-x. 2 root root 6 Feb 18 12:27 4.18.0-193.el8.x86_64
[root@kvm-02-guest03 /]#                 ^^^^^ directory should be removed after uninstall



Actual results:
directories not cleaned up in /var/lib/kpatch after uninstall


Expected results:
Directory should be removed from /var/lib/kpatch/ after uninstall.

Comment 1 Artem Savkov 2021-02-18 13:26:49 UTC
kpatch-patch package does not install anything into /var/lib/kpatch, but 'kpatch' command does during 'kpatch install' we do in post-install macro. We also do 'kpatch uninstall' in post-uninstall, but that only affects the .ko file leaving the $(uname -r) directory there.

'kpatch uninstall' command should check if the directory still contains any files after uninstallation and remove it if not. Maybe even do the same for /var/lib/kpatch as well.

Comment 10 errata-xmlrpc 2021-11-09 19:28:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (kpatch bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4357