Amazon Linux 2 で yum update コマンドを実行したら「Cannot find a valid baseurl for repo: amzn2-core/2/x86_64」のエラーが表示され、yum update に失敗した場合の対応手順について解説します。
Amazon Linux 2 で初っ端 yum update が失敗する
Amazon Linux 2 がリリースされたということで、早速 Amazon Linux 2 を使ってみようと EC2 インスタンスを起動し、まずは yum update で最新の状態にしておこうとすると初っ端からエラーになります。
[root@amazonlinux2 ~]# yum update
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Could not retrieve mirrorlist http://amazonlinux.ap-northeast-1.amazonaws.com/2/core/latest/x86_64/mirror.list error was
12: Timeout on http://amazonlinux.ap-northeast-1.amazonaws.com/2/core/latest/x86_64/mirror.list: (28, ‘Connection timed out after 5000 milliseconds’)
One of the configured repositories failed (Unknown),
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. Run the command with the repository temporarily disabled
yum –disablerepo= …
4. Disable the repository permanently, 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
or
subscription-manager repos –disable=
5. 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:
[root@amazonlinux2 ~]# yum update
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core | 3.7 kB 00:00:00
amzn2extra-docker | 3.0 kB 00:00:00
(1/5): amzn2-core/2/x86_64/updateinfo | 245 kB 00:00:00
(2/5): amzn2-core/2/x86_64/group_gz | 2.5 kB 00:00:00
(3/5): amzn2extra-docker/2/x86_64/updateinfo | 69 B 00:00:00
(4/5): amzn2extra-docker/2/x86_64/primary_db | 68 kB 00:00:00
(5/5): amzn2-core/2/x86_64/primary_db | 43 MB 00:00:01
Resolving Dependencies
–> Running transaction check
—> Package amazon-linux-extras.noarch 0:1.6.11-1.amzn2 will be updated
—> Package amazon-linux-extras.noarch 0:1.6.12-1.amzn2 will be an update
—> Package amazon-linux-extras-yum-plugin.noarch 0:1.6.11-1.amzn2 will be updated
—> Package amazon-linux-extras-yum-plugin.noarch 0:1.6.12-1.amzn2 will be an update
—> Package ca-certificates.noarch 0:2019.2.32-76.amzn2.0.2 will be updated
—> Package ca-certificates.noarch 0:2019.2.32-76.amzn2.0.3 will be an update
—> Package python.x86_64 0:2.7.18-1.amzn2 will be updated
—> Package python.x86_64 0:2.7.18-1.amzn2.0.1 will be an update
—> Package python-devel.x86_64 0:2.7.18-1.amzn2 will be updated
—> Package python-devel.x86_64 0:2.7.18-1.amzn2.0.1 will be an update
—> Package python-libs.x86_64 0:2.7.18-1.amzn2 will be updated
—> Package python-libs.x86_64 0:2.7.18-1.amzn2.0.1 will be an update
—> Package python2-rsa.noarch 0:3.4.1-1.amzn2 will be updated
—> Package python2-rsa.noarch 0:3.4.1-1.amzn2.0.1 will be an update
—> Package tzdata.noarch 0:2019c-1.amzn2 will be updated
—> Package tzdata.noarch 0:2020a-1.amzn2 will be an update
–> Finished Dependency Resolution
Dependencies Resolved
============================================================================================
Package Arch Version Repository Size
============================================================================================
Updating:
amazon-linux-extras noarch 1.6.12-1.amzn2 amzn2-core 36 k
amazon-linux-extras-yum-plugin noarch 1.6.12-1.amzn2 amzn2-core 10 k
ca-certificates noarch 2019.2.32-76.amzn2.0.3 amzn2-core 391 k
python x86_64 2.7.18-1.amzn2.0.1 amzn2-core 92 k
python-devel x86_64 2.7.18-1.amzn2.0.1 amzn2-core 403 k
python-libs x86_64 2.7.18-1.amzn2.0.1 amzn2-core 7.5 M
python2-rsa noarch 3.4.1-1.amzn2.0.1 amzn2-core 68 k
tzdata noarch 2020a-1.amzn2 amzn2-core 479 k
コメント