Bug 700035

Summary: after removing /var/cache/yum/* yum misbehaves
Product: Red Hat Enterprise Linux 6 Reporter: Jan Hutař <jhutar>
Component: yumAssignee: James Antill <james.antill>
Status: CLOSED ERRATA QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 6.1CC: borgan, cperry, jwest, mglantz, msuchy, pep, pknirsch, tcapek
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: yum-3.2.29-17.el6 Doc Type: Bug Fix
Doc Text:
After manually clearing the yum cache by removing all files under the /var/cache/yum/ directory, running the "yum update" or "yum clean all" commands could have resulted in failure with the following error message: "There are no enabled repos." With this update, yum proceeds as expected with downloading repodata even after manually clearing the cache.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 13:34:28 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jan Hutař 2011-04-27 10:28:13 UTC
Description of problem:
When I manually flushes yum cache, `yum update` (!) or `yum clean all` reports error about missing repos, but do not tries to download repodata.


Version-Release number of selected component (if applicable):
yum-3.2.29-16.el6.noarch
yum-rhn-plugin-0.9.1-26.el6.noarch
rhnlib-2.5.22-10.el6.noarch
redhat-release-server-6Server-6.1.0.1.el6.x86_64


How reproducible:
always


Steps to Reproduce:
1. # rm -rf /var/cache/yum/*
2. # yum clean all


Actual results:
Loaded plugins: rhnplugin
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 You can enable repos with yum-config-manager --enable <repo>


Expected results:
Repodata for the channel I'm registered in should be downloaded and clean should succeed.


Additional info:
Longer and more complete reproducer:
# rpm -q test-regular-x86_64-32288test-regular-x86_64-32288-0.1-1.x86_64
# rm -rf /var/cache/yum/*
# yum clean all
Loaded plugins: rhnplugin
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 You can enable repos with yum-config-manager --enable <repo>
# yum list test-regular-x86_64-32288 --showduplicates
Loaded plugins: rhnplugin
test-x86_64-1                                                                                 14/14
Installed Packages
test-regular-x86_64-32288.x86_64   0.1-1   installed    
Available Packages
test-regular-x86_64-32288.x86_64   0.1-1   test-x86_64-1
test-regular-x86_64-32288.x86_64   0.2-2   test-x86_64-1
# yum clean all
Loaded plugins: rhnplugin
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 You can enable repos with yum-config-manager --enable <repo>
# yum update
Loaded plugins: rhnplugin
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 You can enable repos with yum-config-manager --enable <repo>
# yum repolist
Loaded plugins: rhnplugin
repo id         repo name            status
test-x86_64-1   Name test-x86_64-1   14
repolist: 14
# yum update
Loaded plugins: rhnplugin
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package test-regular-x86_64-32288.x86_64 0:0.1-1 will be updated
---> Package test-regular-x86_64-32288.x86_64 0:0.2-2 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                             Arch             Version         Repository               Size
====================================================================================================
Updating:
 test-regular-x86_64-32288           x86_64           0.2-2           test-x86_64-1           3.0 k

Transaction Summary
====================================================================================================
Upgrade       1 Package(s)

Total download size: 3.0 k
Is this ok [y/N]: y
Downloading Packages:
test-regular-x86_64-32288-0.2-2.x86_64.rpm                                   | 3.0 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Updating   : test-regular-x86_64-32288-0.2-2.x86_64                                           1/2 
  Cleanup    : test-regular-x86_64-32288-0.1-1.x86_64                                           2/2 

Updated:
  test-regular-x86_64-32288.x86_64 0:0.2-2                                                          

Complete!
# yum clean all
Loaded plugins: rhnplugin
Cleaning repos: test-x86_64-1
Cleaning up Everything

Comment 1 Miroslav Suchý 2011-04-27 11:31:45 UTC
I can not reproduce it.

Comment 2 Miroslav Suchý 2011-04-27 14:06:50 UTC
I do confirm this bug.
It will happen if, and only if, you do not have any additional repositories. I.e. you only have rhnplugin and nothing else.

Comment 5 Miroslav Suchý 2011-04-27 15:56:31 UTC
Nope.
  yum clean all
is not enough. yum-rhn-plugin do not remove rhnplugin.repos

You have to do one of these:
 * rm -rf /var/cache/yum/*
 * find /var/cache/yum/ -name rhnplugin.repos |xargs rm -f
 * have cleanly kickstarted system where is no information in /var/cache/yum

These 2 first are good for reproducing. 
Customers will hit the last one.

I will do tomorrow such kickstart and will confirm this behaviour. I expect that I will be unable to install single packages till I run 
 yum repolist

Comment 9 Miroslav Suchý 2011-04-28 13:14:54 UTC
This bug happen with yum-3.2.29 from RHEL6.1 (rebased in RHEL6.1 in January 2011). It does not happen with yum-3.2.27 from RHEL6.0.

I do confirm, that when you kickstart rhel6 machine with at least yum,rhn-client-tools and yum-rhn-plugin from rhel6.1 (I put it in custom channel of RHEL6.0), then:
- machine successfully kickstart (because yum use the /ty/ url and do not use rhnplugin)
- after kickstart if you run yum update (or clean/install/...) you get:

There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 You can enable repos with yum-config-manager --enable <repo>

until you run yum repolist.

There are several options:

1) revert our move from init_hook to prereposetup_hook

2) revert BZ 620802 in RHEL - this is the cause why yum write the error message and exit before continuing to prereposetup_hook.

3) create dummy repository during init_hook and remove it during prereposetup_hook. I tried it. And it works. But it misbehave (*) when you are subscribed to no chanell (neither base nor child). And right now I have no idea hot to fix it.

(*) it writes:
Error: Cannot retrieve repository metadata (repomd.xml) for repository: dummy-yum-rhn-pluggin. Please verify its path and try again

Comment 10 Miroslav Suchý 2011-04-28 13:18:45 UTC
I do confirm that with revert of BZ 620802 it start working correctly.

Comment 11 Miroslav Suchý 2011-04-28 13:42:15 UTC
After discussion with Cliff and JamesA. we come that revert of BZ 620802 is least intrusive. Switching to yum component.

Comment 12 James Antill 2011-04-28 13:43:30 UTC
 Literally a one line patch here, turning off the feature. Is about as safe as it can get...

diff -ru yum-3.2.29-orig/yumcommands.py yum-3.2.29/yumcommands.py
--- yum-3.2.29-orig/yumcommands.py	2011-04-28 09:40:25.737582856 -0400
+++ yum-3.2.29/yumcommands.py	2011-04-28 09:41:46.659607841 -0400
@@ -128,6 +128,11 @@
 
     @param base: a YumBase object.
     """
+    if True: return
+
     if base.repos.listEnabled():
         return

Comment 18 Tomas Capek 2011-05-17 12:06:32 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
After manually clearing the yum cache by removing all files under the /var/cache/yum/ directory, running the "yum update" or "yum clean all" commands could have resulted in     failure with the following error message: "There are no enabled repos." With this update, yum proceeds as expected with downloading repodata even after manually clearing the cache.

Comment 19 errata-xmlrpc 2011-05-19 13:34:28 UTC
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-2011-0602.html