Bug 2226661

Summary: Dnf5 doesn't support rollback of transaction history
Product: [Fedora] Fedora Reporter: Martin Osvald 🛹 <mosvald>
Component: dnf5Assignee: rpm-software-management
Status: NEW --- QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: 39CC: jkolarik, jplesnik, nsella, pkratoch, rpm-software-management
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Martin Osvald 🛹 2023-07-26 06:39:03 UTC
If you want to undo e.g. the last transaction `dnf history` doesn't support that.

Reproducible: Always

Steps to Reproduce:
# dnf history undo last

or

# dnf history undo XXX 
Actual Results:  
~~~
# dnf history undo last
Unknown argument "undo" for command "history". Add "--help" for more information about the arguments.
#
~~~

or 

~~~
# dnf history list
ID Command line                                           Date and time                 Action(s) Altered
 5 dnf update -y                                          2023-07-26 04:38:05.000000000               346
 4 dnf install rpmdevtools -y                             2023-07-25 11:56:16.000000000                 6
 3 dnf install rpm-build -y                               2023-07-25 11:31:30.000000000                26
 2 dnf builddep rpmbuild/SPECS/rpm.spec --enablerepo=* -y 2023-07-25 11:27:42.000000000               328
 1 dnf install dnf5-plugins -y                            2023-07-25 11:25:51.000000000                21
#

# dnf history undo 5
Unknown argument "undo" for command "history". Add "--help" for more information about the arguments.
#
~~~

Expected Results:  
It should be supported like it is with dnf4:

~~~
# dnf hist list
ID     | Command line                                 | Date and time    | Action(s)      | Altered
---------------------------------------------------------------------------------------------------
    11 | install mc -y                                | 2023-07-26 02:34 | Install        |    2
...

# dnf hist undo 11
Last metadata expiration check: 0:11:19 ago on Wed 26 Jul 2023 02:25:24 AM EDT.
Dependencies resolved.
===================================================================================================
 Package            Architecture        Version                        Repository             Size
===================================================================================================
Removing:
 mc                 x86_64              1:4.8.29-1.fc38                @updates              7.1 M
Removing dependent packages:
 slang              x86_64              2.3.3-3.fc38                   @fedora               1.6 M

Transaction Summary
===================================================================================================
Remove  2 Packages

Freed space: 8.6 M
Is this ok [y/N]:
~~~

Note: This functionality is often used by customers on RHELs.

Comment 1 Nicola Sella 2023-07-31 10:58:15 UTC
This is tracked upstream: https://github.com/rpm-software-management/dnf5/issues/140

Comment 2 Fedora Release Engineering 2023-08-16 08:13:37 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle.
Changing version to 39.