3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

AppStreamからメタデータをダウンロードできないときの対処法(CentOS8)

Last updated at Posted at 2022-02-05

先日から急にyumやdnfでパッケージがダウンロードできなくなってしまい、そのときの対処法のメモ。

状況  

yum,dnfでパッケージインストール時「Failed to download metadata for repo 'appstream'」といったエラーが出てリポジトリからパッケージを落とせなくなってしまった。
「yum update」でも同様。。。

$yum update
Failed to set locale, defaulting to C.UTF-8
CentOS Linux 8 - AppStream                                                           60  B/s |  38  B     00:00    
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

解決方法

CentOS8のEOLにより元々のリポジトリが使えなくなってしまったとのこと。
リポジトリのURLを書き換えると再度インストールできるようになる。

$sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*;
$sed -i 's|mirrorlist|#mirrorlist|g' /etc/yum.repos.d/CentOS-*; 
$yum update
Failed to set locale, defaulting to C.UTF-8
CentOS Linux 8 - AppStream                                                          569 kB/s | 8.4 MB     00:15    
CentOS Linux 8 - BaseOS                                                             404 kB/s | 4.6 MB     00:11    
CentOS Linux 8 - Extras                                                             6.1 kB/s |  10 kB     00:01    
Dependencies resolved.
~~
~~
  • 書き換え前  
$cat /etc/yum.repos.d/CentOS-Linux-AppStream.repo 
# CentOS-Linux-AppStream.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are 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, you can try the commented out
# baseurl line instead.
[appstream]
name=CentOS Linux $releasever - AppStream
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
$
  • 書き換え後
$cat /etc/yum.repos.d/CentOS-Linux-AppStream.repo 
# CentOS-Linux-AppStream.repo
#
# The #mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are 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, you can try the commented out
# baseurl line instead.

[appstream]
name=CentOS Linux $releasever - AppStream
#mirrorlist=http://#mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra
baseurl=http://vault.centos.org/$contentdir/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
$

参考

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?