Bug 2331691 - dnf5 repeatedly prints the output of long-running postinstall scripts during upgrades
Summary: dnf5 repeatedly prints the output of long-running postinstall scripts during ...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf5
Version: 41
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
Assignee: rpm-software-management
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-12-11 16:43 UTC by Chris Siebenmann
Modified: 2025-01-10 09:02 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)
typescript of 'dnf upgrade' for a kernel upgrade with a DKMS package rebuild (553.21 KB, text/plain)
2025-01-09 16:29 UTC, Chris Siebenmann
no flags Details

Description Chris Siebenmann 2024-12-11 16:43:39 UTC
Description of problem:
If a postinstall script runs for a long enough time and produces output during this
time, and you perform a 'dnf upgrade' that invokes such a postinstall script, dnf5
will repeatedly re-print the entire output to date every time it prints some sort
of progress update, for example when it is removing now-upgraded packages.

The specific situation I am seeing this in is during kernel upgrades, where the
upgrade runs DKMS and DKMS re-runs the configuration process for ZFS on Linux's
DKMS kernel module, which (slowly) produces the usual large amount of configure
output. This entire multi-line output is then repeatedly printed out every time
dnf prints a progress output for removing old kernel packages.

dnf4 saved up the entire output of the postinstall and printed it out at once,
at the end. I understand why dnf5 might want to do better, but the current
result is essentially impossible to read and follow, and dnf5 provides no option
to disable the progress reports or produce the output only at the end.

Version-Release number of selected component (if applicable):
dnf5-5.2.8.1-1.fc41.x86_64

How reproducible:
Always.

Comment 1 Marek Blaha 2025-01-09 10:27:15 UTC
I tried to reproduce the issue with this made-up package:

```
Name:           test-scriptlet-output
Epoch:          0
Version:        2.0
Release:        1

License:        Public Domain
URL:            None

Summary:        The made up package for scriptlets testing.

%description
Successfully runs post scriptlet

%post
for i in {1..15}; do
    echo "Number: $i"
    sleep 2
done

%files

%changelog
```

The post-install scriptlet output was printed only once after the scriptlet finished.
I must have missed something important to reproduce the issue. Can you share a print screen to illustrate the wrong behavior?

You can also try to reproduce it with the latest nightly dnf5 build from copr repository https://copr.fedorainfracloud.org/coprs/rpmsoftwaremanagement/dnf5-testing-nightly/ (there are some enhancement to progress bars behavior that are still not released).

Comment 2 Chris Siebenmann 2025-01-09 16:10:49 UTC
I think I wasn't clear in my initial description; this requires other packages being upgraded at the same time, so that the script output from one package is intermixed with dnf's progress reporting of updating and removing other packages. As far as I know and have seen, if you update a single package with this sort of long-running script output, everything works fine. I have a test Fedora 41 VM with a DKMS kernel module, but my attempt to reproduce the problem under 'script' failed with a different problem, where DKMS didn't rebuild the module at all for some reason, so I'm going to have to do more work before I can provide a demonstration (which will be very noisy when I manage it).

Comment 3 Chris Siebenmann 2025-01-09 16:28:14 UTC
I have a typescript now, from 'script' capturing a kernel upgrade with a DKMS module rebuild (OpenZFS), which I'll attach. When looking at the typescript, watch how the DKMS output is repeatedly shown in full each time DNF does a progress report about the package removal that happens concurrently with it.

Comment 4 Chris Siebenmann 2025-01-09 16:29:15 UTC
Created attachment 2065312 [details]
typescript of 'dnf upgrade' for a kernel upgrade with a DKMS package rebuild

Comment 5 Marek Blaha 2025-01-10 09:02:56 UTC
Thanks for clarifying - I really appreciate the script recording! Now I can see what you mean and confirm the bug. It looks like the reproducer would require several post-transaction and file-triggered scripts to be present in the transaction.


Note You need to log in before you can comment on or make changes to this bug.