Index ¦ Archives ¦ Atom

YUM history (!)

While browsing the YUM man page for some details about the query command I happened to find one of my most wanted feature in a package manager! YUM has some history command which allows for investigation of past transactions and even undo or rollback actions. Epic. I frequently find myself going through install/uninstall steps which not only mess around but I tend to forget about the installed and now unneeded deps.

I'll go through a basic history usage example but there is a lot more to discover. Consider the following command:

# yum install anjuta
...
Installed:
 anjuta.i686 1:3.2.0-1.fc16

Dependency Installed:
 apr.i686 0:1.4.6-1.fc16
 apr-util.i686 0:1.3.12-1.fc16
 autogen.i686 0:5.9.4-8.fc15
 autogen-libopts.i686 0:5.9.4-8.fc15
 devhelp.i686 1:3.2.0-1.fc16
 glade3-libgladeui.i686 1:3.10.0-6.fc16
 guile.i686 5:1.8.8-3.fc16
 libgda.i686 1:4.2.8-2.fc16
 libgda-sqlite.i686 1:4.2.8-2.fc16
 libgdl.i686 1:3.2.0-1.fc16
 sqlite-devel.i686 0:3.7.7.1-1.fc16
 subversion-libs.i686 0:1.6.17-5.fc16
 vala.i686 0:0.14.2-3.fc16

Many dependencies have been installed and you surely won't remember all of them when later removing anjuta. You could go through some cleaning session using package-cleanup, from yum-utils but that isn't really intended to revert back your system status, it will just help you remove unneeded packages. Here's instead what history can do for you:

# yum history list anjuta
Loaded plugins: downloadonly, langpacks, presto, refresh-packagekit
ID   | Command line       | Date and time    | Action(s)  | Altered
-------------------------------------------------------------------
 172 | install anjuta     | 2012-04-26 09:02 | Install    |   14

# yum history info 172
Loaded plugins: downloadonly, langpacks, presto, refresh-packagekit
Transaction ID : 172
Begin time     : Thu Apr 26 09:02:57 2012
Begin rpmdb    : 1225:459cfe1ee50fe38d585386f265e6647ab8d4b5a9
End time       :            09:03:19 2012 (22 seconds)
End rpmdb      : 1239:9784f29b6dff78d982e401bfa5e4cbd9620c47ed
User           : Giulio Fidente
Return-Code    : Success
Command Line   : install anjuta
Transaction performed with:
    Installed     rpm-4.9.1.3-1.fc16.i686               @updates
    Installed     yum-3.4.3-23.fc16.noarch              @updates
    Installed     yum-metadata-parser-1.1.4-5.fc16.i686 @koji-overrides
Packages Altered:
    Install     anjuta-1:3.2.0-1.fc16.i686             @fedora
    Dep-Install apr-1.4.6-1.fc16.i686                  @updates
    Dep-Install apr-util-1.3.12-1.fc16.i686            @fedora
    Dep-Install autogen-5.9.4-8.fc15.i686              @fedora
    Dep-Install autogen-libopts-5.9.4-8.fc15.i686      @fedora
    Dep-Install devhelp-1:3.2.0-1.fc16.i686            @fedora
    Dep-Install glade3-libgladeui-1:3.10.0-6.fc16.i686 @updates
    Dep-Install guile-5:1.8.8-3.fc16.i686              @fedora
    Dep-Install libgda-1:4.2.8-2.fc16.i686             @updates
    Dep-Install libgda-sqlite-1:4.2.8-2.fc16.i686      @updates
    Dep-Install libgdl-1:3.2.0-1.fc16.i686             @fedora
    Dep-Install sqlite-devel-3.7.7.1-1.fc16.i686       @fedora
    Dep-Install subversion-libs-1.6.17-5.fc16.i686     @fedora
    Dep-Install vala-0.14.2-3.fc16.i686                @updates

# yum history undo 172
...
Removed:
 anjuta.i686 1:3.2.0-1.fc16
 apr.i686 0:1.4.6-1.fc16
 apr-util.i686 0:1.3.12-1.fc16
 autogen.i686 0:5.9.4-8.fc15
 autogen-libopts.i686 0:5.9.4-8.fc15
 devhelp.i686 1:3.2.0-1.fc16
 glade3-libgladeui.i686 1:3.10.0-6.f16
 guile.i686 5:1.8.8-3.fc16
 libgda.i686 1:4.2.8-2.fc16
 libgda-sqlite.i686 1:4.2.8-2.fc16
 libgdl.i686 1:3.2.0-1.fc16
 sqlite-devel.i686 0:3.7.7.1-1.fc16
 subversion-libs.i686 0:1.6.17-5.fc16
 vala.i686 0:0.14.2-3.fc16

Great isn't it? And there is a lot more! The rollback command will revert back the status of the whole software packages installed at the time of the transaction ID.

© Giulio Fidente. Built using Pelican. Theme by Giulio Fidente on github. Member of the Internet Defense League.