How can one ascertain when an installed package was last updated?

I want to ensure that flatpak wasn’t updated since a specific date, so that I am able to file a report about its behaviour. [1] rpm -qi flatpak returns:

Install Date: Thu 15 May 2025 12:44:39 BST

However, I don’t know whether that means that it was last updated then, [2] or whether that’s even the correct method to ascertain this.


  1. discourse.flathub.org/t/10782/2 ↩︎

  2. github.com/rpm-software-management/rpm/discussions/4018 ↩︎

To see dnf5 transactions that affected flatpak:

dnf history list --contains-pkgs=flatpak

To see dnf4 transactions (which include anything you did from Discover, GNOME Software etc):

dnf4 history list flatpak

4 Likes

Thanks, @pg-tips, as ever. That worked:

RokeJulianLockhart@Beedell:~$ dnf history list --contains-pkgs=flatpak
RokeJulianLockhart@Beedell:~$ dnf4 history list flatpak
ID     | Command line                                    | Date and time    | Action(s)      | Altered
------------------------------------------------------------------------------------------------------
    36 |                                                 | 2025-06-09 20:13 | I, U           |  569  <
    32 |                                                 | 2025-04-18 15:27 | D, E, I, U     | 2590 ><
    20 | system-upgrade upgrade                          | 2025-01-16 13:34 | C, D, E, I, O, | 2557 ><
    19 | upgrade --refresh -y                            | 2025-01-16 13:12 | C, E, I, O, U  |  723 ><
     2 | upgrade                                         | 2024-10-02 22:20 | I, O, U        | 1181 ><
     1 |                                                 | 2024-04-14 23:56 | Install        | 2153 >E

Worrisome that Discover still utilises dnf4, though. I’ve been unable to ascertain whether it’s even tracked anywhere (KDE BZ, pkcon’s GH issues, etcetera). I hope that doesn’t cause problems. If you’ve any information about it, although it’s tangential to this thread, I’ll be glad. [1]


  1. discuss.kde.org/t/10115/12 ↩︎

See:

Moving to dnf5 requires upstream work on a Discover backend. The KDE bug tracker ticket is:

1 Like

Yes, “dnf history list –contains-pkgs=flatpak” will work but to answer the other questions:

The “Install Date” in the “rpm -qi flatpak” is the actual time the rpm was upgraded or installed whichever was sooner. There is a time difference between the time shown in the "dnf history list ..” and the one in the rpm -qi for two reasons. That’s because the dnf transaction might have taken significant time. I think the time stamp in the dnf history list is when the dnf transaction started and the one in the rpm -qi is the actual time the package was installed or updated. The dnf history list time is reported in UTC but the rpm -qi “Install Date” time is in local time. So for a person the “Install Date” is probably easier to understand, while the UTC time is better for record keeping (no need to deal with DST).

To show this, I can show my last history entry and the “Install Date” from a package in that:

dnf history info last | grep -e Upgrade -e "Begin time" |head -2
Begin time : 2025-10-26 14:40:45
Upgrade b3sum-0:1.8.2-3.fc43.x86_64 User updates-testing

rpm -qi b3sum | grep Install
Install Date: Sun 26 Oct 2025 10:40:58 AM EDT

So you see the “+4” hours more on the history due to the UTC to EDT difference and a rpm time was about +13 seconds later due to the time dnf took to get to that package

3 Likes

Something I was playing with today.
Setup for dnf5

#!/usr/bin/env bash 
set -o errexit
set -o nounset
set -o pipefail
if [[ -z $@ ]]; then
	echo "Takes a space separated list of package names for input"
	exit
fi

PACKAGES=$@
for PACK in ${PACKAGES}
do
	FULL_PKG_NAME="$(dnf rq --installed "${PACK}" --qf '%{full_nevra}')"
 	if [[ -n "${FULL_PKG_NAME}" ]]; then
		PKG_BUILD_TIME="$(dnf rq --installed "${PACK}" --qf '%{buildtime}' | xargs -i date -d @{})"
		PKG_INSTALL_TIME="$(dnf rq --installed "${PACK}" --qf '%{installtime}' | xargs -i date -d @{})"
		echo "PACKAGE NAME: ${FULL_PKG_NAME}" 	
		echo "PACKAGE BUILD TIME: ${PKG_BUILD_TIME}" 	
		echo "PACKAGE INSTALL TIME: ${PKG_INSTALL_TIME}" 	
	else
		echo "Package: "${PACK}" not found"
	fi	
	echo  ""
done

That’s a lot of code. This bash function does it in way less space:

lastupdated () 
{ 
    if [[ -z "$1" ]]; then
        echo "required package name missing"
        return;
    fi;
    dnf history info 1..last --contains-pkgs="$1" | grep  -e "Install\s*$1" -e "Upgrade\s*$1" -e "Begin time" | head -2
}

You could run:

lastupdated packagename

Like I was saying the time this shows would be a few seconds early (but who cares, you usually want the time a package was last installed/updated in a general way). The install/upgrade parts in the grep isn’t really necessary, but it’s there to ensure the time you see isn’t from a history entry for removing the package. Seeing just two time stamps in a row would mean the newest transaction on the package was a “remove”

@grumpey and @marko3209, what do these do?

It lacks some of the safety mechanisms of the first one, in case a user wants to modify it.

Does a repoquery based on a space separated list of package names.

Output looks like:
PACKAGE NAME: gnome-calculator-0:49.1-1.fc43.x86_64
PACKAGE BUILD TIME: Fri Oct 10 05:51:56 AM EDT 2025
PACKAGE INSTALL TIME: Sun Oct 26 02:11:15 PM EDT 2025

or
Package: gnomecalculator not found

1 Like

My suggestion doesn’t do multiple packages whereas his does multiple ones, but I don’t see any “safety” problems (ie that it’s dangerous to run a “dnf history …” command). Maybe you mean “sanity tests”

@marko3209, I’m referring to baSH’s equivalent to preprocessor directives:

set -o errexit
set -o nounset
set -o pipefail

They’re similar to pwsh’s Set-StrictMode.

Ahh, okay, but my one liner didn’t need any of that so it doesn’t matter anyway

1 Like

@marko3209, yes. They’re solely good form in case the script is retroactively modified.