CentOS 7.2: la configuración del repositorio de Yum falla

CentOS 7.2: la configuración del repositorio de Yum falla

Nueva instalación de CentOS 7.2.1511. El servidor se configuró originalmente con Network Manager y yum funcionaba bien. Administrador de red recientemente deshabilitado y red configurada con servicio tradicional (/etc/sysconfig/network-scripts). Se asignaron nuevas direcciones IP a las NIC. La configuración se realizó originalmente en una red 10.xxx, ahora está en una red 192.168.xx.

Cuando intento ejecutar yum aparece el siguiente error:

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

Aquí están las configuraciones para las interfaces de red. em1 y em2 tienen la misma configuración 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

Mi archivo /etc/hosts:

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

Mi archivo /etc/resolv.conf:

nameserver 68.105.28.12
nameserver 68.105.29.11

Mi archivo CentOS-Base.repo. He descomentado la configuración de la URL base para ver si funciona:

# 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 de 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 del rizo:

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/

Puedo hacer ping a hosts externos y puedo buscar en nombres de dominio:

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

Estoy seguro de que esto tiene algo que ver con las configuraciones antiguas de em1 y em2, cuando estaban vinculadas a direcciones IP diferentes, pero no sé dónde más buscar. ¿Qué podría faltarme para que Yum funcione?

Respuesta1

Después de investigar más, lo descubrí. Faltaba una jerarquía de directorios y yum no pudo detectar mi versión de CentOS. Al ejecutar los siguientes comandos se solucionó:

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

Reemplace "7.2.1511" con su propia versión si tiene este problema y nada más ha funcionado.

ACTUALIZACIÓN 21/05/2017: La ruta "7.2.1511" ha quedado obsoleta. Ejecute el siguiente comando para que yum siga funcionando si todavía está en CentOS 7.2.1511:

echo 7 > /etc/yum/vars/releasever

Eso debería solucionarlo, en caso de que de repente descubras que yum ha dejado de funcionar.

Respuesta2

Fuente

Una solución alternativa es ejecutar el siguiente comando.

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

Esto funcionó para mí. CentOS Linux versión 7.2.1511 (Núcleo)

Respuesta3

http://mirror.centos.org/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] Error HTTP 404 - No encontrado Intentando con otro espejo.

Esto le dice exactamente lo que necesita 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

Tenga en cuenta el espacio entre el signo de interrogación y los parámetros.

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

y la pestaña

lista de espejos =http://mirrorlist.centos.org/? lanzamiento=$releasever&arch=$basearch&repo=actualizaciones&infra=$infra

Lo que hay que hacer es eliminar el espacio en blanco entre el ?y elrelease

información relacionada