CentOS 7.2: A configuração do repositório do Yum falha

2

Nova instalação do CentOS 7.2.1511. O servidor foi originalmente configurado com o Network Manager e o yum estava funcionando bem. Recentemente desabilitou o Network Manager e configurou a rede com o serviço tradicional (/ etc / sysconfig / network-scripts). Novos endereços IP foram atribuídos às NICs. A instalação foi originalmente em uma rede 10.x.x.x, agora está em uma rede 192.168.x.x.

Quando tento executar o yum, recebo o seguinte erro:

Loaded plugins: fastestmirror, langpacks
http://mirror.centos.org/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/

http://mirror.centos.org/centos/%24releasever/extras/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.


 One of the configured repositories failed (CentOS-$releasever - Extras),
 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 extras

 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=extras.skip_if_unavailable=true

failure: repodata/repomd.xml from extras: [Errno 256] No more mirrors to try.
http://mirror.centos.org/centos/$releasever/extras/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found

Aqui estão as configurações das interfaces de rede. em1 e em2 têm a mesma configuração básica:

TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
NAME=em1
NM_CONTROLLED=no
IPV4_FAILURE_FATAL=no
UUID=d67971e8-846d-428c-9a1d-ff2768ae6ddb
DEVICE=em1
HWADDR=14:18:77:69:D5:DB
ONBOOT=yes
IPADDR=192.168.x.x
NETMASK=255.255.255.0
GATEWAY=192.168.x.x

Meu arquivo / etc / hosts:

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.x.x hostname

Meu arquivo /etc/resolv.conf:

nameserver 68.105.28.12
nameserver 68.105.29.11

Meu arquivo CentOS-Base.repo. Eu descomentei as configurações de base para ver se isso funcionaria:

# 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
skip_if_unavailable = 1
keepcache = 0

#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

Resultados do yum repolist:

Loaded plugins: fastestmirror, langpacks
http://mirror.centos.org/centos/%24releasever/os/x86_64/repodata/repomd.xml:   [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please create a bug on   https://bugs.centos.org/

  http://mirror.centos.org/centos/%24releasever/extras/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
http://mirror.centos.org/centos/%24releasever/extras/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
http://mirror.centos.org/centos/%24releasever/updates/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
repo id                                                                           repo name                                                                         status
extras/$releasever/x86_64                                                       CentOS-$releasever - Extras                                                   0
updates/$releasever/x86_64                                                  CentOS-$releasever - Updates                                                  0
repolist: 0

Resultado de curvatura:

curl 'http://mirrorlist.centos.org/?release=6&arch=i386&repo=os'
http://mirrors.usc.edu/pub/linux/distributions/centos/6.8/os/i386/
http://mirror.lug.udel.edu/pub/centos/6.8/os/i386/
http://mirrors.lga7.us.voxel.net/centos/6.8/os/i386/
http://mirror.chpc.utah.edu/pub/centos/6.8/os/i386/
http://centos.unixheads.org/6.8/os/i386/
http://centos.mirror.lstn.net/6.8/os/i386/
http://centos.mirror.nac.net/6.8/os/i386/
http://mirror.tocici.com/centos/6.8/os/i386/
http://mirror.supremebytes.com/centos/6.8/os/i386/
http://mirror.steadfast.net/centos/6.8/os/i386/

Posso fazer ping de hosts externos e descobrir nomes de domínio:

dig cnn.com

; <<>> DiG 9.9.4-RedHat-9.9.4-29.el7_2.3 <<>> cnn.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29420
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;cnn.com.           IN  A

;; ANSWER SECTION:
cnn.com.        156 IN  A   157.166.226.26
cnn.com.        156 IN  A   157.166.226.25

;; Query time: 1 msec
;; SERVER: 68.105.28.12#53(68.105.28.12)
;; WHEN: Mon Jun 20 12:28:44 EDT 2016
;; MSG SIZE  rcvd: 68

Tenho certeza de que isso tem algo a ver com as configurações antigas de em1 e em2, quando elas estavam vinculadas a diferentes endereços IP, mas não sei mais onde procurar. O que posso estar perdendo que fará o yum funcionar?

    
por Chris 20.06.2016 / 18:35

3 respostas

6

Depois de mais investigações, descobri. Havia uma hierarquia de diretórios faltando, e o yum não pôde detectar minha versão do CentOS. Executando os seguintes comandos corrigidos:

mkdir -p /etc/yum/vars
echo 7.2.1511 > /etc/yum/vars/releasever

Substitua "7.2.1511" pela sua própria versão se você estiver com este problema e nada mais funcionou.

ATUALIZAÇÃO 21/05/2017: O caminho "7.2.1511" foi suspenso. Execute o seguinte comando para manter o yum funcionando se você ainda estiver no CentOS 7.2.1511:

echo 7 > /etc/yum/vars/releasever

Isso deve resolver isso, caso você de repente descubra que o yum parou de funcionar.

    
por 20.06.2016 / 20:51
2

Fonte

Uma solução alternativa é executar o seguinte comando.

rm -fr /var/cache/yum/x86_64/7
yum clean all

Isso funcionou para mim. Versão do CentOS Linux 7.2.1511 (Core)

    
por 16.03.2017 / 16:35
0

http://mirror.centos.org/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found Trying other mirror.

Isso lhe diz exatamente o que você precisa saber.

[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
skip_if_unavailable = 1
keepcache = 0

#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

Observe o espaço entre o ponto de interrogação e os parâmetros.

http://mirrorlist.centos.org/? release=$releasever&arch=$basearch&repo=os&infra=$infra

E a guia

mirrorlist=http://mirrorlist.centos.org/? release=$releasever&arch=$basearch&repo=updates&infra=$infra

O que você precisa fazer é remover o espaço em branco entre o ? e o release

    
por 20.06.2016 / 18:44