I’m trying to do yum update. This is the error I’m getting.
sudo yum update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
12: Timeout on http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os: (28,'connect() timed out!')
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
I did wget http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os
. It never goes through. So I know I’ve to change this somehow.
Can anyone tell suggest me how to fix this. I found many posts related to this problem over here; but couldn’t find a proper solution for this.
My /etc/resolve.conf
is:
nameserver 130.102.115.238
nameserver 130.102.128.53
nameserver 130.102.2.53
I tried adding nameserver 8.8.8.8
. It didn’t work.
My /etc/yum.repos.d/Centos-Base.repo
is:
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
I tried commenting the mirrorlists and uncommenting the baseurls. Didn’t work.
I really need some help with this. Stuck on this for sometime now.
PS I am trying to set a Hadoop node using Cloudera. That’s when I encountered this problem. So I tried doing a yum update individually to figure out what’s wrong.
I’m trying to do yum update. This is the error I’m getting.
sudo yum update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
12: Timeout on http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os: (28,'connect() timed out!')
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
I did wget http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os
. It never goes through. So I know I’ve to change this somehow.
Can anyone tell suggest me how to fix this. I found many posts related to this problem over here; but couldn’t find a proper solution for this.
My /etc/resolve.conf
is:
nameserver 130.102.115.238
nameserver 130.102.128.53
nameserver 130.102.2.53
I tried adding nameserver 8.8.8.8
. It didn’t work.
My /etc/yum.repos.d/Centos-Base.repo
is:
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
I tried commenting the mirrorlists and uncommenting the baseurls. Didn’t work.
I really need some help with this. Stuck on this for sometime now.
PS I am trying to set a Hadoop node using Cloudera. That’s when I encountered this problem. So I tried doing a yum update individually to figure out what’s wrong.
Package manager yum is one of the most important tools available to a CentOS 7 system administrator. If the command fails to work, due to various reasons, the update, installation and removal of packages becomes a very difficult task.
While software can still be installed from RPMs or compiled from source, yum has many advantages such as the automatic installation of dependencies and easy system updates.
In this article, we will assume there are no general issues such as a broken Internet connection or serious system-wide problems.
The goal of this post is to discuss the most common examples of yum command failure, explaining both the root cause and how it can be fixed.
No repositories available
Some CentOS 7 installations don’t configure any yum repositories by default, so yum will be unable to install or update any package.
You can quickly check if this is the case by navigating to the /etc/yum.repos.d folder to see if any files are present, or by executing the following command:
yum repolist all
If they are missing, you will have to create and populate the files yourself. A Google search will help you find the right repository information for your version of CentOS 7.
Disabled repositories
Another possible issue is when a repository is configured but disabled, which is hard to troubleshoot because no error message is displayed.
For example, if the epel repository is disabled, trying to install a package such as htop will fail because yum is unable to find it.
Here is an example of a disabled repository in the file /etc/yum.repos.d/epel.repo:
[epel] name=Extra Packages for Enterprise Linux 7 - $basearch #baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch failovermethod=priority enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
The easy fix is to change the value on the enabled line to 1, then run yum update to refresh the package list and install the software you need.
Individual packages can also be excluded from updates. These are configured in the /etc/yum.conf file, look for a line that starts with exclude.
Broken repositories
Another very common problem is the presence of broken repositories, which can make the entire yum update process fail.
This can happen for several reasons, such as a typo in the configuration files, or repositories that are no longer available or have changed their URLs.
Unlike other yum issues, this one tends to be easy to diagnose because the program will display an error that indicates the failed repository.
Edit its file in /etc/yum.repos.d and either correct the mistake or disable the broken repository completely, in order to allow the rest of the update to finish.
Dependency conflicts
Yum will normally install and update any dependencies automatically, without additional user input. There are cases however when a package can’t be installed because a dependency is not found or is the wrong version.
This issue can be quite complex and there is no general fix available for it.
Sometimes you can simply install the missing dependencies manually, and then execute the initial command again. Version conflicts can be fixed by uninstalling the package found on the system.
In some cases, the only option is to configure an additional repository where the correct dependency can be found.
Caching problems
The package manager can be configured to keep package data on disk after an installation, in order to speed up future tasks.
By default, the location where the data is stored is the /var/cache/yum folder.
Sometimes, the cache can become corrupt and cause the command to fail completely. You can manually delete all the contents of the cache folder, or use the yum command itself to clean it:
yum clean all
The above command deletes all data in the folder, an alternative is to force yum to check the cache without deleting it:
yum expire-cache
Database problems
CentOs 7 systems maintain two different package databases on disk, both of them can become corrupted and lead to errors.
When the RPM database is broken, yum will throw errors similar to “Fatal error, run database recovery”.
You will have to manually delete the database, and then rebuild it with these commands:
rm -f /var/lib/rpm/__db* rpm –rebuilddb yum clean all yum update
Yum’s own package information database is stored under the folder /var/lib/yum/yumdb and can be accessed using the yumdb command (part of the yum-utils package).
When the database is broken, it can trigger the “database disk image is malformed” error when running yum.
In most cases, the issue is easily fixed with this command:
yum clean dbcache
However, if updates still fail afterwards, you might have to rebuild the RPM database first, and then clean the yum one again.
Yum is a very powerful package manager that greatly simplifies software installation and updates. While there are many possible causes of yum failure, we have presented the most common ones in the limited space of this blog post, as well as the required troubleshooting steps.