Bug 1218403

Summary: dnf history undo dopesn't work
Product: [Fedora] Fedora Reporter: Petr Stodulka <pstodulk>
Component: dnfAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 21CC: jsilhan, mluscon, packaging-team-maint, pnemade, rholy, tla, vmukhame
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-05-05 13:57:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Petr Stodulka 2015-05-04 19:41:37 UTC
Description of problem:
Transaction can't be undone by dnf.

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

How reproducible:

Steps to Reproduce:
# dnf update
# dnf history undo last

Actual results:
No package libcom_err-0:1.42.12-3.fc21.i686 available.
Error: An operation cannot be undone

Expected results:
revert/undone last transaction successfully

Additional info:
# dnf history list | tail
    10 | update                   | 2015-04-20 12:32 | I, U           |   74   
     9 | update                   | 2015-04-17 08:00 | Update         |    3   
     8 | install python-pytest-pe | 2015-04-15 19:28 | Install        |    4   
     7 | install python?-pytest-p | 2015-04-15 19:21 | Install        |    6   
     6 | install pytest           | 2015-04-15 19:20 | Install        |    2   
     5 | install pycharm-communit | 2015-04-15 12:22 | Install        |    1   
     4 | install dnf-plugins-core | 2015-04-15 12:17 | Install        |    1   
     3 | install openscap-engine- | 2015-04-14 17:22 | Install        |    3   
     2 | update                   | 2015-04-14 16:17 | Update         |   63 EE
     1 | install openscap         | 2015-04-14 16:16 | Install        |    1

Comment 1 Petr Stodulka 2015-05-04 20:05:07 UTC
Problem solved after discussion with jsilhan.

You need set "keepcache=1" inside "/etc/dnf/dnf.conf", because otherwise undo of transaction is always impossible after update, because each older package is removed. That's really unhappy solution, that keepcache isn't set by default.

Comment 2 Honza Silhan 2015-05-04 20:10:29 UTC
history undo/redo should work even if "keepcache=0" as long as package is still available in repo. Maybe the problem is somewhere else.

Comment 3 Radek Holy 2015-05-05 09:30:45 UTC
But the package is not available, is it? It's clearly a problem with Fedora infrastructure that it does not keep older versions.
Keepcache is not on by default because it would fill your hard disk sooner or later. Another option is also the community plugin called "local".

Comment 4 Petr Stodulka 2015-05-05 10:45:10 UTC
Hi Radek,
older version probably isn't still available in repository and I haven't any previous package stored in cache.

> Keepcache is not on by default because it would fill your hard disk sooner or later.

Could be possible add option (as futurefeature), which restrict count of previous versions of some packages? Something like kept_versions=2 (I don't want think about usable name), which will remember 2 previous installed versions of package? It could solve problem with filling of hard disk during time.

However, IMHO I think that most important is the last previous version - "dnf history undo last", which should be possible always, and may this option will not be used the often.

I don't know plugin "local", but thanks for tip, I will look at it.

Comment 5 Radek Holy 2015-05-05 11:17:33 UTC
That would still be just a partial solution. One may want to call undo on multiple transactions or call rollback. Or their history may look like:
    upgrade foo-3.0 -> 4.0
    downgrade foo-4.0 -> 3.0
    upgrade foo-3.0 -> 5.0
Now, undo will fail again.

Anyway, I am not stopping anyone's effort to implement a plugin that works around the Fedora infrastructure issue.

Comment 6 Petr Stodulka 2015-05-05 11:48:30 UTC
Hmm... I don't see problem exactly here. In this scenario when you downgrade to previous version, you can check if you have downgraded version of package and in that case don't remove/add anything abotu this package in your cache. Yes, it will not be always possible undo on multiple transactions, but when you use some restrictions like that, you must expect it. But still you will be able to call undo for bigger set of transactions.

For me keepcache=1 is ok now. That's same behaviour which I use years on archlinux and I don't have troubles with one clean per few months period.

Comment 7 Honza Silhan 2015-05-05 13:57:21 UTC
The problem is really missing package in repo. Closing...