そういうのがいいブログ

SIerで働く30代サラリーマンSEがインフラエンジニアに憧れてLinux・クラウド・AWSの勉強をするブログ

【CentOS8】エラー: Failed to download metadata for repo 'epel'が出る

※[PR]当ブログの記事の中にはプロモーションが含まれています。

CentOS8.2で「エラー: Failed to download metadata for repo 'epel'」が発生

CentOS8.2のHinemos監視で「エラー: Failed to download metadata for repo 'epel'」を検知しました。

検知したエラーメッセージ

CentOS8.2サーバをHinemosでシスログ監視していて、以下エラーを検知しました。

/var/log/messages
Sep  4 11:06:09 sv-earth systemd[1]: Starting dnf makecache...
Sep  4 11:06:11 sv-earth dnf[118587]: CentOS-8 - AppStream                             11 kB/s | 4.3 kB     00:00
Sep  4 11:06:12 sv-earth dnf[118587]: CentOS-8 - Base                                 6.3 kB/s | 3.9 kB     00:00
Sep  4 11:06:13 sv-earth dnf[118587]: CentOS-8 - Extras                               3.9 kB/s | 1.5 kB     00:00
Sep  4 11:06:13 sv-earth dnf[118587]: CentOS-8 - PowerTools                            11 kB/s | 4.3 kB     00:00
Sep  4 11:06:14 sv-earth dnf[118587]: Extra Packages for Enterprise Linux Modular 8 -  16 kB/s | 8.8 kB     00:00
Sep  4 11:06:14 sv-earth dnf[118587]: Extra Packages for Enterprise Linux 8 - x86_64   16 kB/s | 5.6 kB     00:00
Sep  4 11:14:04 sv-earth dnf[118587]: Extra Packages for Enterprise Linux 8 - x86_64  5.5 kB/s | 2.5 MB     07:50
Sep  4 11:14:04 sv-earth dnf[118587]: Errors during downloading metadata for repository 'epel':
Sep  4 11:14:04 sv-earth dnf[118587]:  - Curl error (28): Timeout was reached for http://mirrors.thzhost.com/epel/8/Everything/x86_64/repodata/661f74db9f0b682a51b5f989db9ed91ee748665d4d4d196c60ef54e19e72da0c-filelists.xml.gz [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
Sep  4 11:14:04 sv-earth dnf[118587]:  - Curl error (28): Timeout was reached for https://mirrors.thzhost.com/epel/8/Everything/x86_64/repodata/661f74db9f0b682a51b5f989db9ed91ee748665d4d4d196c60ef54e19e72da0c-filelists.xml.gz [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
Sep  4 11:14:04 sv-earth dnf[118587]:  - Curl error (28): Timeout was reached for https://mirrors.thzhost.com/epel/8/Everything/x86_64/repodata/807b2885fdd6757788ad0c745abd7a79f7e44f451181c75dc17701ba6211433d-primary.xml.gz [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
Sep  4 11:14:04 sv-earth dnf[118587]:  - Curl error (28): Timeout was reached for http://mirrors.thzhost.com/epel/8/Everything/x86_64/repodata/807b2885fdd6757788ad0c745abd7a79f7e44f451181c75dc17701ba6211433d-primary.xml.gz [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
Sep  4 11:14:04 sv-earth dnf[118587]: エラー: Failed to download metadata for repo 'epel': Yum repo downloading error: Downloading error(s): repodata/661f74db9f0b682a51b5f989db9ed91ee748665d4d4d196c60ef54e19e72da0c-filelists.xml.gz - Download failed: Curl error (28): Timeout was reached for https://mirrors.thzhost.com/epel/8/Everything/x86_64/repodata/661f74db9f0b682a51b5f989db9ed91ee748665d4d4d196c60ef54e19e72da0c-filelists.xml.gz [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
Sep  4 11:14:04 sv-earth systemd[1]: dnf-makecache.service: Main process exited, code=exited, status=1/FAILURE
Sep  4 11:14:04 sv-earth systemd[1]: dnf-makecache.service: Failed with result 'exit-code'.
Sep  4 11:14:04 sv-earth systemd[1]: Failed to start dnf makecache.

Curlのダウンロードのところで、

Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds

とあるので、

「dnf makecache」でのepleリポジトリのダウンロードでタイムアウトのエラーになっているみたいです。

dnf-autoタイマーのステータスを確認

systemctl list-timers * dnf-*
[root@SV-EARTH ~]# systemctl list-timers * dnf-*
NEXT                         LEFT          LAST                         PASSED    UNIT                ACTIVATES
Sat 2020-09-05 11:21:33 JST  1min 42s left Sat 2020-09-05 10:21:32 JST  58min ago dnf-makecache.timer dnf-makecache.ser>

1 timers listed.
Pass --all to see loaded but inactive timers, too.

エラー発生後のdnf-makecacheの状況

「dnf-makecache」が自動で1時間おきに実行されているようで、
エラー発生後の次の自動実行のタイミングでのログは以下でした。

