When there are outstanding unfinished Yum transactions, Yum will output something like the following when running commands such as yum update:

There are unfinished transactions remaining. You might consider
running yum-complete-transaction first to finish them.

How can I determine if there are any unfinshed transactions without any side effects? (E.g., parsing the output of yum update will cause plenty of side effects, such as updating repository metadata.)

man 8 yum-complete-transaction suggests that one can simply check for the existence of files matching /var/lib/yum/{transaction-all,transaction-done}* (emphasis mine):

yum-complete-transaction is a program which finds incomplete or aborted yum transactions on a system and attempts to complete them. It looks at the transaction-all* and transaction-done* files which can normally be found in /var/lib/yum if a yum transaction aborted in the middle of execution.

If it finds more than one unfinished transaction it will attempt to complete the most recent one first. You can run it more than once to clean up all unfinished transactions.

However, this doesn't seem to be entirely accurate. For instance, I have a system where such files exist, but yum-complete-transaction reports that there are no transactions left to complete:

[myhost ~]% ls /var/lib/yum/{transaction-all,transaction-done}*
[myhost ~]% sudo yum-complete-transaction 
Loaded plugins: product-id, refresh-packagekit, rhnplugin
No unfinished transactions left.

And attempting to clean up the unfinished transaction files with --cleanup-only fails to remove those files:

[myhost ~]% sudo yum-complete-transaction --cleanup-only                   
Loaded plugins: product-id, refresh-packagekit, rhnplugin
No unfinished transactions left.
[myhost ~]% ls /var/lib/yum/{transaction-all,transaction-done}*

1 Answer 1


Here is a solution that outputs a count of the number of unfinshed transactions:

find /var/lib/yum -maxdepth 1 -type f -name 'transaction-all*' -not -name '*disabled' -printf . | wc -c

According to the source code for yum-complete-transactions from yum-utils, all /var/lib/yum/transaction-all* files are counted as unfinshed transactions...

def find_unfinished_transactions(yumlibpath='/var/lib/yum'):
    """returns a list of the timestamps from the filenames of the unfinished
       transactions remaining in the yumlibpath specified.
    timestamps = []
    tsallg = '%s/%s' % (yumlibpath, 'transaction-all*')
    #tsdoneg = '%s/%s' % (yumlibpath, 'transaction-done*') # not used remove ?
    tsalls = glob.glob(tsallg)
    #tsdones = glob.glob(tsdoneg) # not used remove ?

    for fn in tsalls:
        trans = os.path.basename(fn)
        timestamp = trans.replace('transaction-all.','')

    return timestamps

...except for those files ending with disabled:

    times = []
    for thistime in find_unfinished_transactions(self.conf.persistdir):
        if thistime.endswith('disabled'):
        # XXX maybe a check  here for transactions that are just too old to try and complete?

    if not times:
        print "No unfinished transactions left."

Unfortunately the latter code is inside the main() function of yum-complete-transaction.py and cannot be independently called. If this code were more modularized, then it might be possible to write a Python script that more accurately checks for unfinished transactions than the shell pipeline given above.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .