[Yum] possible bug in yum-cron
yum at 2foo.be
Tue Dec 9 12:19:15 UTC 2014
I have a machine configured so that it gets the security updates
automatically. (ONLY the security updates, this is important for the
further explanation of the possible bug)
Every week yum-cron seems to run but i get the following email:
Subject: Yum: Failed to check for updates on aocsrv212
Content of the mail:
Failed to check for updates with the following error message:
Failed to build transaction: Success - empty transaction
Clearly this is not what you want so I started investigating the issue.
Starting with just running Yum update manually made the issue disappear
temporarily but it came back every time.
So I started digging in the code... (more specifically in yum-cron
(installed on centos 7 in /sbin/))
on line 607 (pups = self.refreshUpdates()) it uses some base classes of yum
to find the amount of updates to install.
function refreshupdate just returns a boolean and adjusts the self object.
returns true if it found updates, false if it didn't... As I understand it
works as follows:
- check for updates
- check if those updates are wanted (f.e. if the user only wants security
updates, throw the ones out that are not security updates)
What happens on my machine is that there are 8 updates but none of those
are actually security updates, but stil the refreshUpdates() function
returns true (from line 456). I think this is wrong.
I think on line 456 the script should actually check if there are any
updates left (after filtering them) (I suggest using an if statement with
len(self.tsInfo) == 0) and based on that return true or false.
if we go back to line 607 you will see that after it checks for
groupupdates it will check if gups and pups is true. if so it will start
trying to update which explains the 'error' mail i get, empty transaction
(the tsInfo object is empty so there is no transaction to be made). If we
would have returned false (on an empty tsInfo object) you yum-cron would
quit as is actually the intended behavior (send no emails if nothing
happened, this is actually documented somewhere but i forgot.)
More information about the Yum