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 666545 - [RHEL 6] rhn_check incorrectly reports success when packages weren't found due to out-of-date yum cache
Summary: [RHEL 6] rhn_check incorrectly reports success when packages weren't found du...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: yum-rhn-plugin
Version: 6.0
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Milan Zázrivec
QA Contact: Martin Minar
URL:
Whiteboard:
Depends On:
Blocks: 667135
TreeView+ depends on / blocked
 
Reported: 2010-12-31 15:36 UTC by John Ruemker
Modified: 2018-11-14 15:48 UTC (History)
8 users (show)

Fixed In Version: yum-rhn-plugin-0.9.1-15.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 667135 (view as bug list)
Environment:
Last Closed: 2011-05-19 13:05:41 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
output of rhn_check -vvv and rpm -q to demonstrate the issue (45.53 KB, text/plain)
2010-12-31 15:36 UTC, John Ruemker
no flags Details
screenshot of satellite event page showing success (126.13 KB, image/png)
2010-12-31 15:36 UTC, John Ruemker
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 671360 1 None None None 2021-01-20 06:05:38 UTC
Red Hat Product Errata RHBA-2011:0565 0 normal SHIPPED_LIVE rhn-client-tools and yum-rhn-plugin bug fix and ehnancement update 2011-05-18 17:57:10 UTC

Internal Links: 671360

Description John Ruemker 2010-12-31 15:36:10 UTC
Created attachment 471285 [details]
output of rhn_check -vvv and rpm -q to demonstrate the issue

Description of problem: Using Satellite, if you add packages to a channel, wait for the repodata to be generated, then schedule an install of those packages on a client system, if the cached metadata on that client has not yet expired (causing yum to not find the new packages) then rhn_check, and thus satellite, will still report that the scheduled action was successful even though the packages were not installed.

I have filed RHEL 6 and 5 bugs to request that rhnplugin-based channels be allowed to use metadata_expire to shorten the window that this is a problem on clients:

  https://bugzilla.redhat.com/show_bug.cgi?id=666463
  https://bugzilla.redhat.com/show_bug.cgi?id=666534

This partially solves the problem, however this does not address the root issue that satellite incorrectly reports that the packages were installed.  This bug is to request a change in this functionality.  

I filed the bug against rhn-client-tools because rhn_check seems to be the component that is incorrectly reporting success. However, this may also warrant a change in satellite itself.  Ideally when this occurs, satellite would schedule the action again or continue to retry it.  

Version-Release number of selected component (if applicable): rhn-check-1.0.0-39.el6.noarch (problem also exists in RHEL 5). 

How reproducible: Any time the yum cache was last generated within 6 hours and updated repodata is made available.

Steps to Reproduce:
1. Create a channel in Satelite
2. Register system to satellite
3. 'yum makecache' on system or install a package through Satellite interface
4. Add new packages to channel
5. Wait for repodata to regenerate, and then schedule package install/update from Satellite interface
6. 'rhn_check -vvv' from system (or wait for osad to run it)
  
Actual results: Operation reports as successful in both rhn_check and satellite interface, but packages are not actually installed.  

Expected results: Packages are installed, or satellite interface reports failure.  Ideally, the action would be rescheduled or retried.

Additional info: Screenshot of satellite displaying success is attached.  Full rhn_check -vvv output is attached.  Some interesting snippets:

   # rhn_check -vvv
   [...]
   D: check_action {'action': "<?xml version='1.0'?>\n<methodCall>\n<methodName>packages.update</methodName>\n<params>\n<param>\n<value><array><data>\n<value><array><data>\n<value><string>git</string></value>\n<value><string>1.7.1</string></value>\n<value><string>2.el6_0.1</string></value>\n<value><string></string></value>\n<value><string>x86_64</string></value>\n</data></array></value>\n<value><array><data>\n<value><string>initscripts</string></value>\n<value><string>9.03.17</string></value>\n<value><string>1.el6_0.1</string></value>\n<value><string></string></value>\n<value><string>x86_64</string></value>\n</data></array></value>\n</data></array></value>\n</param>\n</params>\n</methodCall>\n", 'version': 2, 'id': 324}
   [...]
   D: handle_action {'action': "<?xml version='1.0'?>\n<methodCall>\n<methodName>packages.update</methodName>\n<params>\n<param>\n<value><array><data>\n<value><array><data>\n<value><string>git</string></value>\n<value><string>1.7.1</string></value>\n<value><string>2.el6_0.1</string></value>\n<value><string></string></value>\n<value><string>x86_64</string></value>\n</data></array></value>\n<value><array><data>\n<value><string>initscripts</string></value>\n<value><string>9.03.17</string></value>\n<value><string>1.el6_0.1</string></value>\n<value><string></string></value>\n<value><string>x86_64</string></value>\n</data></array></value>\n</data></array></value>\n</param>\n</params>\n</methodCall>\n", 'version': 2, 'id': 324}
   D: handle_action actionid = 324, version = 2
   D: do_call packages.update ([['git', '1.7.1', '2.el6_0.1', '', 'x86_64'], ['initscripts', '9.03.17', '1.el6_0.1', '', 'x86_64']],) {'cache_only': None}
   [...]
   D: Called update [['git', '1.7.1', '2.el6_0.1', '', 'x86_64'], ['initscripts', '9.03.17', '1.el6_0.1', '', 'x86_64']]
   [...]
   D: Sending back response (0, 'Update Succeeded', {})
   D: do_call packages.checkNeedUpdate ('rhnsd=1',) {}
   D: local action status:  (0, 'rpm database not modified since last update (or package list recently updated)', {})
   D: rpcServer: Calling XMLRPC registration.welcome_message
   D: closed   db index       /var/lib/rpm/Providename
   D: closed   db index       /var/lib/rpm/Name
   D: closed   db index       /var/lib/rpm/Packages
   D: closed   db environment /var/lib/rpm
   # rpm -q git initscripts
   git-1.7.1-2.el6.x86_64
   initscripts-9.03.17-1.el6.x86_64

