I noticed that the folder referenced in the subject line is taking up 1.5 GB. Can I run the below to clear it without causing permanent damage to my system?
rm -rf /var/cache/PackageKit/metadata/updates/packages/*
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityI noticed that the folder referenced in the subject line is taking up 1.5 GB. Can I run the below to clear it without causing permanent damage to my system?
rm -rf /var/cache/PackageKit/metadata/updates/packages/*
From the discussion in the bug linked in Daniel Bruno's answer .. you can get rid of these files using PackageKit console client pkcon
$ sudo pkcon refresh force -c -1
It takes some time but is provided by PackageKit itself. (and you may set a cron job for it)
from the man page of pkcon(1)
refresh [force]
Refresh the cached information about available updates.
and
-c, --cache-age AGE
Set the maximum acceptable age for cached metadata, in seconds. Use -1 for 'never'.
So this tells PackageKit to delete cached information (refresh cached information with maximum acceptable age of : never)
References :
/var/cache/PackageKit
directory. What am I missing?
Jan 21, 2017 at 14:44
dnf
quite a bit too. I have 3 additional directories (23, 24, 25)) under the /var/cache/PackageKit
that all contain rpm files. I think my only real option here is manual deletion at this point.
Jan 21, 2017 at 15:01
PackageKit is used by GNOME. If you use Yum or DNF on the CLI then don't need these. You can remove the .rpm files in /var/cache/PackageKit/metadata/updates/packages
and set PackageKit to not store them any longer.
There is a setting in the file /etc/PackageKit/PackageKit.conf
# Keep the packages after they have been downloaded
#KeepCache=false
As root, remove the hash mark on this configuration option and the packages will not be saved.
/var/cache/PackageKit
directory is still growing. That means: Does not work neither on Fedora 24, and as of Thomas Mueller, nor on Fedora 25.
Yes, you can safely remove these packages. These packages are only used as cache by Packagekit.
/var/cache/PackageKit/24
or /var/cache/PackageKit/25
directories after upgrade to Fedora 26. pkcon
from accepted answer does not remove them.
if not using PackageKit to update (but dnf) one should consider disabling PackageKit auto-download, because PackageKit will only clear its cache when using it to install updates:
gsettings set org.gnome.software download-updates false
I think this auto-download should be opt-in instead of opt-out.
sudo
, i.e. as user root.
The pkcon refresh force -c -1
solution didn't work for me since there was multiple Fedora versions in the wake in my upgrade path. I solved the space issue constructively by dnf clean all --releasever=xxx
where xxx is the old version that needed cleaned out. It cleaned out about 8 Gig of space for the previous version.
The pkcon refresh [force]
command given in the accepted answer works, but, importantly, only for currently enabled repositories. It doesn't delete no longer needed files in the caches for older repositories, most notably for old distribution versions. Those can be safely deleted manually. (If you really want to delete them using pkcon
, then some manner of pkcon repo-enable [reponame]; pkcon fresh force; pkcon repo-disable [reponame]
can work.)
I was getting storage space warnings when booting Fedora25 on my virtual machine. I followed the aforementioned solution to edit the /etc/PackageKit/PackageKit.conf file and uncommented the #KeepCache=false line and saved the file. Then I ran the following cmd: pkcon refresh force -c -1 but there were still unwanted files in /var/cache/PackageKit/ so i ran rm -r -f /var/cache/PackageKit/* at the command line to delete these cached files. I restarted Fedora and Voila! No more errors!!