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 653170 - kmodtool %preun scriptlet fails when uninstalling kmod packages
Summary: kmodtool %preun scriptlet fails when uninstalling kmod packages
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: redhat-rpm-config
Version: 6.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Jon Masters
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-11-14 21:25 UTC by Phil Perry
Modified: 2011-02-04 12:52 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-02-04 12:52:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Phil Perry 2010-11-14 21:25:02 UTC
Description of problem:
Uninstalling kmod packages built with kmodtool fails due to the %preun scriptlet

Version-Release number of selected component (if applicable):
redhat-rpm-config-9.0.3-25.el6.noarch

How reproducible:
always

Steps to Reproduce:
1. Build a kmod package with kmodtool
2. Install kmod package from step 1
3. Attempt to uninstall kmod package
  
Actual results:
# rpm -e kmod-hellop
error: ^%{kmod_version}$: regcomp failed: Invalid content of \{\}
error: %preun(kmod-hellop-0.5-1.el6.elrepo.x86_64) scriptlet failed, exit status

Expected results:
The package uninstalls cleanly

Additional info:
The error is due to the %preun scriptlet in kmodtool:

cat <<EOF
%preun         -n kmod-${kmod_name}${dashvariant}
rpm -ql kmod-${kmod_name}${dashvariant}-%{kmod_version}-%{kmod_release}.$(arch) | grep '\.ko$' > /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules
EOF

The following code fixes the issue:

cat <<EOF
%preun         -n kmod-${kmod_name}${dashvariant}
rpm -ql kmod-${kmod_name}${dashvariant}-%{version}-%{release}.$(arch) | grep '\.ko$' > /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules
EOF

Comment 2 Jon Masters 2010-11-16 17:08:01 UTC
Are you using the %kernel_module_package RPM macro to build your package?

Comment 3 Phil Perry 2010-11-16 22:43:29 UTC
No, I'm just building with rpmbuild as we do on RHEL5:

rpmbuild -ba --target=`uname -m` foo.spec

Looking in the %kernel_module_package RPM macro, I see %{kmod_version} and %{kmod_release} are defined there so that is probably my mistake. Thanks for the heads up.

Comment 4 Jon Masters 2010-11-18 07:27:47 UTC
No problem. I see you pinged me on IRC earlier. I apologize that I missed you. I have been operating on various timezones over the past few days (not physically, just long hours). Please do ping me again Thu or Fri afternoon.

Comment 5 Phil Perry 2010-11-18 19:13:46 UTC
No worries Jon - just wanted to run this past you before filing a bug if you were around.

As I didn't explain very well above, we are still calling kmodtool's rpmtemplate in our SPEC file for RHEL6 builds, much like we did for RHEL5, hence why %{kmod_version} and %{kmod_release} throw up errors when the %preun scriptlet is run.

%{expand:%(%{kmodtool} rpmtemplate %{kmod_name} %{kversion} %{kvariants} 2>/dev/null)}

I hope to get some time this weekend to take a closer look at the %kernel_module_package macro.

Comment 8 Jon Masters 2011-02-04 12:52:42 UTC
I meant to say before, I don't consider this a bug. As I mentioned, those two macros: %kmod_version and %kmod_release are defined as a result of using %kernel_module_package.

We have since spoken by email about RHEL6, and the process of using these macros. So, I'm going to close this bug now and then we can discuss the best way for you to use the RHEL6 macros. If you don't want to switch to %kernel_module_package (yet), then you can of course just define those two macros yourself for now (and for "legacy" RHEL6 packages that already might exist).

Jon.


Note You need to log in before you can comment on or make changes to this bug.