yum-complete-transaction in yum-utils

December 11, 2007

This morning I checked in the rest of the code for yum-complete-transactions. For people running yum versions 3.2.7 and above you can use it pretty much as-is.

If you ever have a transaction abort in the middle b/c the power went out, rpm or yum fell over, your system locked up, your ssh connection died or any of a myriad of reasons then this may save your ass.

Grab it out of git here.

It takes the transaction-journaling I talked about back in august and makes it simple to use.

Just run yum-complete-transaction and it will attempt to finish out any transactions that were aborted in the middle.

of course, report bugs where appropriate.

5 Responses to “yum-complete-transaction in yum-utils”


  1. Sounds cool, I actually did run out of power in the middle of an upgrade at GUADEC and was screwed.

    Is there any reason not to have this in the yum core and run it before doing anything else?

  2. skvidal Says:

    There are a lot of cases it can’t cover. The various scriptlet stages aren’t exposed at the yum layer so it can’t know, for example: the package data has been installed but %post didn’t run so it gets far trickier. If we can get some sort of callback from rpm to let us know the stage the package is in and a way of putting a package into the transaction to only run a certain stage then we can make it even more fine-grained.

    I considered putting it in yum-core – but we need to make sure that it works properly and we also need to sort out how to best integrate it with things like pirut, yumex, etc.

    The biggest problem with having it run each time is that I don’t think it makes much sense to have it check and run just b/c I’m doing a: yum search or a yum install foo

    maybe only on yum update (without anything else here) calls.

  3. Gawain Lynch Says:

    Very cool work Seth, thank you.

    With regards to your last comment though, I think there are use cases where invoking this for a ‘yum update foo` is valid, for example ‘yum update gnome\*` could be a long process that could be untidy if not allowed to complete.

  4. Ewin Barnett Says:

    Sometime during the post-install cleanup of FC10, I accidently killed a ‘yum install’. Now, everytime I yum I get a message that suggests I run your script. When I do, it blows off. Below is an example from today, where I successfully installed a package::

    =====

    [root@gw4 ~]# yum install perl-RPC-XML
    Loaded plugins: fastestmirror, fedorakmod, kernel-module, keys, presto, refresh-
    : packagekit, rpm-warm-cache
    Setting up and reading Presto delta metadata
    updates | 2.3 kB 00:00
    No Presto metadata available for updates
    fedora | 2.8 kB 00:00
    Not using downloaded repomd.xml because it is older than what we have:
    Current : Sat Nov 22 04:29:10 2008
    Downloaded: Wed Nov 19 16:03:02 2008
    No Presto metadata available for fedora
    Loading mirror speeds from cached hostfile
    * updates: distro.ibiblio.org
    * fedora: fedora.mirror.iweb.ca
    Setting up Install Process
    Parsing package install arguments
    Resolving Dependencies
    There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
    –> Running transaction check
    —> Package perl-RPC-XML.noarch 0:0.64-1.fc10 set to be updated
    –> Processing Dependency: perl(XML::Parser) for package: perl-RPC-XML
    –> Running transaction check
    —> Package perl-XML-Parser.i386 0:2.36-3.fc9 set to be updated
    –> Finished Dependency Resolution

    Dependencies Resolved

    ================================================================================
    Package Arch Version Repository Size
    ================================================================================
    Installing:
    perl-RPC-XML noarch 0.64-1.fc10 fedora 188 k
    Installing for dependencies:
    perl-XML-Parser i386 2.36-3.fc9 fedora 292 k

    Transaction Summary
    ================================================================================
    Install 2 Package(s)
    Update 0 Package(s)
    Remove 0 Package(s)

    Total download size: 479 k
    Is this ok [y/N]: y
    Downloading Packages:
    Downloading DeltaRPMs:
    Rebuilding rpms from deltarpms
    (1/2): perl-RPC-XML-0.64-1.fc10.noarch.rpm | 188 kB 00:01
    (2/2): perl-XML-Parser-2.36-3.fc9.i386.rpm | 292 kB 00:01
    ——————————————————————————–
    Total 139 kB/s | 479 kB 00:03
    ============================== Entering rpm code ===============================
    Running rpm_check_debug
    Running Transaction Test
    Finished Transaction Test
    Transaction Test Succeeded
    Running Transaction
    Installing : perl-XML-Parser 1/2
    Installing : perl-RPC-XML 2/2
    =============================== Leaving rpm code ===============================

    Installed:
    perl-RPC-XML.noarch 0:0.64-1.fc10

    Dependency Installed:
    perl-XML-Parser.i386 0:2.36-3.fc9

    Complete!

    [root@gw4 ~]# yum-complete-transaction
    Loaded plugins: fastestmirror, fedorakmod, kernel-module, presto, refresh-
    : packagekit, rpm-warm-cache
    Traceback (most recent call last):
    File “/usr/sbin/yum-complete-transaction”, line 207, in
    util = YumCompleteTransaction()
    File “/usr/sbin/yum-complete-transaction”, line 114, in __init__
    self.main()
    File “/usr/sbin/yum-complete-transaction”, line 145, in main
    self.doUtilYumSetup()
    File “/usr/share/yum-cli/utils.py”, line 99, in doUtilYumSetup
    self._getTs()
    File “/usr/lib/python2.5/site-packages/yum/depsolve.py”, line 101, in _getTs
    self._getTsInfo(remove_only)
    File “/usr/lib/python2.5/site-packages/yum/depsolve.py”, line 112, in _getTsInfo
    pkgSack = self.pkgSack
    File “/usr/lib/python2.5/site-packages/yum/__init__.py”, line 592, in
    pkgSack = property(fget=lambda self: self._getSacks(),
    File “/usr/lib/python2.5/site-packages/yum/__init__.py”, line 435, in _getSacks
    self.repos.populateSack(which=repos)
    File “/usr/lib/python2.5/site-packages/yum/repos.py”, line 223, in populateSack
    self.doSetup()
    File “/usr/lib/python2.5/site-packages/yum/repos.py”, line 71, in doSetup
    self.ayum.plugins.run(‘postreposetup’)
    File “/usr/lib/python2.5/site-packages/yum/plugins.py”, line 178, in run
    func(conduitcls(self, self.base, conf, **kwargs))
    File “/usr/lib/yum-plugins/rpm-warm-cache.py”, line 31, in postreposetup_hook
    if commands[0] in (‘upgrade’, ‘install’, ‘remove’):
    IndexError: list index out of range
    [root@gw4 ~]#
    [root@gw4 ~]#
    [root@gw4 ~]#

    I will be happy to poke and prod the files on this machine if you want any help from me in resolving this issue.

    Kindest regards,

    Ewin

  5. Gavin Says:

    It bit me. HARD. yum told me to run yum-complete-transations, so I did, and it removed almost every package on my system with no warning. It turned a normal yum update session into an all-night re-install fest. Boo.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: