Yum: Cannot find a valid baseurl (solved)

The yum software package, used for upgrading software on Linux, can sometimes report a mysterious “Cannot find a valid baseurl for repo: extras” error message. Common wisdom says to twiddle config files or reinstall yum. Don’t. Here’s the solution…

Ran into a problem using Fedora Core 4 that went like this:

I was signed on doing a yum upgrade, and during the download my connection dropped. When I got back on line and tried to do it again, I kept getting an error that the baseurl could not be found.

$ sudo yum upgrade
Setting up Upgrade Process
Setting up repositories
Cannot find a valid baseurl for repo: extras
Error: Cannot find a valid baseurl for repo: extras

No amount of searching seemed to resolve my problem or tell me what to do next, though a handful of people had experienced the same problem. The common recommendation was to go to the /etc directory and twiddle the yum configuration files (or even reinstall yum). Hint: don’t.

What you’re seeing is actually actually a DNS failure. Bind is having problem resolving host names. A little bit of poking around with dig, and sure enough, it was clear that something wasn’t right.

In fact, while trying to ssh to the system in the first place, I recall it took a while for the login prompt to appear, yet another sign that reverse name lookups weren’t happening right.

The solution was to make sure that the DNS servers listed in /etc/resolv.conf were indeed serving correctly, and bouncing the named process with the /sbin/service named restart command as root.

Yum still didn’t work right, but that was because it had a dirty cache. So, I cleaned up everthing.

$ sudo yum clean all
Cleaning up Everything
25 headers removed
24 packages removed
12 metadata files removed
0 cache files removed
4 cache files removed

Then I tried the yum upgrade again, and with the cache cleared out, and the bind name service resolving DNS correctly, it worked like a champ. Yum was fixed, and I didn’t have to change a single configuration file for it.

10 thoughts on “Yum: Cannot find a valid baseurl (solved)”

  1. ok I know this is a pretty late response but I what you mentioned upto doesnt work for me. Here is what I have. Fedora Core 5 and I get the same problem. I am not running named and I dont see why I should since I am using another DNS server. My resolve.conf file has the proper ipaddress for the DNS server that I am using. When use dig it responds quickly with the domains information. I can ssh to my system without a problem. Domain name resolution is not a problem but yet I still have the same issue. Any suggestions would be helpful.

  2. FYI I was able to fix it. Silly me. I guess a while back I was trying to use yum and the site was down and I was messing around with the yum files and I happen to comment out one of the extras baseulr files. Thanks again.

  3. Glad to hear you got it working, Rick. As much as I love yum, and other package managers, they do seem to leave a little to be desired when it come to reporting on failure conditions and what to do to correct them.

  4. Same thing happened to me.
    during a yum update, “running transaction test” ran indefinitly, thus I killed it
    then the Cannot find a valid baseurl appeared
    For some weird reason, the base-url was commented out (#)

    now message is gone, but not sure yum is stable again

  5. Good morning.

    I have problem whit this
    i need to install (internet explorer), and the first step is to run this comand line to install the wine*
    yum -y install wine*
    and show to me this error

    [root@localhost ~]# yum -y install wine*
    Loading “installonlyn” plugin
    Setting up Install Process
    Setting up repositories
    extras [1/3]
    Cannot find a valid baseurl for repo: extras
    Error: Cannot find a valid baseurl for repo: extras

    can you help me whit this pls………………..

  6. yum core updates extras
    “Cannot find a valid baseurl for repo”

    Same problem again.
    I stumble on this problem about every 6 months when I try to manually add/update a package.
    I start the “yum -y update” and get the error message, google message and invariable run across the “remove the # from the baseurl…” comment which is usually followed by the “Don’t ask me why this works, I just know it fixed my problem…” tripe.

    This is the 1st answer that makes sense.
    BTW, when I do restart “name” (/etc/init.d/named restart) I get an error as if “named” has failed or failed to start. This is undoubtly the problem with yum. It goes out to the internet and tries to resolve (etc/resolve.conf) the baseurl via a DNS lookup using “named”. “named” fails to cough up the IP address for “baseurl” and yum reports error.

    Now If I can only manage to remember this later.
    Hope the comments get google-cross-referenced and I will see the answer sooner.

  7. Great & helpful post, thank you.
    I tried adding google public DNS to my /etc/resolv.conf
    8.8.8.8
    8.8.4.4
    and things start working again.
    I never could get it to work with my default assigned DNS

  8. when i ran the clean up command, looks like i don’t have anything to clean up.

    [root@node15 ~]# sudo yum clean all
    Cleaning up Everything
    0 headers removed
    0 packages removed
    0 metadata files removed
    0 cache files removed
    0 cache files removed
    [root@node15 ~]# sudo yum upgrade
    Setting up Upgrade Process
    Setting up repositories
    Cannot find a valid baseurl for repo: update
    Error: Cannot find a valid baseurl for repo: update
    [root@node15 ~]#

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.