Yum and Apt are great, but not flawless. I frequently encounter hiccups like “couldn’t connect to host”. Let’s troubleshoot this issue

Step 1: Check the log

First, we will look at what yum is actually doing. So perform a yum command like

yum install pip

If you encounter the issue “Another app is currently holding the yum lock; waiting for it to exit” then you need to kill the yum process. The id is listed under “State” on your screen, simply check the number “pid:”

Another App Is Currently Holding The Yum Lock.png

After you run yum again, yum will fetch the CentOS baseurl defined in your CentOS-Base.repo file in /etc/yum.repos.d to connect to the main repository. If this url is different to centos.org, we can easily fix the pycurl error and make it connect to the host again.

As you can imagine, there are quite a few packages that will mess with this file or even your host may mess with this file, so all we have to do is to go into the folder and fix the baseurl.

Step 2: Fixing CentOS-Base.repo Baseurl

Go into yum.repos.d

cd /etc/yum.repos.d

This path works on CentOS 6/7, but may be different on other Linux distributions.

pico CentOS-Base.repo

Let’s take a quick look at the file.

Ah! Here we go, the baseurl was set incorrectly, preventing your server to properly connect.

Instead of messing with this file, we are going to create a quick backup:

Exit pico

CTRL + X to exit

Move the file

mv CentOS-Base.repo CentOS-Base.repo.bak

Let’s fetch a fresh Base repo from Centos.org:

Go to github for the latest CentOS6 Base repo!


Don’t use wget to download that, you need to open this URL and copy/paste the content or use git to clone it.

pico CentOS-Base.repo

Now paste the content.

VoilĂ , yum is fetching again – from the correct baseurl:

Fixing Yum Pycurl Error 7.Png

Step 3: Check Resolver.conf

Not working for you?

pico /etc/resolv.conf

And comment out the existing nameservers (add two leading ##)

Then insert Google’s nameserver:


VoilĂ , yum should fetch again and you should no longer get the error “Yum couldn’t connect to host”.

Still not working? Post a comment below or in our support forums.