最近、CentOS7からCentOS8へのアップグレードを検討しましたが、その過程で次のエラーが発生しました:リポジトリ「appstream」のキャッシュの同期に失敗しました 。以下は完全なエラーです:
Failed to synchronize cache for repo 'baseos', ignoring this repo. Failed to synchronize cache for repo 'appstream', ignoring this repo.
/var/log/dnf.log
からの出力 デバッグ情報の詳細:
2022-02-15T10:09:08Z DEBUG repo: downloading from remote: appstream 2022-02-15T10:09:08Z DEBUG Cannot download 'http://mirror.centos.org/centos/8/AppStream/x86_64/os/': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried. 2022-02-15T10:09:08Z DEBUG repo: downloading from remote: extras 2022-02-15T10:09:08Z DEBUG not found other for: CentOS Linux 8 - Extras 2022-02-15T10:09:08Z DEBUG not found modules for: CentOS Linux 8 - Extras 2022-02-15T10:09:08Z DEBUG not found deltainfo for: CentOS Linux 8 - Extras 2022-02-15T10:09:08Z DEBUG not found updateinfo for: CentOS Linux 8 - Extras 2022-02-15T10:09:08Z DEBUG extras: using metadata from Fri 10 Dec 2021 06:26:25 PM IST. 2022-02-15T10:09:08Z WARNING Failed to synchronize cache for repo 'baseos', ignoring this repo. 2022-02-15T10:09:08Z WARNING Failed to synchronize cache for repo 'appstream', ignoring this repo.
エラーメッセージを見て、インターネット接続が原因の可能性があると思いました。ただし、インターネット接続とDNSは、以下に示すように問題なく機能しました。
[root@upgrade-centos log]# ping google.com PING google.com (172.217.166.206) 56(84) bytes of data. 64 bytes from del03s13-in-f14.1e100.net (172.217.166.206): icmp_seq=1 ttl=115 time=44.10 ms ^C --- google.com ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 44.971/44.971/44.971/0.000 ms
では、どうすれば問題を解決できましたか?
修正方法リポジトリアプリストリームのキャッシュの同期に失敗しました
この問題には複数の理由が考えられます。最も一般的なものは次のとおりです。
- 日付と時刻の設定が正しくありません
- 古い
dnf
キャッシュが利用可能または期限切れ - CentOS baseURL
不正な日付と時刻の設定を修正する方法
timedatectl
コマンドはCentOS7/8の新しいユーティリティツールです。これは、古い従来のdate
の代わりになります sysvinit
で使用されるコマンド デーモンベースのLinuxディストリビューション。
システムの現在の日付と時刻を見つけます。適切なタイムゾーンで正しいことを確認してください。
[root@upgrade-centos ~]# timedatectl Local time: Tue 2022-02-15 11:24:25 UTC Universal time: Tue 2022-02-15 11:24:25 UTC RTC time: Tue 2022-02-15 11:24:25 Time zone: UTC (UTC, +0000) System clock synchronized: no NTP service: active RTC in local TZ: no
タイムゾーンに設定
[root@upgrade-centos ~]# timedatectl set-timezone "Asia/Kolkata" [root@upgrade-centos ~]# date Tue Feb 15 16:58:57 IST 2022
古い/期限切れのdnfキャッシュをクリアする方法
これは、各種類のキャッシュをクリーンアップするための記事です。すべてをクリーンアップするには、次のコマンドを実行します。
[root@upgrade-centos ~]# dnf clean all [root@upgrade-centos ~]# rm -rf /var/cache/dnf
CentOSbaseURLをmirror.centos.orgからvault.centos.orgに変更する方法
CentOS Linux 8は2021年12月31日に保守終了(EOL)に達しました。これは、CentOS8が公式のCentOSプロジェクトから開発リソースを受け取らないことを意味します。 2021年12月31日以降、CentOSを更新する必要がある場合は、ミラーをvault.centos.orgに変更して、永続的にアーカイブする必要があります。または、CentOS Streamにアップグレードするか、CentOSからRockyLinuxに移行することもできます。
/etc/yum.repos.d/
に移動します ディレクトリ。
[root@autocontroller ~]# cd /etc/yum.repos.d/
以下のコマンドを実行します
[root@autocontroller ~]# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
[root@autocontroller ~]# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
次に、dnf update
を実行します
[root@autocontroller ~]# dnf update
以上です!