How do I fix these Yum errors?

beansbaxter

Verified User
Joined
Mar 17, 2004
Messages
213
Location
WA
Periodically, I update my server with the following commands:

Code:
yum update yum
yum update

And now, these commands are no longer working. When I try either command, I receive the following error message:

Code:
Loaded plugins: fastestmirror
Determining fastest mirrors
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/
removing mirrorlist with no valid mirrors: /var/cache/yum/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base

Everything has been working fine for over a year, and now all of a sudden, yum isn't working.

How do I fix this?

Running CentOS with the latest version of DA.

Thanks in advance.
 
Normally you don't need to do "yum update yum" but only "yum update".
I always do "yum check-update" first to see what gets updated and after that yum update.
If there is a yum update, it will be in the yum update too, so you don't need the "yum update yum".

Try this first:

yum clean all
yum update

If you still have the same error... are you using Centos 5 by any chance?
 
Good to know. I was under the impression that you should update yum before running yum. I've made note of the check-update feature, that will come in handy.

I tried your suggestion, and I still get the same error:

Code:
[root@servername ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning up Everything
[root@servername ~]# yum update
Loaded plugins: fastestmirror
Determining fastest mirrors
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/
removing mirrorlist with no valid mirrors: /var/cache/yum/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base

And yes, this particular server is running CentOS 5:
Code:
centos-release-5-11.el5.centos

Any help would be greatly appreciated.
 
Centos 5.... I was afraid of that. Centos 5 went EOL march 31 this year, so that's why you're having issues. Yum for Centos 5 will not work anymore.

However, there is a temporarily solution so you can still use yum to update by changing to the vault repository's.
Change your /etc/yum.repos.d/CentOS-Vault.repo accordingly:

Code:
# TEMPORARY CENT5 EOL REPO
# WARNING CENT 5 IS EOL UPGRADES SHOULD BE PERFORMED IMMEDIATELY

[C5.11-base]
name=CentOS-5.11 - Base
baseurl=http://vault.centos.org/5.11/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
enabled=1

[C5.11-updates]
name=CentOS-5.11 - Updates
baseurl=http://vault.centos.org/5.11/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
enabled=1

[C5.11-extras]
name=CentOS-5.11 - Extras
baseurl=http://vault.centos.org/5.11/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
enabled=1

[C5.11-centosplus]
name=CentOS-5.11 - Plus
baseurl=http://vault.centos.org/5.11/centosplus/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
enabled=0

After that, do:
yum clean all
yum update

And you should be fine for the moment.

However, be aware I don't know how long this temporarily repo will keep on working. It's time do upgrade to Centos 7.
 
Ok. That makes sense. Good to know it's because that version of CentOS is EOL and there's nothing specifically wrong with the server.

I've been running 6 on all servers, with this one exception running 5. I haven't even started to look at 7 yet... time to give it a try.

Thank you for your help!
 
You're welcome.

Good luck with 7. I'm also running 6 and my first 7 server will probably coming this year. Several changes in 7 especially with a command like:
/etc/rc.d/init.d/daemon.sh restart
which is now different. Lot of getting used to again on console level. :)
 
Well I tried, but gives me this error:

Code:
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/
removing mirrorlist with no valid mirrors: /var/cache/yum/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base
 
Are you on Centos 5.11 or 5.9 or another one?
Do you have the Centos Vault repo like described above or did you do it another way? Do you also have other repo's like the epel.repo?
Check if your system can resolve the mirrorlist (see link below).

You might also want to have a look at this link.
 
Are you on Centos 5.11 or 5.9 or another one?
Do you have the Centos Vault repo like described above or did you do it another way? Do you also have other repo's like the epel.repo?
Check if your system can resolve the mirrorlist (see link below).

You might also want to have a look at this link.

Hello,
It's 5.11
I dont know about any other repo's. At least I did not make any changes.
I will check as you said.
Thanks
 
Hi again
I checked the issues on the link, and it seems ok. My repo is TEMPORARY CENT5 EOL REPO
It pings mirrorlist.centos.org
But I dont know about epel.repo thingy, How can I check this?
And also, maybe relevant, I can not see my version with the command:
Code:
cat /etc/centos-release
cat: /etc/centos-release: No such file or directory
It works with:
Code:
cat /etc/redhat-release
CentOS release 5.11 (Final)
 
The version is correct, the /etc/centos-release is only since 6.0 does not work on my customers old 5.0 box either that way. So you should be fine.

