How to fix "Cannot retrieve repository metadata (repomd.xml)" in CentOS?
correct el%24releasever variable name to $releasever in your repo file. for more information about yum variables check yum.conf.
Variables
There are a number of variables you can use to ease maintenance of yum's configuration files. They are available in the values of several options including name, baseurl and commands.
$releasever This will be replaced with the value of the version of the package listed in distroverpkg. This defaults to the version of
'redhat-release' package.
$arch This will be replaced with your architecture as listed by os.uname()[4] in Python. $basearch This will be replaced with your base architecture in yum. For example, if your $arch is i686 your $basearch will be i386. $uuid This will be replaced with a unique but persistent uuid for this machine. The value that is first generated will be stored in
/var/lib/yum/uuid and reused until this file is deleted.
$YUM0-$YUM9 These will be replaced with the value of the shell environment variable of the same name. If the shell environment
variable does not exist then the configuration file variable will not be replaced. As of 3.2.28, any file in /etc/yum/vars is turned into a variable named after the filename (or overrides any of the above variables).
Note that no warnings/errors are given if the files are unreadable, so creating files that only root can read may be confusing for users.
Also note that only the first line will be read and all new line characters are removed, as a convenience. However, no other checking is performed on the data. This means it is possible to have bad character data in any value.
also this topic will be useful for understanding yum variables.
Related videos on Youtube
Comments
-
Rob over 1 year
I've tried
yum update yum
andyum clean all
, but neither help to resolve the following problem:# yum install httpd --installroot=/opt/httpd2 Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * rpmforge: repoforge.spinellicreations.com http://centos.karan.org/el%24releasever/extras/stable/x86_64/RPMS/repodata/repomd.xml: [Errno 14] HTTP Error 404: Not Found Trying other mirror. Error: Cannot retrieve repository metadata (repomd.xml) for repository: kbs-CentOS-Extras. Please verify its path and try again
I've also tried deleting any
.repo
files for kbs-CentOS-Extras from/etc/yum.repos.d
, and re-running the command, without any changes. Here's my system information, just in case:# uname -a Linux 2.6.18-274.3.1.el5xen #1 SMP Tue Sep 6 20:57:11 EDT 2011 x86_64 GNU/Linux
I am now using the
.repo
file provided here. Here is my/etc/yum.conf
:[main] cachedir=/var/cache/yum keepcache=0 debuglevel=2 logfile=/var/log/yum.log distroverpkg=redhat-release tolerant=1 exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 bugtracker_url=http://bugs.centos.org/yum5bug timeout=300 installonly_limit = 5 # Note: yum-RHN-plugin doesn't honor this. metadata_expire=1h
The
yum.log
file is empty, but/var/cache/yum/kbs-CentOS-Misc
contains arepomd.xml
-- could this perhaps be used instead of the remote copy?If not, any suggestions for how I can solve this?
-
user9517 over 10 yearsShow us the relevant .repo file
-
krisFR over 10 yearsSeems that
$releasever
is not correctly expanded (el%24releasever
). Can you provide us your/etc/yum.conf
file ?
-