Bug 1911753 - dnf history undo not working
Summary: dnf history undo not working
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 33
Hardware: Unspecified
OS: Linux
unspecified
urgent
Target Milestone: ---
Assignee: Jaroslav Rohel
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-12-31 01:48 UTC by Robbi Nespu
Modified: 2021-01-04 13:05 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-01-04 13:05:50 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Robbi Nespu 2020-12-31 01:48:04 UTC
Description of problem:
Undo transaction cannot be carry out by dnf

Version-Release number of selected component (if applicable):

$ dnf info dnf
Last metadata expiration check: 0:16:26 ago on Thu 31 Dec 2020 09:25:29 AM +08.
Installed Packages
Name         : dnf
Version      : 4.5.2
Release      : 1.fc33
Architecture : noarch
Size         : 2.0 M
Source       : dnf-4.5.2-1.fc33.src.rpm
Repository   : @System
From repo    : updates-testing
Summary      : Package manager
URL          : https://github.com/rpm-software-management/dnf
License      : GPLv2+
Description  : Utility that allows users to manage packages on their systems.
             : It supports RPMs, modules and comps groups & environments.



How reproducible:


Steps to Reproduce:
1. dnf update icecat
2. dnf history undo last

Actual results:
$ sudo dnf history undo last
[sudo] password for robbi:
Last metadata expiration check: 0:24:35 ago on Thu 31 Dec 2020 09:18:49 AM +08.
Undoing transaction 15, from Thu 31 Dec 2020 09:31:29 AM +08
    Upgrade  icecat-78.6.0-2.rh1.fc33.x86_64 @updates
    Upgraded icecat-78.5.0-2.rh2.fc33.x86_64 @@System
No package icecat-78.5.0-2.rh2.fc33.x86_64 available.
Error: no package matched


Expected results:
DNF should able to undo / downgrade icecat package back to 78.5.0-2.rh2.fc33


Additional info:
dnf history info 15
Transaction ID : 15
Begin time     : Thu 31 Dec 2020 09:31:29 AM +08
Begin rpmdb    : 1448:392d27370be7608526fcef0475d4bee78ebffc22
End time       : Thu 31 Dec 2020 09:31:47 AM +08 (18 seconds)
End rpmdb      : 1448:46959b33ef3c9604fe74ec6a98b5d13771f73f3b
User           : robbi <robbi>
Return-Code    : Success
Releasever     : 33
Command Line   : update icecat
Comment        :
Packages Altered:
    Upgrade  icecat-78.6.0-2.rh1.fc33.x86_64 @updates
    Upgraded icecat-78.5.0-2.rh2.fc33.x86_64 @@System

Comment 1 Jaroslav Rohel 2021-01-04 07:42:18 UTC
DNF is right. DNF wants to downgrade the "icecat" package back. However,  the "icecat-78.5.0-2.rh2.fc33.x86_64" package is not available in the repositories.

How it can happen?
Packages in the "updates" repository are frequently updated and older packages are removed over time. Probably the "icecat-78.5.0-2.rh2.fc33.x86_64" package was in the "updates" repository some time ago. Your system had been updated to it. Later, updated package "icecat-78.6.0-2.rh1.fc33.x86_64" came to the "updates" repository. The older package "icecat-78.5.0-2.rh2.fc33.x86_64" was removed from the "updates" repository after some time. The "icecat" package was updated on your system again. You want to perform "undo". However, the "icecat-78.5.0-2.rh2.fc33.x86_64" package is not available in the repositories. Therefore, no package matched to the DNF request and DNF generate error message "Error: no package matched".

Comment 2 Daniel Mach 2021-01-04 12:42:38 UTC
There's a upstream PR on improving the history command:
https://github.com/rpm-software-management/dnf/pull/1689

It's probably not going to fix the issue completely (the root cause is an unavailable package),
but the new behaviour could be better. There is going to be an option to skip missing packages.


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