Undo transaction with dnf5 history not working

dnf5 history undo < transaction > should work to revert an update, but I currently get

dnf5 history undo 31
Unknown argument "undo" for command "history". Add "--help" for more information about the arguments.

I added --help

dnf5 history undo 31 --help
Usage:
  dnf5 [GLOBAL OPTIONS] history <COMMAND> ...
                                
Query Commands:                 
  list                          List transactions
  info                          Print details about transactions
                                
Software Management Commands:   
  store                         [experimental] Store transaction to a file
Unknown argument "undo" for command "history".

This document show that it should work,

https://dnf5.readthedocs.io/en/latest/commands/history.8.html


undo
    Revert all actions from the specified transaction.


dnf5 history undo last
    Undo the last transaction.
dnf5 history undo 4 --ignore-extras
    Undo the fourth transaction ignoring extra packages pulled into the reverting transaction.


Is it outdated?

Yes it is. The pre-beta version of Fedora 41 hasdnf5-5.2.5.0-2.fc41, and this version has dnf5 history undo implemented.

1 Like

Added f40

I should note I am on Fedora 40 Here is dnf info dnf5

dnf info dnf5
4Last metadata expiration check: 0:38:29 ago on Sun 15 Sep 2024 02:39:57 PM EDT.
Installed Packages
Name         : dnf5
Version      : 5.1.17
Release      : 2.fc40
Architecture : x86_64
Size         : 1.7 M
Source       : dnf5-5.1.17-2.fc40.src.rpm
Repository   : @System
Summary      : Command-line package manager
URL          : https://github.com/rpm-software-management/dnf5
License      : GPL-2.0-or-later
Description  : DNF5 is a command-line package manager that automates the process of installing,
             : upgrading, configuring, and removing computer programs in a consistent manner.
             : It supports RPM packages, modulemd modules, and comps groups & environments.

So is it possible to utilize history, rollback, undo or other featrures to rollback to a previous update with this dnf5 :thinking:

Rollback also appears to work…


[grumpey@grumpey0 ~]$ dnf info dnf5 --installed
Installed packages
Name            : dnf5
Epoch           : 0
Version         : 5.2.5.0
Release         : 2.fc41
Architecture    : x86_64
Installed size  : 1.6 MiB
Source          : dnf5-5.2.5.0-2.fc41.src.rpm
From repository : <unknown>
Summary         : Command-line package manager
URL             : https://github.com/rpm-software-management/dnf5
License         : GPL-2.0-or-later
Description     : DNF5 is a command-line package manager that automates the process of installing,
                : upgrading, configuring, and removing computer programs in a consistent manner.
                : It supports RPM packages, modulemd modules, and comps groups & environments.
Vendor          : Fedora Project
1 Like

I guess I need to find a way to add it to F40 ?

Have you checked if “testing” is the version you are looking for?

I have not, I just got back in this morning. It will be something for me to try this afternoon or tomorrow though. Thanks for the tip !

1 Like
is assumed that they were committed while using the history_record configuration option.

Maybe this wasn’t the case you did transaction 31 (or all of your transactions)?

not quite understanding here, can you explain further?

It looks like that the older version simply not has the option implemented on F40, then when I use
dnf5 history undo I get =

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

While doing it on F41 beta I installed today:

$ dnf5 history undo
Missing positional argument "transaction-id" for command "undo". Add "--help" for more information about the arguments.

It indeed needs the higher version.

@hamrheadcorvette it looks like that the update of the man-page already happened while the command was not implemented.

1 Like

That’s what it seems. When I tried it yesterday, it also returned a blank. So I guess if I manage to install the newer version maybe I can use the history command like above?

dnf5 history undo 31

I want to go back to the previous state before the 31 transaction.

Story time:
( Because I am still working on getting everything back together after the crash, I haphazardly did this update. Now I’m stuck on some things as some bugs are introduced because of it. I’m disappointed in myself for updating, because I never do that during a big project, but it had been a month and I though :fire: “should be fine” :fire: I think reverting to that update brings me in line with this final push to finish. )

Thanks for everyone’s feedback. Been going through a lot since the Hardware crash last month so this was annoying. I never do updates in the middle of work, but for whatever reason, sunday I did and now I have to find other solutions for my scripts to gett back working right.

Now, What I ended up doing was going to the dnf5 github page

and adding the dnf nightly package. It ended up installing

dnf update dnf5
Last metadata expiration check: 0:00:21 ago on Tue 17 Sep 2024 10:35:24 AM EDT.
Dependencies resolved.
==============================================================================================================================================================================================
 Package                    Architecture         Version                                                 Repository                                                                      Size
==============================================================================================================================================================================================
Upgrading:
 dnf5                       x86_64               5.2.6.0-20240917005037.13.g8ad4614c.fc40                copr:copr.fedorainfracloud.org:rpmsoftwaremanagement:dnf-nightly               624 k
 dnf5-plugins               x86_64               5.2.6.0-20240917005037.13.g8ad4614c.fc40                copr:copr.fedorainfracloud.org:rpmsoftwaremanagement:dnf-nightly               323 k
 libdnf5                    x86_64               5.2.6.0-20240917005037.13.g8ad4614c.fc40                copr:copr.fedorainfracloud.org:rpmsoftwaremanagement:dnf-nightly               1.1 M
 libdnf5-cli                x86_64               5.2.6.0-20240917005037.13.g8ad4614c.fc40                copr:copr.fedorainfracloud.org:rpmsoftwaremanagement:dnf-nightly               274 k

Transaction Summary
==============================================================================================================================================================================================
Upgrade  4 Packages

The features work here. Buuuuuut. . . I have a lot of conflicts and a lot of

Cannot perform Install action, no match for:

This is really not something can comeback from. So in hindsight, it’s a good place for having system snapshots !

To make the undo command work, you need to install and enable this:
fedora-repos-archive - Fedora Packages

But I don’t think that using DNF5 on F40 is recommended for anything other than testing.

1 Like

@vgaetera thanks for the reply, The nightly has everything. I probably should have kept it to be honest, but after seeing the results and conflicts I have decided to approach my issues with the bugs in a different way. Reverting this update is basically not possible since I have mesa, nvidia and other conflicts that the tool cannot retrieve any longer. Outside of other conflicts.

It’s been a rough 2 months. . . But we will get through it !