/var/cache/PackageKit/metadata gets very big

D. Hugh Redelmeier hugh at mimosa.com
Fri Mar 18 21:14:29 UTC 2016


| From: stan <stanl-fedorauser at vfemail.net>

Thanks for your useful response.  But there are still things that
puzzle/annoy me.

| On Thu, 17 Mar 2016 10:22:36 -0400 (EDT)
| "D. Hugh Redelmeier" <hugh at mimosa.com> wrote:
| 
| > On my Fedora 23
| > systems, /var/cache/PackageKit/metadata/updates/packages is full
| > of .rpm files.  For example, 2.7G on my desktop.
| > /var/cache/PackageKit/metadata/fedora/packages has some too.

| > "sudo dnf clean packages" doesn't seem to change this.  What does it 
| > change?
| 
| The dnf package storage is cleared.  PackageKit is independent of
| dnf.

Isn't dnf the user interface to PackageKit?

"man PackageKit" points to pkmon and pkcon, both with the identical
description: "PackageKit console client".  One of those is wrong.  In
any case, those commands don't seem to have knobs to adjust PackageKit
hoarding instincts.

| > What is the purpose of this directory of RPMs?
| 
| Saved in case of problems.

What kind of problems?

Perhaps they are used to reduce the size of download (so only a
difference needs to be transferred).

In any case, lots of the saved RPMs are obsoleted by other saved RPMs.
That seems like a waste.  So I deleted all the obsolete ones and saved
a lot of space.  I only bothered with
	/var/cache/PackageKit/metadata/updates/packages
so far.  That saved me almost 2G!

Here's how I did it.  Not quite a script yet.

	cd /var/cache/PackageKit/metadata/updates/packages

	# create a list of installed RPM files
	rpm -qa | sed -e 's/$/.rpm/' | sort >~/0installed

	# create a list of hoarded files
	ls >~/0saved

	# create a list of files that are obsoleted
	diff ~/0saved ~/0installed | sed -n -e 's/^< //p' >~/0obsolete

	# Exercise for the reader: delete files list in ~/0obsolete
	# This is the first step that requires root.
	# Note: ~/ means something different for each user.

Before I did this, "dnf update" failed due to lack of space.  After,
it just worked.  So I guess PackageKit isn't upset by files just
disappearing from this directory.

| > Is there a way of transplanting the RPMs to another system so that
| > downloading could be avoided?
| 
| rsync them into /var/cache/dnf/[hashed directory entry]/packages/

Thanks.  That seems a little hacky so I won't bother.

| > What is the proper way of deleting these RPMs to free up the space?  I
| > ask because on some machines (but not all) the space is burdensome.
| 
| There is a setting in the file
| /etc/PackageKit/PackageKit.conf
| 
| # Keep the packages after they have been downloaded
| #KeepCache=false

Thanks.  It didn't seem to affect old files (it didn't buy back space
that I needed for "dnf update"). I didn't try to debug this.  Perhaps
because PackageKit is a daemon and I didn't tap it on the shoulder to
reload the config.


More information about the users mailing list