What is the purpose of "yum makecache"?

General support questions
Post Reply
mikemikew
Posts: 8
Joined: 2019/09/25 11:19:29

What is the purpose of "yum makecache"?

Post by mikemikew » 2021/05/17 11:16:07

I noticed /var/cache/yum/ on some servers is huge, around 12GB. But on most servers it is under 1GB. I've traced the cause of the difference to a cronjob which has been put in place by some software installed on the servers with huge /var/cache/yum/ and is running

Code: Select all

/usr/bin/yum makecache
That's resulting in some very large files called other.xml and other.xml.sqlite in /var/cache/yum/, files which aren't otherwise present. If I do

Code: Select all

$ yum clean all
$ yum list updates
everything works fine, the other.xml and other.xml.sqlite files are not created in /var/cache/yum/ and it remains under 1GB. The yum manpage says makecache
Is used to download and make usable all the metadata for the currently enabled yum repos.
but doesn't explain why it downloads a lot more metadata than than various other options or why you'd want to use it and I haven't been able to find an explanation anywhere else. So given that it is evidently not required to run "yum makecache" what is the purpose of it? Under what circumstances would it be (at least potentially) useful to use it? I've been using yum on various distros for a long time, I don't recall even noticing makecache until now.

User avatar
TrevorH
Site Admin
Posts: 33191
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: What is the purpose of "yum makecache" ?

Post by TrevorH » 2021/05/17 12:18:25

IMO it's utterly pointless and I have no idea why it even exists. It's certainly not required as yum will cache that it needs when you run it. It might take a bit longer since it won't be precached but set against that, it will be fresh.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: What is the purpose of "yum makecache" ?

Post by jlehtone » 2021/05/17 12:30:17

man yum wrote:makecache
Is used to download and make usable all the metadata for the currently enabled yum repos. If the argument "fast" is passed, then we just try to make sure the repos are current (much like "yum clean expire-cache").
In other words: nothing special.

How could metadata use gigabytes?

I tend to clean also the disabled repositories:

Code: Select all

yum --enablerepo=* clean -v all
The "-v" makes clean more verbose and lists sizes of directories after the cleanup.

User avatar
TrevorH
Site Admin
Posts: 33191
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: What is the purpose of "yum makecache"?

Post by TrevorH » 2021/05/17 14:11:17

How could metadata use gigabytes?
Blindly running something like yum-config-manager --enable \* (note syntax may not be correct, more to show the meaning not the act).
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

mikemikew
Posts: 8
Joined: 2019/09/25 11:19:29

Re: What is the purpose of "yum makecache"?

Post by mikemikew » 2021/05/17 15:11:30

I've just found https://access.redhat.com/solutions/5302591 which gives an example of how metadata can use gigabytes. It requires a Red Hat account to read it all for some reason, so for those who can't see it, it explains that amongst the extra metadata that will be downloaded if you run "yum makecache" is
other.sqlite.bz2 * Defines the changelog of every package
filelists.sqlite.bz2 * Defines every file or directory provided by the packages
and that all the downloaded compressed files are unpacked after downloading and
From rhel-7-server-rpms/7Server we can see the extracted other_db.sqlite database consumes 2.2GB
Also, relevant to the servers I'm looking at, which are using our local repos on a Spacewalk server:
Red Hat Satellite 6 and Red Hat Update Infrastructure (RHUI) clients will encounter further disk usage as these servers do not offer sqlite-formatted repository metadata files by default. This causes those clients to download .xml.gz files and extract them to .xml files in the gen subdirectory, in addition to generating and keeping the .sqlite files on the filesystem
The webpage doesn't explain why you'd use "yum makecache" but does say
Avoid running this if possible.

User avatar
TrevorH
Site Admin
Posts: 33191
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: What is the purpose of "yum makecache"?

Post by TrevorH » 2021/05/17 15:56:19

filelists.sqlite.bz2 * Defines every file or directory provided by the packages
Is downloaded on demand as well, so if you run, for example, yum provides '/bin/bash' then filelists will be required and downloaded to give you an answer.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply