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 community
$ 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.
-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)
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
# 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.
Yes, you can safely remove these packages. These packages are only used as cache by Packagekit.
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.
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.
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!!