web-dev-qa-db-ja.com

CentOS 7.2:Yumリポジトリ構成が失敗する

CentOS7.2.1511の新規インストール。サーバーは元々Network Managerで構成されていて、yumは正常に機能していました。最近無効にされたNetworkManagerと、従来のサービス(/ etc/sysconfig/network-scripts)で構成されたネットワーク。新しいIPアドレスがNICに割り当てられました。セットアップは元々10.x.x.xネットワーク上にありましたが、現在は192.168.x.xネットワーク上にあります。

Yumを実行しようとすると、次のエラーが発生します。

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

ネットワークインターフェイスの設定は次のとおりです。 em1とem2の基本構成は同じです。

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

私の/ etc/hostsファイル:

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

私の/etc/resolv.confファイル:

nameserver 68.105.28.12
nameserver 68.105.29.11

私のCentOS-Base.repoファイル。 baseurl設定のコメントを解除して、それが機能するかどうかを確認しました。

# 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

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

カール結果:

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/

外部のホストにpingを実行し、ドメイン名を掘り下げることができます。

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

これは、em1とem2が異なるIPアドレスにバインドされていたときの古い構成と関係があると確信していますが、他にどこを見ればよいかわかりません。 yumを機能させるために何が欠けている可能性がありますか?

2
Chris

さらに調査した後、私はそれを理解しました。欠落しているディレクトリ階層があり、yumは私のCentOSバージョンを検出できませんでした。次のコマンドを実行すると、すぐに修正されました。

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

この問題が発生し、他に何も機能しない場合は、「7.2.1511」を独自のリリースバージョンに置き換えてください。

更新2017年5月21日:「7.2.1511」パスは非推奨になりました。 CentOS 7.2.1511を使用している場合は、次のコマンドを実行してyumを機能させます。

echo 7 > /etc/yum/vars/releasever

Yumが機能しなくなったことに突然気付いた場合は、これで問題が解決するはずです。

8
Chris

ソース

回避策は、次のコマンドを実行することです。

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

これは私のために働いた。 CentOS Linuxリリース7.2.1511(コア)

2
Steven

http://mirror.centos.org/centos/%24releasever/os/x86_64/repodata/repomd.xml :[Errno 14] HTTPエラー404-見つかりません他のミラーを試行しています。

これはあなたが知る必要があることを正確に教えてくれます。

[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

疑問符とパラメータの間のスペースに注意してください。

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

そしてタブ

ミラーリスト= http://mirrorlist.centos.org/ ? release = $ releasever&Arch = $ basearch&repo = updates&infra = $ infra

あなたがする必要があるのは、?releaseの間の空白を取り除くことです

0
td512