How To: View & Undo Yum/DNF Commands

Want to see what has recently been installed? Has an update just broken your X server? Then you’ve come to the right place!

In this brief how to I will be explaining the fundamentals of viewing & undoing yum/dnf updates on an RPM-based Linux distro.

What Is Yum? What is DNF?

Yum (Yellowdog Updater, Modified) is the package manager for RPM based distros like CentOS & Fedora, it can be used to install, update and remove packages on the systems. The main benefit of yum over the standard RPM utilities is that it seeks out dependencies to reduce the risk of breaking your system. As of Fedora 22, DNF (Dandified Yum) has become the default package manager, replacing yum whilst retaining similar, but improved, functionality. The DNF command itself works incredibly similarly to Yum so moving from one command to the other is rather easy!

In this article I use the dnf command but you can replace dnf with yum if you’re running an older version of CentOS/Fedora.

View History

– View list of transactions

[stuart@asuka ~]$ sudo dnf history
ID     | Command line             | Date and time    | Action(s)      | Altered
    46 | install httraqt.x86_64   | 2016-10-17 15:16 | Install        |    1   
    45 | install httrack.x86_64   | 2016-10-17 14:17 | Install        |    1   
    44 | update spotify           | 2016-09-26 12:05 | Update         |    1   
    43 | install Downloads/SOFTWA | 2016-09-23 11:31 | Install        |    1 EE
    42 | install java-1.8.0-openj | 2016-09-23 11:28 | Install        |    3   
    41 | update java              | 2016-09-23 11:27 | Update         |    2   
    40 | reinstall icedtea-web    | 2016-09-23 11:08 | Reinstall      |    1 EE
    39 | remove jre-1.7.0_51      | 2016-09-23 11:07 | Erase          |    1 EE
    38 | reinstall icedtea-web.x8 | 2016-09-23 11:05 | Reinstall      |    1 EE
    37 | install icedtea-web.x86_ | 2016-09-23 11:02 | Install        |    7 EE
    36 | remove icedtea-web       | 2016-09-16 11:46 | Erase          |    7  <
    35 | update spotify           | 2016-08-17 12:58 | Update         |    1 > 
    34 | install icedtea-web.x86_ | 2016-08-16 16:52 | Install        |    7

The above command output has been stripped down to show a few parts of the history. As you can see, any transaction is logged, not just installs & updates.

View Details of Transaction

– View details of transaction (using ID from previous command output)

[stuart@asuka ~]$ sudo dnf history info 45
Transaction ID : 45
Begin time     : Mon Oct 17 14:17:46 2016
Begin rpmdb    : 2307:e53988d93aa852086c981c3ba998e011cd8dc4d8
End time       :            14:21:22 2016 (216 seconds)
End rpmdb      : 2308:32a323e0478b458c74e9600ab5266f373badb04f
User           : Stuart Franks <stuart>
Return-Code    : Success
Command Line   : install httrack.x86_64
Transaction performed with:
    Installed     dnf-1.1.10-1.fc23.noarch        (unknown)
    Installed     rpm-4.13.0-0.rc1.13.fc23.x86_64 @updates
Packages Altered:
    Install httrack-3.48.22-1.fc23.x86_64 @updates

As you can see, the only alteration was that the package httrack was installed into the system. More complex transactions will show the dependencies installed as well, see the below example for the installation of icedtea-web (a package for running Java web applications).

Transaction ID : 37
Begin time     : Fri Sep 23 11:02:49 2016
Begin rpmdb    : 2297:a73b3ab5c399514bd42d7c3c1841e4bb2f006c88
End time       :            11:03:12 2016 (23 seconds)
End rpmdb      : 2304:80d53902f883c9b5880eed00e9ec826a687f6edc
User           : Stuart Franks <stuart>
Return-Code    : Success
Command Line   : install icedtea-web.x86_64
Transaction performed with:
    Installed     dnf-1.1.10-1.fc23.noarch        (unknown)
    Installed     rpm-4.13.0-0.rc1.13.fc23.x86_64 @updates