Comment 1 John Ruemker 2010-12-31 15:36:55 UTC
Created attachment 471286 [details]
screenshot of satellite event page showing success

Comment 2 John Ruemker 2010-12-31 15:40:44 UTC
Additional output to show that yum metadata caching is the cause of the packages not being installed:

[root@jrummy6-64 ~]# yum check-update
Loaded plugins: fs-snapshot, refresh-packagekit, rhnplugin
[root@jrummy6-64 ~]# yum clean all
Loaded plugins: fs-snapshot, refresh-packagekit, rhnplugin
Cleaning up Everything
[root@jrummy6-64 ~]# yum check-update
Loaded plugins: fs-snapshot, refresh-packagekit, rhnplugin
rhel-6-test                                                                                    |  871 B     00:00     
rhel-6-test/primary                                                                            | 4.6 kB     00:00     
rhel-6-test                                                                                                       8/8

git.x86_64                                            1.7.1-2.el6_0.1                                      rhel-6-test
initscripts.x86_64                                    9.03.17-1.el6_0.1                                    rhel-6-test

Comment 3 Milan Zázrivec 2011-01-13 16:57:02 UTC
Here's the deal:

In the situation described in the initial comment, we're not able to
simply re-schedule the installation of the package (which is what
the described expected results suggest) for two reasons:

1. From the yum exception we receive in this case, we're not able to
tell whether we got the exception because the package really does not
exist in the yum (Satellite) repo or the package does exist on the
server and our metadata cache is just out of date.

yum libraries simply trust the local cache as long as it's not expired.
Nothing nice we can do about this (other than deleting the local cache
and downloading it from server again every time we run rhn_check, which
is not acceptable).

2. Even if the previous point would be feasible, we're simply not able
to automatically schedule an event as a result of another (failed) event.


There's one solution to the problem that I see though.

Every Satellite channel has a last_modified flag set (indeed the time
of last channel modification) which is being sent to the registered client.

What we can do on the client is:
1. Check the time stamp on the locally cached metadata (more specifically
the time stamp of a 'cachecookie' file)

2. Compare the time stamp from point 1 with the last_modified value of
the Satellite channel. If the Satellite channel is more recent than
the local cachecookie, we delete the cookie, which in turn will convince
yum libraries to refresh the cache from the server.

From this point on, the scheduled installation will work OK.

There's one major problem with this approach though -- the channel time stamp
which is being sent from Satellite to the client is in 'YYYYMMDDHH24MISS' 
format, i.e. local time of the Satellite machine and the time stamp comparison
simply wouldn't work if the client and the server would be in different
time zones.

So to accomplish the proposed plan, we'd have to
1. Modify yum-rhn-plugin according to the schema above
2. Modify Satellite to send one more flag with the channel -- channel's
last_modified info as a unix epoch.

Both fixes (server & client) shouldn't be too invasive.

Comment 5 Milan Zázrivec 2011-01-13 19:29:58 UTC
About the part of the bug report, where rhn_check (and Satellite webui) say
the package install / update was successful, when in fact it wasn't:

When installing a new package (i.e. no older version on the client system),
the yum libraries try to find the requested package info in the local cache;
when not successful, the yum library throws an exception which is then
caught by yum-rhn-plugin / rhn_check and correctly propagated to the parent
Satellite as a failure.

When updating a package and the requested package does not exist in
the local cache, no exception is thrown and we simply execute an
empty transaction (empty, as in nothing changed). This looks as a success,
which is also reported as such to the parent Satellite.

The behavior above is how yum libraries are designed.

We are able to fix the problem with package update by checking the
length of YumAction's tsInfo before and after the operation takes
place. If the length is zero -> action failure.

Comment 6 John Ruemker 2011-01-13 19:41:34 UTC
Yes, this mixup looks to be a result of me generalizing the use case I was testing.  In my tests, I was installing an updated version of a package that was already installed on the system, but for some reason I chose to describe it as install/update.  My apologies for the confusion.  

Either way, it sounds like you have identified the issue and a potential solution, so the customer will be pleased.

