Bug 186041

Summary: yum cleans up downloaded packages after running out of mirrors
Product: [Fedora] Fedora Reporter: simon
Component: yumAssignee: Jeremy Katz <katzj>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 5CC: bugs+fedora, dant, katzj, sangu.fedora
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-09-18 20:24:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 182226    

Description simon 2006-03-21 09:38:37 UTC
Description of problem:
I was trying to use yum to install lyx + deps, however it kept failing because
it could not find a mirror with one of the packages (although it managed to get
the header). It did manage to download most of the packages before this stage,
however subsequent re-runs of yum attempted to redownload all the packages
again. Examining the /var/cache/yum dir showed no downloaded packages. 

It seems that yum is incorrectly thinking that it sucessfully installed the
packages and is removing them.

If i press ctrl-C until yum exits, then it keeps the packages as expected.


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


How reproducible:
Every time so far, however it is often with a different package. 


Steps to Reproduce:
1. Try and install a package that is not available on all (any?) mirrors yet
2. Yum exits and removed packages.
3.
  
Actual results:
No rpms in /var/cache/yum


Expected results:
rpms of downloaded files in /var/cache/yum

Additional info:

Comment 1 Gérard Milmeister 2006-03-27 02:18:46 UTC
In your /etc/yum.conf set:
keepcache=1


Comment 2 simon 2006-03-27 09:18:39 UTC
The man page for yum says that keepcache needs to be set to 1 if you want to
keep packages after a succesful installation. In this case installation is
unsuccesful but it still removes the packages.

Comment 3 Dan Thurman 2006-04-03 22:22:15 UTC
NOTE: Yum wipes out cache downloaded files after a crash.

Following is crash data.  Note that somehow, yum was not
able to locate the file so it crashes.  Since yum is
transactional, all cache data is blown away as you cannot
necessairly see that in the crash dump - but I have verified
that my /var/cache/yum/*/packages are wiped clean after the
crash

downloading Packages:
(1/43): snort-2.4.4-3.fc5 100% |=========================| 941 kB
00:24
(2/43): koffice-kivio-1.5 100% |=========================| 1.3 MB
00:35
(3/43): graveman-0.3.12.4 100% |=========================| 702 kB
00:17
(4/43): koffice-kpresente 100% |=========================| 2.9 MB
01:16
(5/43): gwget-0.97-3.fc5. 100% |=========================| 216 kB
00:05
(6/43): jabberd-2.0-0.s11 100% |=========================| 561 kB
00:14
(7/43): qalculate-kde-0.9 100% |=========================| 1.1 MB
00:28
(8/43): dia-0.94-21.i386. 100% |=========================| 2.9 MB
01:14
(9/43): lyx-1.4.0-5.fc5.i 100% |=========================| 4.2 MB
01:50
(10/43): gparted-0.2.3-1. 100% |=========================| 424 kB
00:10
(11/43): azureus-2.4.0.3- 100% |=========================| 9.8 MB
04:13
(12/43): python-imaging-1 100% |=========================| 406 kB
00:10
(13/43): koffice-kexi-1.5 100% |=========================| 3.6 MB
01:37
(14/43): koffice-kplato-1 100% |=========================| 909 kB
00:22
(15/43): ircd-hybrid-7.2. 100% |=========================| 612 kB
00:15
(16/43): rssowl-1.2-13.fc 100% |=========================| 3.0 MB
01:18
(17/43): vnstat-1.4-7.fc5 100% |=========================|  38 kB
00:01
(18/43): qalculate-gtk-0. 100% |=========================| 1.3 MB
00:37
(19/43): koffice-suite-1. 100% |=========================| 4.3 kB
00:00
(20/43): mediawiki-math-1 100% |=========================| 131 kB
00:05
(21/43): brightside-1.4.0 100% |=========================| 118 kB
00:02
(22/43): libqalculate-0.9 100% |=========================| 875 kB
00:24
(23/43): wine-0.9.11-1.fc 100% |=========================| 9.7 MB
04:11
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in ?
    yummain.main(sys.argv[1:])
  File "/usr/share/yum-cli/yummain.py", line 175, in main
    base.doTransaction()
  File "/usr/share/yum-cli/cli.py", line 660, in doTransaction
    problems = self.downloadPkgs(downloadpkgs)
  File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 663, in
downloadPkgs
    cache=repo.http_caching != 'none',
  File "/usr/lib/python2.4/site-packages/yum/repos.py", line 626, in get
    http_headers=headers,
  File "/usr/lib/python2.4/site-packages/urlgrabber/mirror.py", line
411, in urlgrab
    return self._mirror_try(func, url, kw)
  File "/usr/lib/python2.4/site-packages/urlgrabber/mirror.py", line
397, in _mirror_try
    return func_ref( *(fullurl,), **kwargs )
  File "/usr/lib/python2.4/site-packages/urlgrabber/grabber.py", line
784, in urlgrab
    return self._retry(opts, retryfunc, url, filename)
  File "/usr/lib/python2.4/site-packages/urlgrabber/grabber.py", line
702, in _retry
    r = apply(func, (opts,) + args, {})
  File "/usr/lib/python2.4/site-packages/urlgrabber/grabber.py", line
772, in retryfunc
    fo._do_grab()
  File "/usr/lib/python2.4/site-packages/urlgrabber/grabber.py", line
1102, in _do_grab
    os.utime(self.filename, (modified_stamp, modified_stamp))
OSError: [Errno 2] No such file or directory:
'//var/cache/yum/extras/packages/wine-0.9.11-1.fc5.i386.rpm'

Comment 4 Jeremy Katz 2006-04-19 20:41:34 UTC
I can't at all reproduce this here -- the only time I can get packages removed
is if there is a successful installation.

Can you provide complete steps for easy reproducing?

Comment 5 Juliano F. Ravasi 2006-04-28 21:56:40 UTC
Confirmed here. Yum just killed my packages directory with about 500MB
downloaded after a crash. Message similar to comment 3, but for a different package.

Comment 6 Jeremy Katz 2006-09-18 20:24:04 UTC
This should be handled better now