centos 7.1 - error repository
Asked Answered
B

9

17

Hello I have download the minimal release of CENTOS 7 at this url link download ISO centos 7.x

All work correctly...the PING and the network is OK. I ping to external HOST for example.

But when I digit :

[root@localhost ~]# yum update
Loaded plugins: fastestmirror


 One of the configured repositories failed (Unknown),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Disable the repository, so yum won't use it by default. Yum will then
        just ignore the repository until you permanently enable it again or use
        --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>

     4. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: base/7/x86_64

Why?

This is another command:


root@localhost ~]# yum repolist all
Loaded plugins: fastestmirror
repo id                           repo name                           status
C7.0.1406-base/x86_64             CentOS-7.0.1406 - Base              disabled
C7.0.1406-centosplus/x86_64       CentOS-7.0.1406 - CentOSPlus        disabled
C7.0.1406-extras/x86_64           CentOS-7.0.1406 - Extras            disabled
C7.0.1406-fasttrack/x86_64        CentOS-7.0.1406 - CentOSPlus        disabled
C7.0.1406-updates/x86_64          CentOS-7.0.1406 - Updates           disabled
base/7/x86_64                     CentOS-7 - Base                     enabled: 0
base-debuginfo/x86_64             CentOS-7 - Debuginfo                disabled
base-source/7                     CentOS-7 - Base Sources             disabled
centosplus/7/x86_64               CentOS-7 - Plus                     disabled
centosplus-source/7               CentOS-7 - Plus Sources             disabled
cr/7/x86_64                       CentOS-7 - cr                       disabled
extras/7/x86_64                   CentOS-7 - Extras                   enabled: 0
extras-source/7                   CentOS-7 - Extras Sources           disabled
fasttrack/7/x86_64                CentOS-7 - fasttrack                disabled
updates/7/x86_64                  CentOS-7 - Updates                  enabled: 0
updates-source/7                  CentOS-7 - Updates Sources          disabled
repolist: 0
[root@localhost ~]#

The content of the file /etc/yum.repos.d/CentOS-Base.repo

[root@localhost ~]# cat /etc/yum.repos.d/CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

[root@localhost ~]#
Boob answered 11/9, 2015 at 13:27 Comment(3)
What are the contents of this file? /etc/yum.repos.d/CentOS-Base.repoTransposition
updated the thread with the contentBoob
Same issue here. CentOS 7 minimal.Borstal
A
7

Check your resolv.conf to see where your name server is pointing. Make sure it's something legit as mine was pointing to an old DNS server on the network that was wiped out. I updated it with the new IP address et voila!

Alcoholism answered 22/1, 2016 at 23:47 Comment(2)
I changed the order of nameservers at the resolv.conf and it made yum to work.Antioch
This randomly started happening to me while building a docker container based on CentOS7 that was previously building successfully. Turns out resolv.conf can come out to be different. Updating it as suggested in https://mcmap.net/q/742686/-docker-how-to-start-container-with-defined-nameservers-in-etc-resolv-conf worked for me!Benavides
F
60

The problem is config of dhcp, try typing

dhclient
Fargone answered 7/1, 2016 at 11:25 Comment(1)
But I have to do that each time I reboot. What would be a more permanent solution?Manhunt
A
7

Check your resolv.conf to see where your name server is pointing. Make sure it's something legit as mine was pointing to an old DNS server on the network that was wiped out. I updated it with the new IP address et voila!

Alcoholism answered 22/1, 2016 at 23:47 Comment(2)
I changed the order of nameservers at the resolv.conf and it made yum to work.Antioch
This randomly started happening to me while building a docker container based on CentOS7 that was previously building successfully. Turns out resolv.conf can come out to be different. Updating it as suggested in https://mcmap.net/q/742686/-docker-how-to-start-container-with-defined-nameservers-in-etc-resolv-conf worked for me!Benavides
T
4