That said, the customer did actually explain to me their wish to see yum behave the way you described in https://bugzilla.redhat.com/show_bug.cgi?id=666545#c3 (it checks if its metadata is out-of-date, and pulls down a new one if it is), so if that is no longer the intended action plan then I will likely be filing an RFE in a separate case to request this functionality.  

Thanks for your help.
-John

Comment 7 Clifford Perry 2011-01-13 20:10:09 UTC
John - if you wish to report a bug / RFE for yum - please do so. This bug is in how the yum-rhn-plugin and/or rhn-client-tools interacts with yum when we are performing a scheduled event to update a package - as outlined in comment #5. We as maintainers of the RHN Client pieces can update/change our code as Milan suggests to avoid the confusion caused by incorrectly saying a package was updated when it was not and be done with this bug report. 

We could then go beyond that - most likely creating a new bug/RFE, as outlined in comment #3 and make changes to both yum-rhn-plugin and Satellite for cache expire checks. Are you wanting yum to change? OR let our code control this as proposed in comment #3. 

Cliff

Comment 8 Clifford Perry 2011-01-13 20:20:46 UTC
solution in comment #3 would only work for only if customer had newest satellite. 
solution in comment #5 would work for anyone using newest client.

my prefernce for this bug report is #5, more isolated fix.

We can look at #3 - but would have to split it off. If we do it.

Comment 9 John Ruemker 2011-01-13 20:23:38 UTC
Thanks Cliff.  The solution proposed in comment #5 is fine for the purposes of resolving the issue reported in this bug.

I have gone ahead and sent up a separate RFE case to the GSS representatives for triage (case 402319, if you're interested) to request the functionality that the metadata be discarded if a new copy is available, regardless of whether it has expired.  If it is found to be agreeable to them, they will file a new bugzilla.  

As to your question about whether this should happen in yum or our code (as
proposed in comment #3), I'm not sure.  If I ask the customer, I'm sure they'll
say they'd like to see it happen in yum, so it would behave as they wish for
rhnplugin-based channels and standard repos alike (since they currently use
both).  However if a case could be made for only doing it in yum-rhn-plugin
(due to simplicity, or for other reasons), then I could probably get them to accept that as well.  I'll have to think it over.  For now, the RFE states that what's described in comment #3 is fine, but if that changes I'll note it in the RFE that gets filed.

Thanks for your help.

-John

Comment 10 Milan Zázrivec 2011-01-18 11:12:23 UTC
Fix for the problem where we report empty transactions as a success:

spacewalk.git master: 15e1dca13350ae3e9a0eb8fbf52287db1d59ddd3
satellite.git CLIENT-RHEL-6: b0d0b34f8b2f6d3800c196c650c19d71b5e04ac7

Comment 11 Milan Zázrivec 2011-01-18 11:14:20 UTC
This in fact is a change in yum-rhn-plugin -- changing the component.

Comment 13 Milan Zázrivec 2011-02-09 15:49:35 UTC
Additional fixes:
satellite.git CLIENT-RHEL-6: 793b940f44faa81ef23e4df79d1eaea6c67d538e

Comment 15 Milan Zázrivec 2011-02-17 16:28:13 UTC
Additional fixes:

spacewalk.git master: fd657459014a569811dd382bf009cc0db39143f0
satellite.git CLIENT-RHEL-6: 39a59794de2f1e1d6f83188766119581e97c678d

Comment 18 errata-xmlrpc 2011-05-19 13:05:41 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-0565.html

Comment 19 Jan Pazdziora (Red Hat) 2011-11-24 09:35:43 UTC
(In reply to comment #3)
> 
> There's one solution to the problem that I see though.
> 
> Every Satellite channel has a last_modified flag set (indeed the time
> of last channel modification) which is being sent to the registered client.
> 
> What we can do on the client is:
> 1. Check the time stamp on the locally cached metadata (more specifically
> the time stamp of a 'cachecookie' file)
> 
> 2. Compare the time stamp from point 1 with the last_modified value of
> the Satellite channel. If the Satellite channel is more recent than
> the local cachecookie, we delete the cookie, which in turn will convince
> yum libraries to refresh the cache from the server.
> 
> From this point on, the scheduled installation will work OK.
> 
> There's one major problem with this approach though -- the channel time stamp
> which is being sent from Satellite to the client is in 'YYYYMMDDHH24MISS' 
> format, i.e. local time of the Satellite machine and the time stamp comparison
> simply wouldn't work if the client and the server would be in different
> time zones.
> 
> So to accomplish the proposed plan, we'd have to
> 1. Modify yum-rhn-plugin according to the schema above
> 2. Modify Satellite to send one more flag with the channel -- channel's
> last_modified info as a unix epoch.
> 
> Both fixes (server & client) shouldn't be too invasive.

Just for the record here: the last_modified value is not guaranteed not to change if something else than package list changes. For example, see bug 743833. It would seem better to send the actual repodata timestamp with the channel -- if there is new repodata available, it makes sense to re-download them again. And yes, we'd need to make this UTC value to work correctly across timezones.


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