Bug 2023652
| Summary: | KeyError after upgrading packages (post-transaction actions) | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Imre Jonk <imre> |
| Component: | dnf-plugins-core | Assignee: | Jaroslav Mracek <jmracek> |
| Status: | CLOSED ERRATA | QA Contact: | Eva Mrakova <emrakova> |
| Severity: | low | Docs Contact: | |
| Priority: | low | ||
| Version: | 8.5 | CC: | james.antill, jrohel, mbanas, reynolds |
| Target Milestone: | rc | Keywords: | Triaged |
| Target Release: | --- | Flags: | pm-rhel:
mirror+
|
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | dnf-plugins-core-4.0.21-12.el8 | Doc Type: | No Doc Update |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2022-11-08 10:53:15 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
Hi, any update on this? It looks like an issue when postransaction action plugin is used. Because of low occurrence of the issue we will revisit the bug around 8.9 planning. Please can you provide setting of postransaction action plugin? May be we have fix for the issue - https://github.com/rpm-software-management/dnf-plugins-core/pull/454. Please can you verify whether it helps or not? Yes this has definitely something to do with the post-transaction actions DNF plugin, thanks for pointing it out. I need some more time to pinpoint the exact issue and write down the steps to reproduce it, as well as trying the fix you linked to. I'll keep you informed. Hi Jaroslav, I have some additional information for you: - The patch works, much appreciated! - The issue only occurs during a kernel update, and only when the maximum number of kernels configured in `installonly_limit` (default: 3) will be exceeded, which causes the removal of the oldest kernel. - The exit code of the failed DNF update command is, strangely enough, zero. DNF even shows a summary of upgraded packages and the string 'Completed!' at the bottom. When there are many package updates, you have to scroll back to see the KeyError. I'm still verifying whether our DNF post-transaction actions configuration has any impact on this issue. I hope to have the answer for you this Monday. Here are updated instructions to reproduce the problem: 1. Perform a minimal install of RHEL 8.5 in a virtual machine and register it using subscription-manager. 2. Install the post-transaction actions DNF plugin: `# dnf install python3-dnf-plugin-post-transaction-actions` 3. Install a test action that doesn't really do anything: `# echo "*:any:/bin/true" > /etc/dnf/plugins/post-transaction-actions.d/test.action` 4. Install two newer kernel packages, bringing the total number of installed kernels to three: `# dnf install kernel-4.18.0-348.2.1.el8_5 kernel-4.18.0-348.7.1.el8_5` 5. Install a fourth kernel package, which exceeds the `installonly_limit` of three, causing the old 4.18.0-348.el8 kernel package to be removed: `# dnf install kernel-4.18.0-348.12.2.el8_5` 6. Observe the KeyError. The KeyError does not occur when step 3 is skipped. Also, when the KeyError occurs, none of the post-transaction actions get executed. Our systems, and systems of our customers, rely on the post-transaction actions plugin working properly. We currently work around this issue with a custom dnf-plugins-core package with your patch applied. That package has version 4.0.21-4.1.el8. It would be great if the next Red Hat update has this patch applied as well, so that the next update will go smoothly. Perfect, thanks for the nice and clear reproducer. I wish I have always so many useful information. I created a CI test according to provided reproducer: https://github.com/rpm-software-management/ci-dnf-stack/pull/1093 Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (dnf-plugins-core bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2022:7759 |
Description of problem: I noticed this traceback after updating some kernel packages on my RHEL 8.5 servers: ``` Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/dnf/plugin.py", line 104, in _caller getattr(plugin, method)() File "/usr/lib/python3.6/site-packages/dnf-plugins/post-transaction-actions.py", line 134, in transaction pkgs = [tsi.pkg for tsi in ts_items] File "/usr/lib/python3.6/site-packages/dnf-plugins/post-transaction-actions.py", line 134, in <listcomp> pkgs = [tsi.pkg for tsi in ts_items] File "/usr/lib/python3.6/site-packages/dnf/db/history.py", line 157, in pkg return self._swdb.rpm._swdb_ti_pkg[self._item] KeyError: <libdnf.transaction.TransactionItem; proxy of <Swig Object of type 'libdnf::TransactionItemPtr *' at 0x7f4970c22db0> > ``` Version-Release number of selected component (if applicable): 4.7.0-4.el8 How reproducible: Always. Steps to Reproduce: 1. Upgrade packages with DNF. 2. Notice traceback in DNF output. Actual results: ``` [sa@secure5 ~]$ sudo dnf update Failed to set locale, defaulting to C.UTF-8 Last metadata expiration check: 3:12:08 ago on Tue Nov 16 07:00:35 2021. Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: kernel x86_64 4.18.0-348.2.1.el8_5 rhel-8-for-x86_64-baseos-rpms 7.0 M kernel-core x86_64 4.18.0-348.2.1.el8_5 rhel-8-for-x86_64-baseos-rpms 38 M kernel-modules x86_64 4.18.0-348.2.1.el8_5 rhel-8-for-x86_64-baseos-rpms 30 M Upgrading: kernel-tools x86_64 4.18.0-348.2.1.el8_5 rhel-8-for-x86_64-baseos-rpms 7.2 M kernel-tools-libs x86_64 4.18.0-348.2.1.el8_5 rhel-8-for-x86_64-baseos-rpms 7.0 M python3-perf x86_64 4.18.0-348.2.1.el8_5 rhel-8-for-x86_64-baseos-rpms 7.1 M Removing: kernel x86_64 4.18.0-305.19.1.el8_4 @rhel-8-for-x86_64-baseos-rpms 0 kernel-core x86_64 4.18.0-305.19.1.el8_4 @rhel-8-for-x86_64-baseos-rpms 67 M kernel-modules x86_64 4.18.0-305.19.1.el8_4 @rhel-8-for-x86_64-baseos-rpms 22 M Transaction Summary ================================================================================ Install 3 Packages Upgrade 3 Packages Remove 3 Packages Total download size: 96 M Is this ok [y/N]: y Downloading Packages: (1/6): kernel-4.18.0-348.2.1.el8_5.x86_64.rpm 13 MB/s | 7.0 MB 00:00 (2/6): kernel-core-4.18.0-348.2.1.el8_5.x86_64. 29 MB/s | 38 MB 00:01 (3/6): kernel-modules-4.18.0-348.2.1.el8_5.x86_ 19 MB/s | 30 MB 00:01 (4/6): python3-perf-4.18.0-348.2.1.el8_5.x86_64 6.2 MB/s | 7.1 MB 00:01 (5/6): kernel-tools-4.18.0-348.2.1.el8_5.x86_64 16 MB/s | 7.2 MB 00:00 (6/6): kernel-tools-libs-4.18.0-348.2.1.el8_5.x 17 MB/s | 7.0 MB 00:00 -------------------------------------------------------------------------------- Total 46 MB/s | 96 MB 00:02 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Running scriptlet: kernel-core-4.18.0-348.2.1.el8_5.x86_64 1/1 Installing : kernel-core-4.18.0-348.2.1.el8_5.x86_64 1/12 Running scriptlet: kernel-core-4.18.0-348.2.1.el8_5.x86_64 1/12 Installing : kernel-modules-4.18.0-348.2.1.el8_5.x86_64 2/12 Running scriptlet: kernel-modules-4.18.0-348.2.1.el8_5.x86_64 2/12 Upgrading : kernel-tools-libs-4.18.0-348.2.1.el8_5.x86_64 3/12 Running scriptlet: kernel-tools-libs-4.18.0-348.2.1.el8_5.x86_64 3/12 Upgrading : kernel-tools-4.18.0-348.2.1.el8_5.x86_64 4/12 Installing : kernel-4.18.0-348.2.1.el8_5.x86_64 5/12 Upgrading : python3-perf-4.18.0-348.2.1.el8_5.x86_64 6/12 Erasing : kernel-4.18.0-305.19.1.el8_4.x86_64 7/12 Running scriptlet: kernel-4.18.0-305.19.1.el8_4.x86_64 7/12 Cleanup : kernel-tools-4.18.0-348.el8.x86_64 8/12 Erasing : kernel-modules-4.18.0-305.19.1.el8_4.x86_64 9/12 Running scriptlet: kernel-modules-4.18.0-305.19.1.el8_4.x86_64 9/12 Running scriptlet: kernel-core-4.18.0-305.19.1.el8_4.x86_64 10/12 Erasing : kernel-core-4.18.0-305.19.1.el8_4.x86_64 10/12 Cleanup : kernel-tools-libs-4.18.0-348.el8.x86_64 11/12 Running scriptlet: kernel-tools-libs-4.18.0-348.el8.x86_64 11/12 Cleanup : python3-perf-4.18.0-348.el8.x86_64 12/12 Running scriptlet: kernel-core-4.18.0-348.2.1.el8_5.x86_64 12/12 Running scriptlet: python3-perf-4.18.0-348.el8.x86_64 12/12 Verifying : kernel-4.18.0-348.2.1.el8_5.x86_64 1/12 Verifying : kernel-core-4.18.0-348.2.1.el8_5.x86_64 2/12 Verifying : kernel-modules-4.18.0-348.2.1.el8_5.x86_64 3/12 Verifying : python3-perf-4.18.0-348.2.1.el8_5.x86_64 4/12 Verifying : python3-perf-4.18.0-348.el8.x86_64 5/12 Verifying : kernel-tools-4.18.0-348.2.1.el8_5.x86_64 6/12 Verifying : kernel-tools-4.18.0-348.el8.x86_64 7/12 Verifying : kernel-tools-libs-4.18.0-348.2.1.el8_5.x86_64 8/12 Verifying : kernel-tools-libs-4.18.0-348.el8.x86_64 9/12 Verifying : kernel-4.18.0-305.19.1.el8_4.x86_64 10/12 Verifying : kernel-core-4.18.0-305.19.1.el8_4.x86_64 11/12 Verifying : kernel-modules-4.18.0-305.19.1.el8_4.x86_64 12/12 Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/dnf/plugin.py", line 104, in _caller getattr(plugin, method)() File "/usr/lib/python3.6/site-packages/dnf-plugins/post-transaction-actions.py", line 134, in transaction pkgs = [tsi.pkg for tsi in ts_items] File "/usr/lib/python3.6/site-packages/dnf-plugins/post-transaction-actions.py", line 134, in <listcomp> pkgs = [tsi.pkg for tsi in ts_items] File "/usr/lib/python3.6/site-packages/dnf/db/history.py", line 157, in pkg return self._swdb.rpm._swdb_ti_pkg[self._item] KeyError: <libdnf.transaction.TransactionItem; proxy of <Swig Object of type 'libdnf::TransactionItemPtr *' at 0x7f4970c22db0> > Upgraded: kernel-tools-4.18.0-348.2.1.el8_5.x86_64 kernel-tools-libs-4.18.0-348.2.1.el8_5.x86_64 python3-perf-4.18.0-348.2.1.el8_5.x86_64 Installed: kernel-4.18.0-348.2.1.el8_5.x86_64 kernel-core-4.18.0-348.2.1.el8_5.x86_64 kernel-modules-4.18.0-348.2.1.el8_5.x86_64 Removed: kernel-4.18.0-305.19.1.el8_4.x86_64 kernel-core-4.18.0-305.19.1.el8_4.x86_64 kernel-modules-4.18.0-305.19.1.el8_4.x86_64 Complete! [sa@secure5 ~]$ echo $? 0 ```