Bug 1218403

Summary: dnf history undo dopesn't work
Product: [Fedora] Fedora Reporter: pstodulk
Component: dnfAssignee: 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   
See Also: https://bugzilla.redhat.com/show_bug.cgi?id=1218415
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-05-05 09:57:21 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description pstodulk 2015-05-04 15:41:37 EDT
Description of problem:
Transaction can't be undone by dnf.

Version-Release number of selected component (if applicable):
dnf-0.6.4-1.fc21.noarch
.. and newer

How reproducible:
always

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

Actual results:
[snip]
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 pstodulk 2015-05-04 16:05:07 EDT
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 16:10:29 EDT
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 05:30:45 EDT
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 pstodulk 2015-05-05 06:45:10 EDT
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 07:17:33 EDT
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 pstodulk 2015-05-05 07:48:30 EDT
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 09:57:21 EDT
The problem is really missing package in repo. Closing...