Packages Altered:
    Install hawtjni-runtime-1.10-5.fc23.noarch @fedora
    Install icedtea-web-1.6.2-1.fc23.x86_64    @updates
    Install jansi-1.11-9.fc23.noarch           @fedora
    Install jansi-native-1.5-9.fc23.x86_64     @fedora
    Install jline-2.13-1.fc23.noarch           @updates
    Install rhino-1.7.7-2.fc23.noarch          @fedora
    Install tagsoup-1.2.1-10.fc23.noarch       @fedora
Scriptlet output:
   1 the primary link for must be /usr/lib/mozilla/plugins/
   2 warning: %post(icedtea-web-1.6.2-1.fc23.x86_64) scriptlet failed, exit status 2

The above output shows that multiple packages were installed as well as detailing the warning/error messages from the RPM scriptlets.

Undo Transaction

– Undo transaction (using ID from the first command output)

[stuart@asuka ~]$ sudo dnf history undo 42
Last metadata expiration check: 2:12:00 ago on Tue Oct 18 11:40:58 2016.
Undoing transaction 42, from Fri Sep 23 11:28:28 2016
    Install giflib-4.1.6-14.fc23.i686                               @fedora
    Install java-1.8.0-openjdk-1:          @updates
    Install java-1.8.0-openjdk-headless-1: @updates
 Package                                        Arch                    Version                                     Repository                   Size
 giflib                                         i686                    4.1.6-14.fc23                               @fedora                      86 k
 java-1.8.0-openjdk                             i686                    1:                      @updates                    503 k
 java-1.8.0-openjdk-headless                    i686                    1:                      @updates                    101 M

Transaction Summary
Remove  3 Packages

Installed size: 102 M
Is this ok [y/N]:

Undo Fails

Note: This section currently only applies to CentOS.

If you’re undoing a transaction that upgraded a package instead of installing a package then the package manager needs to be able to locate an older version of each package. This can be done by enabling the vault repository for your distribution as explained below (OS used in example is CentOS 6.5).

– Create new repository file

vim /etc/yum.repos.d/CentOS-Vault.repo

– Populate with the following information

name=CentOS-6.5 - Base - Vault

The undo command should now be able to find the appropriate packages to roll back to.

Found this helpful? Please share!

Reducing the Cost of CFD Hardware – TotalSim Blog

I’ve been quite busy recently with going to Download 2015 and currently in the process of moving out so haven’t had many chances to update the website.

This is just a quick post to let you know that a blog post I wrote for where I work (TotalSim Ltd) went live at the beginning of this month.

The blog post regards what considerations are made at TotalSim to reduce the costs of our components for cluster builds.

You can read the full post here –


Found this helpful? Please share!

How To: Custom Nvidia Resolution on Linux

We recently bought a GTX 780 at work. My boss was interested in utilising the 4k (4096×2160) capabilities of the card so gave me the task of setting this up.

The machine that has the 780 doesn’t have a screen attached so making it even start the X window system without a screen needed some trickery (using edid).

I thought that custom resolutions on linux with nvidia cards would be a common setup but after some internet searching I was unable to find anything except people on forums trying to reach a solution.

After some playing around, the solution was a lot simpler than I expected.

First of all, in a terminal, create a modeline for your desired resolution:

cvt 4096 2160

Which will give you an output like the one below:

# 4096x2160 59.98 Hz (CVT) hsync: 134.18 kHz; pclk: 760.00 MHz
Modeline "4096x2160_60.00"  760.00  4096 4432 4880 5664  2160 2163 2173 2237 -hsync +vsync

Open up /etc/X11/xorg.conf with your favourite text editor (my preference being vim) and do the following:
– In Section “Monitor” add

Modeline "4096x2160_60.00"  760.00  4096 4432 4880 5664  2160 2163 2173 2237 -hsync +vsync

– In Section “Screen” add

Option        "UseDisplayDevice" “none”

– In Subsection “Display” add:

Virtual        4096 2160

Restart the X window system:

/sbin/init 3

/sbin/init 5

The above solution has been tested on Centos6.3 running the Nvidia 331.10 graphics driver. You can do any custom resolution you want, just replace 4096 with your desired width and 2160 with your desired height. Just make sure it’s a resolution supported by your graphics card!

Found this helpful? Please share!