Sep  4 12:14:14 sv-earth systemd[1]: Starting dnf makecache...
Sep  4 12:14:16 sv-earth dnf[118885]: メタデータキャッシュは最近、リフレッシュされました。
Sep  4 12:14:16 sv-earth systemd[1]: Started dnf makecache.
Sep  4 13:14:21 sv-earth systemd[1]: Starting dnf makecache...
Sep  4 13:14:23 sv-earth dnf[119131]: メタデータキャッシュは最近、リフレッシュされました。
Sep  4 13:14:23 sv-earth systemd[1]: Started dnf makecache.
Sep  4 14:14:37 sv-earth systemd[1]: Starting dnf makecache...
Sep  4 14:14:39 sv-earth dnf[119376]: CentOS-8 - AppStream                             12 kB/s | 4.3 kB     00:00
Sep  4 14:14:40 sv-earth dnf[119376]: CentOS-8 - Base                                 7.0 kB/s | 3.9 kB     00:00
Sep  4 14:14:40 sv-earth dnf[119376]: CentOS-8 - Extras                               3.8 kB/s | 1.5 kB     00:00
Sep  4 14:14:41 sv-earth dnf[119376]: CentOS-8 - PowerTools                            11 kB/s | 4.3 kB     00:00
Sep  4 14:14:41 sv-earth dnf[119376]: Extra Packages for Enterprise Linux Modular 8 -  20 kB/s | 8.8 kB     00:00
Sep  4 14:14:42 sv-earth dnf[119376]: Extra Packages for Enterprise Linux 8 - x86_64  6.7 kB/s | 3.9 kB     00:00
Sep  4 14:14:43 sv-earth dnf[119376]: Extra Packages for Enterprise Linux 8 - x86_64  5.6 MB/s | 7.9 MB     00:01
Sep  4 14:14:51 sv-earth dnf[119376]: メタデータキャッシュを作成しました。
Sep  4 14:14:51 sv-earth systemd[1]: Started dnf makecache.

リポジトリリストの確認

dnf repolist
[root@SV-EARTH ~]# dnf repolist
repo id                                repo の名前
AppStream                              CentOS-8 - AppStream
BaseOS                                 CentOS-8 - Base
PowerTools                             CentOS-8 - PowerTools
epel                                   Extra Packages for Enterprise Linux 8 - x86_64
epel-modular                           Extra Packages for Enterprise Linux Modular 8 - x86_64
extras                                 CentOS-8 - Extras

手動でdnf makecacheを実行してみる

dnf makecache
[root@SV-EARTH ~]# dnf makecache
CentOS-8 - AppStream                                                                     12 kB/s | 4.3 kB     00:00
CentOS-8 - Base                                                                          10 kB/s | 3.9 kB     00:00
CentOS-8 - Extras                                                                       3.9 kB/s | 1.5 kB     00:00
CentOS-8 - PowerTools                                                                   7.4 kB/s | 4.3 kB     00:00
Extra Packages for Enterprise Linux Modular 8 - x86_64                                   51 kB/s | 8.8 kB     00:00
Extra Packages for Enterprise Linux 8 - x86_64                                          6.4 kB/s | 3.6 kB     00:00
メタデータキャッシュを作成しました。

原因と対処

一次的に、ネットワークが遅かったのか、原因が分かりませんが、しばらく様子見にしようと思います。

インフラエンジニアになるための勉強のやり方

私は、某SIerに勤務しながら、WEB系エンジニア・インフラエンジニアに憧れて、プログラミングおよびインフラ技術の勉強をしています。

現在の会社で直接担当している業務の中では、決まった技術しか触れないけれど、
「他にも将来役に立ちそうなインフラ技術を勉強したい」「働きながらでもできる効率的なインフラエンジニアの勉強方法を知りたい」と考えている方のために、
①おすすめの書籍と、②おススメのオンライン学習サイトを紹介します。

働きながら勉強するための、おススメの書籍と、オンラインで学習できるサイトの紹介です。

インフラエンジニアの勉強ができるおススメ書籍

朝の通勤時や帰宅時の電車の中や、社外打合せへの移動中などに勉強するなら、やはり書籍が一番だと思います。

インフラエンジニアの教科書

LINE社に創業時から在籍しているインフラエンジニア・プロマネの「佐野裕」さんの本です。 twitter.com

膨大なトラフィックをさばくLINE社にて構築・保守を行っている現役エンジニアが記すITインフラの必須知識と経験の数々! サーバ、OS、ネットワーク機器、データセンター、購買と商談、障害対応、大規模インフラ、成長するために必要なスキルなど、基礎知識から実践まで言及。 ITインフラの世界が理解できる珠玉の1冊!

インフラエンジニアの教科書
(C&R研究所)
佐野裕

1週間でLPICの基礎が学べる本

Linuxの資格「LPIC」の試験対策を初心者向けに書いた入門書です。

Linuxの資格として広く知られているLPICですが、あまり知識の無いまま試験対策を始める人も多いのではないでしょうか。しかし、試験対策書は試験範囲についてのみ解説しているものが多く、初心者が理解するのは困難です。本書は、初心者がスムーズに試験対策を行えるよう、事前に基礎固めを行うLinux入門書です。試験情報や模擬問題も掲載しているので、資格取得を視野に入れた効率的な基礎学習が行えます。

1週間でLPICの基礎が学べる本
第3版 徹底攻略シリーズ
(インプレス)
中島能和

インフラエンジニアの勉強ができるオンライン学習サイト

Udemy (オンライン動画学習サイト)

Udemy(ユーデミー)は、オンラインで動画で学習できるサービスです。
ITエンジニア系の講座もたくさん公開されています。

≫Udemy 世界最大級のオンライン学習サイト

Udemyの特徴
  • ユーザー登録すれば、第1回の講座は無料で視聴できる
  • 無料のコンテンツもある
  • 過去に受講した人の人数や、受講した人の評価も表示されるので選びやすい

≫Udemy 世界最大級のオンライン学習サイト

開発の人気オンラインコース

以上、読んでいただきありがとうございました。