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.

Comment 3 Aoife Moloney 2024-11-08 11:00:38 UTC
This message is a reminder that Fedora Linux 39 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 39 on 2024-11-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '39'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 39 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.