Uncomment baseurl in this file: /etc/yum.repos.d/CentOS-Base.repo

#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/

In this block:

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

By uncomment, I mean change this: #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/, to this: baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ (remove the #).

Transposition answered 11/9, 2015 at 13:48 Comment(5)
failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try. mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml: [Errno -1] Error importing repomd.xml for base: Damaged repomd.xml fileBoob
Comment out mirrorlist when uncommenting baseurl.Transposition
nothing...I have downloaded the centos 6.7 and the result is the SAME :-(Boob
Sounds like it could be caused by the mirror being down, you just need to wait.Transposition
Can anyone explain why this is commented out to begin with?Linesman
B
3

sudo sed -i 's/https/http/g' /etc/yum.repos.d/epel.repo

Beaufort answered 1/6, 2018 at 16:7 Comment(1)
Please expand your answer to include how the command you posted will solver the original poster's issue.Kymberlykymograph
T
1

First of all, I was able to fix this issue as mentioned above by using "dhclient". But you will have to run this command every time you reboot. This could be because your Ethernet is disabled and you have to enable it explicitly. Click here to see the reason. For a permanent fix I edited /etc/sysconfig/network-scripts/ifcfg-{YOURETHERNET} (In my case it was /etc/sysconfig/network-scripts/ifcfg-eth0) and changed ONBOOT=yes and boom!!!

Tot answered 24/6, 2016 at 0:27 Comment(0)
C
1

It is the error coming from the https connection in /etc/yum.repos.d/epel.repo after you installed ius-release.rpm through

sudo yum install -y https://centos7.iuscommunity.org/ius-release.rpm

You need to do following stuff in /etc/yum.repos.d/epel.repo.

baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch

Uncomment baseurl and comment line beginning with mirrorlist=.

Concenter answered 14/12, 2016 at 12:48 Comment(1)
IUS isn't mentioned in any of the output, not even repolist. Why do you think that ius-release caused the issue?Stage
P
0

I landed here because I had added a bad mirror for a different dependency (passenger, for a Rails app), and solved this problem by just deleting the bad mirror:

rm /etc/yum.repos.d/YOUR-BAD-DEPENDENCY-NAME.repo

e.g.

rm /etc/yum.repos.d/passenger.repo

Pot answered 30/5, 2017 at 20:53 Comment(0)
M
0

This issue can also happen if the yum repository in question is actually offline or not responding correctly.

This can be a little tricky to diagnose, but the yum repo might respond to ping and respond to web requests on the base URL, but does not serve up packages correctly.

To find the problematic repo, I've found what works best is to move each repo file out of /etc/yum.repos.d and into a temporary holding folder (e.g., /root/yum_bak) and run yum update after removing each repo. Once you've moved the problematic repo out of /etc/yum.repos.d then yum update (and other yum commands will start working normally again. Move the working yum repos back into /etc/yum.repos.d and you're back in business.

Just don't forget to move the problematic repo back into /etc/yum.repos.d after the outage has ended.

Marrero answered 11/5, 2018 at 19:58 Comment(1)
You can also enable or disable repos in any combination with command options. E.g. yum update --disablerepo=repo-name1,repo-name2,... And get repo names from yum repolist.Muller
F
0

I had this problem in a company environment with MITM proxy after adding the EPEL repo with

yum install epel-release

This doesn't happen before (e.g. on yum update). I checked all answers and none of them fixed my problem. Figured out that the other repos use http by default, where epel use https:

# grep mirror /etc/yum.repos.d/epel.repo
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch&infra=$infra&content=$contentdir
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch&infra=$infra&content=$contentdir
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch&infra=$infra&content=$contentdir

So I copied our company root CA in the CentOS trust store and update it:

cp /home/user/my-ca.crt /etc/pki/ca-trust/source/anchors/
update-ca-trust

After adding the cert, updating and installing packages from the EPEL repo works fine!

Fried answered 21/3, 2020 at 18:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.