A significant chunk of "dnf history" is gone on my system

I was just trying to use dnf history list to track when pipewire was upgraded and to which version and realized a big chunk of the dnf history is gone.
I can’t imagine what did this, for example this is the newest 10:

dnf history list last-10..last

  ID Command line                                                           Date and time       Action(s) Altered
1184 dnf rm ntfs-3g-system-compression                                      2025-03-16 03:50:54                 1
1183 dnf upgrade --enablerepo=updates-testing gstreamer*                    2024-11-01 03:06:12                24
1182 dnf upgrade --enablerepo=updates-testing crypto-policies*              2024-11-01 01:45:39                 4
1181 dnf upgrade --enablerepo=updates-testing mediawriter crun thunderbird* 2024-10-31 12:58:38                 8
1180 dnf upgrade -y                                                         2024-10-31 12:45:22                30
1179 dnf install ./teams-1.5.00.23861-1.x86_64.rpm                          2024-10-31 04:28:28                 1
1178 dnf remove jack_capture                                                2024-10-30 21:20:27                 2
1177 dnf remove msttcore-fonts-installer                                    2024-10-30 21:19:57                 1
1176 dnf remove new-session-manager                                         2024-10-30 21:19:32                 1
1175 dnf upgrade --enablerepo=updates-testing qpwgraph                      2024-10-30 21:16:28                 2
1174 dnf upgrade                                                            2024-10-30 10:55:03                14

that single new one on 2025-03-16 is a package I wasn’t using that I removed to simply prove whether new history entries are getting added (obviously they are). But I don’t understand why all the sudden the next oldest one is way back to 01-Nov-2024. It would help if I knew what files dnf5 uses to store the dnf history information. I’m wondering if some flub in logrotate deleted some files storing the history info from Nov 2024 to now

The history is in /usr/lib/sysimage/libdnf5/transaction_history.sqlite. Do remember, though, that only the real dnf5 will update the history.

Yep, if you normally update using GNOME Software, Discover, COSMIC Store, or the pkcon command, this will use packagekit, which uses dnf4.

So try dnf4 history list

I use dnf5 for 99% of all dnf for months now. I’m not using the Gnome Software. I 100% use the command line dnf5 and I avoid the dnf4 because I know that splits the metadata (dnf4’s db is separate from dnf5).
Also both “dnf4 history list” and “dnf5 history list” show the same large gap between 3-15-2025 and 11-01-2024. My dnf4 history list looks like:

   297 |                                                                                                                                     | 2024-11-09 09:47 | Install        |    1  <
   296 |                                                                                                                                     | 2024-10-30 15:50 | Install        |    2 ><
   295 |                                                                                                                                     | 2024-10-02 22:49 | I, U           |   51 ><
   294 |                                                                                                                                     | 2024-09-26 05:01 | I, U           |   24 ><
   293 |                                                                                                                                     | 2024-09-22 01:29 | I, U           |    2 ><
   292 | -y install --nogpgcheck --disablerepo=* /tmp/akmods.GZMdMeYb/results/kmod-v4l2loopback-6.11.0-0.rc5.43.fc41.x86_64-0.13.1-2.fc40.x8 | 2024-08-27 10:21 | Install        |    1 ><
   291 | -y install --nogpgcheck --disablerepo=* /tmp/akmods.idA6uslD/results/kmod-v4l2loopback-6.11.0-0.rc5.43.fc41.x86_64-0.13.1-2.fc40.x8 | 2024-08-27 10:20 | Install        |    1 ><

So there’s no dnf4 history entries since Nov-09-2024

So it’s like a file was deleted or something

Did you rebuild the rpm database? sudo rpm rebuilddb -vv

That would hardly have any effect on the history. Although rebuilding the rpm database could help when the dnf and rpm operations gets unreasonably slow.

If I understand/remember correctly, DNF5 uses a different history database than DNF4 and does not automatically convert the two:

In other words, this is a known deficiency.

I know that the dbs are distinct, I was just showing both the dnf4 history list and dnf5 history list to prove the missing dnf transactions weren’t due to my somehow using dnf4 from Nov '24 to March '25.

Perhaps the history log files were in an inaccessible state (e.g. security context issue) for some time. But then again, what could have fixed that (a recent restorecon maybe)?