Bug 448012 - yum clean fails when non-RHN repositories are configured
yum clean fails when non-RHN repositories are configured
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: yum-rhn-plugin (Show other bugs)
5.2
All Linux
low Severity high
: rc
: ---
Assigned To: Pradeep Kilambi
Jan Hutař
: Regression
: 448138 455401 459666 460294 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-05-22 17:10 EDT by HMDC Linux Support
Modified: 2010-11-10 06:46 EST (History)
24 users (show)

See Also:
Fixed In Version: 0.5.3-26.el5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-01-20 16:55:30 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
patch formReposForClean() in rhnplugin.py to not add repos to RepoStorage object that already exist in it (480 bytes, patch)
2008-05-22 17:10 EDT, HMDC Linux Support
no flags Details | Diff

  None (edit)
Description HMDC Linux Support 2008-05-22 17:10:30 EDT
Description of problem:

The latest release of yum for RHEL5 (yum-3.2.8-9.el5_2.1), fails to successfully
execute the command "yum clean" when third-party yum repositories are configured
(e.g. in /etc/yum/repos.d ). This problem did not exist in yum-3.0.1-5.el5.

It appears that the function formReposForClean() in
/usr/lib/yum-plugins/rhnplugin.py is trying to create a list of repos to clean
up including the repos that yum loads from its configuration files, as well as
the repos that are provided by the rhnplugin. It tries to find the latter by
looking in the yum cache directory directly and appending them to the list of
repos to clean, but this causes the RepoStorage object to raise an exception
when formReposForClean() tries to add a repo that is provided by a configuration
file and not the rhnplugin. This is because those repos are already added to the
RepoStorage object by the earlier call to conduit.getRepos().

How reproducible:


Steps to Reproduce:
1. add a third-party yum repository configuration file in /etc/yum.repos.d
2. yum list foo
   # to read metadata into cache
3. yum clean all
  
Actual results:

# yum clean all
Loading "rhnplugin" plugin
Loading "security" plugin


Repository rpmforge is listed more than once in the configuration


Expected results:

# yum clean all
Loading "rhnplugin" plugin
Loading "security" plugin
Cleaning up Everything


Additional info:

This can be fixed easily by simply checking whether the repo to add (whose name
was found in the cache directory) already exists in the RepoStorage object (i.e.
it was loaded from a configuration file). If it already exists; don't try to add
it again. I am attaching a patch illustrating this fix.

     -Bill
Comment 1 HMDC Linux Support 2008-05-22 17:10:30 EDT
Created attachment 306426 [details]
patch formReposForClean() in rhnplugin.py to not add repos to RepoStorage object that already exist in it
Comment 2 HMDC Linux Support 2008-05-23 11:31:04 EDT
Correction: the file /usr/lib/yum-plugins/rhnplugin.py is actually owned by the
package yum-rhn-plugin (not yum itself), and the patch is against
yum-rhn-plugin-0.5.3-6.el5_2.6 .
Comment 3 James Antill 2008-05-23 14:33:25 EDT
*** Bug 448138 has been marked as a duplicate of this bug. ***
Comment 4 HMDC Linux Support 2008-05-28 16:14:57 EDT
I have also opened Red Hat Support case #1829520 to attempt to promote QA
acceptance of a fix for this issue. It is unclear from a customer perspective
how the public-facing Bugzilla system and the paid-customer-facing Oracle CRM
system are integrated, so I figured it best to submit entries in each and
cross-reference them.

Based on the suggestion of the Red Hat Support tech, I tried downgrading to the
previous version of the yum-rhn-plugin package (yum-rhn-plugin-0.5.3-6.el5), and
confirmed that the problem does not occur with this version of the package. This
seems to indicate that the bug was introduced in yum-rhn-plugin-0.5.3-6.el5_2.6.

     -Bill