The repo should be named /etc/yum.repos.d/CentOS-Vault.repo
at least I'm sure that one works, and should have the content that I posted.

You can see if you have other repo's by looking in /etc/yum.repos.d for other *.repo files, normally it's only the default once which might look like this:
Code:
-rw-r--r--  1 root root  1956 Apr 25 20:59 CentOS-Base.repo
-rw-r--r--  1 root root   645 Sep 19  2014 CentOS-Debuginfo.repo
-rw-r--r--  1 root root   277 Sep 19  2014 CentOS-fasttrack.repo
-rw-r--r--  1 root root   626 Sep 19  2014 CentOS-Media.repo
-rw-r--r--  1 root root  1330 Sep 19  2014 CentOS-Sources.repo
-rw-r--r--  1 root root   773 Apr 25 20:57 CentOS-Vault.repo
 
Try this:
Do as I did with the files.
Then:
Code:
cp /var/cache/yum/addons/mirrorlist.txt /var/cache/yum/addons/mirrorlist.txt.bak
rm -f /var/cache/yum/addons/mirrorlist.txt
yum clean all
yum update

Then it will build a new mirrorlist out of the Centos-Vault.repo if all is working well.
 
Thanks again,
It seems I have that epel.repo
Code:
total 48
drwxr-xr-x  2 root root  4096 Kas  3  2016 .
drwxr-xr-x 58 root root 12288 Tem 25 00:17 ..
-rw-r--r--  1 root root  1926 Eyl 19  2014 CentOS-Base.repo
-rw-r--r--  1 root root   645 Eyl 19  2014 CentOS-Debuginfo.repo
-rw-r--r--  1 root root   277 Eyl 19  2014 CentOS-fasttrack.repo
-rw-r--r--  1 root root   626 Eyl 19  2014 CentOS-Media.repo
-rw-r--r--  1 root root  1330 Eyl 19  2014 CentOS-Sources.repo
-rw-r--r--  1 root root   773 Tem 25 02:45 CentOS-Vault.repo
-rw-r--r--  1 root root   954 Ağu 11  2010 epel.repo
-rw-r--r--  1 root root  1054 Ağu 11  2010 epel-testing.repo
Should I delete them?
 
Did you also removed the mirrorlist.txt file and gave both commands afterwards?

If the error then persists it might well be a resolving error, you might want to add 8.8.8.8 as nameserver in your /etc/resolv.conf file.
 
Did you also removed the mirrorlist.txt file and gave both commands afterwards?

If the error then persists it might well be a resolving error, you might want to add 8.8.8.8 as nameserver in your /etc/resolv.conf file.
I removed it at the first place, but I tried again. Gives me this.
cp: cannot stat `/var/cache/yum/addons/mirrorlist.txt': No such file or directory

After yum clean all and yum update its the same, I think it can not create a mirrorlist
 
Since the copy command gave an error, it looks like you don't have a mirrorlist at all.
You are on centos 5.11 you say, as root create a mirrorlist.txt file in /var/cache/yum/addons with this content:
Code:
http://centos.weepeetelecom.nl/5.11/addons/i386/
http://centos.mirror.transip.nl/5.11/addons/i386/
http://archive.cs.uu.nl/mirror/Linux/centos/5.11/addons/i386/
http://centos.mirror.evertje.net/5.11/addons/i386/
http://ftp.tudelft.nl/centos.org/5.11/addons/i386/
http://mirror.oxilion.nl/centos/5.11/addons/i386/
http://mirrors.nl.kernel.org/centos/5.11/addons/i386/
http://mirrors.supportex.net/centos/5.11/addons/i386/
http://centos.mirror.easycolocate.nl/5.11/addons/i386/
http://mirror.widexs.nl/ftp/pub/os/Linux/distr/centos/5.11/addons/i386/
Then again do:
yum clean all
yum update

If that does not work either, I still have another option which might work for you.

In that case you have to edit all your repos and replace all baseurl http://mirror.centos.org/5.??/ to http://vault.centos.org/5.11/ and uncomment this line, but comment the line starting with "mirrorlist".
 
Last edited:
Hi and thanks for the effort again :)
I did all but same again.
In all the repos there was only one line as you described btw. Starting with mirror.centos.org...
All others were vault.centos.org already. But there were shortcuts as release numbers like this
Code:
http://vault.centos.org/centos/$releasever/os/Source/
 
By the way, those links in the mirrorlist.txt are dead (404). Is that ok?
 
Back
Top