Comment 5 RHEL Product and Program Management 2008-06-04 18:43:46 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.
Comment 6 Patrice Guay 2008-06-14 01:48:08 EDT
What are the advantages of yum-rhn-plugin-0.5.3-6.el5_2.6 vs the 0.5.3-6.el5
release? The changelog
(https://rhn.redhat.com/network/software/packages/change_log.pxt?pid=444232) is
not explicit at all. If I understand correctly, by trying to fix Bug 447402, the
annoyance was introduced.
Comment 7 HMDC Linux Support 2008-06-16 11:36:42 EDT
(In reply to comment #6)
> What are the advantages of yum-rhn-plugin-0.5.3-6.el5_2.6 vs the 0.5.3-6.el5
> release? 

The bug fixed was noted in the errata:
http://rhn.redhat.com/errata/RHBA-2008-0488.html

========
This package addresses the following bug:

* yum clean all would not remove packages from the cache correctly, leaving
downloaded rpms in /var/cache/yum/rhel*/packages/. This updated package
fixes the issue and yum clean all now removes packages from the cache
correctly.

[snip]

Bugs fixed (see bugzilla for more information)

447402 - yum-rhn-plugin doesn't enable RHN repos for 'yum clean' command, so
nothing happens

========

As I understand the situation: with yum-rhn-plugin-0.5.3-6.el5 running "yum
clean all" would not clear the yum cache for RHN repos (bug 447402), but would
clear the yum cache for non-RHN repos. With yum-rhn-plugin-0.5.3-6.el5_2.6
running "yum clean all" will clear the yum cache for RHN repos if and only if
there are no non-RHN repos configured; if any non-RHN repos are configured yum
throws an error and the cache is not cleared.
Comment 9 John Matthews 2008-07-15 09:48:55 EDT
*** Bug 455401 has been marked as a duplicate of this bug. ***
Comment 10 Kenneth Burgener 2008-08-04 13:17:20 EDT
I had opened a support ticket about this very issue. I, for some reason, had difficulties noticing that this issue was previously reported.  The response that I received from technical support was:

"Unfortunately this is a bug. With yum-rhn-plugin-0.5.3-6.el5_2.6 running "yum clean all" will clear the yum cache for RHN repos if and only if there are no non-RHN repos configured; if any non-RHN repos are configured yum throws an error and the cache is not cleared.

Which will get fixed in release 5.3.0."

So assume this means that it is definitely on the 5.3.0 release schedule.
Comment 11 John Matthews 2008-08-04 13:33:15 EDT
Hello Kenneth,

We'll be addressing this issue in 5.3.0.
Comment 12 wdc 2008-08-07 14:14:18 EDT
It seems that the root cause of the problem with yum-rhn-plugin-0.5.3-6.el5_2.6
is that it cycles through all repos twice twice and carefully shoots itself in the foot, first putting the external repos into its list, and then complaining on the second pass that it put the repo into its list.

Please note that if this bug had been fixed in a timely manner, Satellite Server customers running Satellite Server 4.2 receiving the hot fix for database corruption might have been able to clean up the mess on client systems with
    yum clean all
instead of
    rm -rf /var/cache yum

Fixing this problem with an errata rather than waiting until the quarterly release might forestall more problems in the event of another Satellite Server or other RHN server-side cache corruption issue.

I have also opened a service request on this issue. SR 1833690
Comment 14 wdc 2008-08-20 18:26:21 EDT
I have documented the use case of 

  yum clean all --noplugins

not cleaning up the cache in BZ 459666
Comment 15 wdc 2008-08-21 19:00:20 EDT
To clarify:

I should never have been told to use the "--noplugins" option.
To get the RHN repos, you need a functioning yum-rhn-plugin.

I edited /usr/lib/yum-plugins/rhnplugin.py with the patch offered above as an attachment, and confirmed that "yum clean all" runs and cleans up properly.

DEFINITELY get this patch out to the world.

(Mind you, my personal taste would be to find out why yum was stepping through all the repos twice, and fix the way the loop runs rather than to just add
a try/except to prevent the redundant repos.add calls from operating,
but its you're codebase...)
Comment 16 Michael Kearey 2008-08-21 20:01:46 EDT
*** Bug 459666 has been marked as a duplicate of this bug. ***
Comment 17 John Matthews 2008-08-27 09:54:36 EDT
*** Bug 460294 has been marked as a duplicate of this bug. ***
Comment 18 RHEL Product and Program Management 2008-08-27 10:33:41 EDT
This bugzilla has Keywords: Regression.  

Since no regressions are allowed between releases, 
it is also being marked as a blocker for this release.  

Please resolve ASAP.
Comment 22 Jay Turner 2008-09-23 10:39:46 EDT
Fix confirmed with 0.5.3-26.el5.
Comment 23 Pierre Ossman 2008-11-13 08:54:32 EST
When is this moving out of beta so that it actually gets on production systems?
Comment 24 Andrius Benokraitis 2008-11-13 09:13:53 EST
Soon. We can't release/announce GA dates, but you can most likely extrapolate from previous Beta to GA dates...
Comment 27 errata-xmlrpc 2009-01-20 16:55:30 EST
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-0195.html

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