![](https://blog.komeho.info/wp-content/uploads/2019/05/apt_aws.png)
lightsailなイメージでapt update
しようとしたところ、レポジトリエラーになる現象が。
$ sudo apt update
Ign:1 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial InRelease
Ign:2 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial-updates InRelease
Ign:3 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial-backports InRelease
Err:4 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial Release
404 Not Found [IP: 54.168.13.207 80]
Err:5 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial-updates Release
404 Not Found [IP: 54.168.13.207 80]
Err:6 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial-backports Release
404 Not Found [IP: 54.168.13.207 80]
Hit:7 http://security.ubuntu.com/ubuntu xenial-security InRelease
Reading package lists... Done
E: The repository 'http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial-updates Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial-backports Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
なんじゃらほいということで調べてみることにしました。
一番最初に見つかる情報は以下のWebサイト。
![](https://qiita-user-contents.imgix.net/https%3A%2F%2Fcdn.qiita.com%2Fassets%2Fpublic%2Farticle-ogp-background-9f5428127621718a910c8b63951390ad.png?ixlib=rb-4.0.0&w=1200&mark64=aHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZ3PTkxNiZoPTMzNiZ0eHQ9VWJ1bnR1JTIwJUUzJTgxJUE3JTIwYXB0LWdldCUyMHVwZGF0ZSUyMCVFMyU4MSU4QzQwNCVFMyU4MSVBQiVFMyU4MSVBQSVFMyU4MiU4QiVFNSU5NSU4RiVFOSVBMSU4QyZ0eHQtY29sb3I9JTIzMjEyMTIxJnR4dC1mb250PUhpcmFnaW5vJTIwU2FucyUyMFc2JnR4dC1zaXplPTU2JnR4dC1jbGlwPWVsbGlwc2lzJnR4dC1hbGlnbj1sZWZ0JTJDdG9wJnM9ZDUzNDQ0YzI4NmE2ZjVkYzNjNTI4ZWE4MzFiZmNlMTU&mark-x=142&mark-y=112&blend64=aHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZ3PTcxNiZ0eHQ9JTQwbnlhbmNodSUyMGluJTIwJUU2JUEwJUFBJUU1JUJDJThGJUU0JUJDJTlBJUU3JUE0JUJFJTIwJUUzJTgzJTg5JUUzJTgzJUFGJUUzJTgzJUIzJUUzJTgyJUI0JnR4dC1jb2xvcj0lMjMyMTIxMjEmdHh0LWZvbnQ9SGlyYWdpbm8lMjBTYW5zJTIwVzYmdHh0LXNpemU9MzImdHh0LWFsaWduPWxlZnQlMkN0b3Amcz1lYjA3MmVkMDQyZmEyOTliMmIwMzBiNTk3ODRlNmViMQ&blend-x=142&blend-y=491&blend-mode=normal&s=2281b4b9fd01d6f227da2a9610e4e1b3)
Ubuntu で apt-get update が404になる問題 - Qiita
apt-get update が404になり失敗する問題Ubuntu 17.04 で apt-get update をしたところ、大量の404エラーが出てしまった。その後、 apt-get in…
Ubuntuのメタリリースファイルを確認する限りは、レポジトリURLが変わったようには見えません。
http://changelogs.ubuntu.com/meta-release-lts
apt clean
やsudo rm -rf /var/lib/apt/lists/*
などによる、キャッシュやリストの削除を実施してみましたが、効果はなし。
$ sudo apt update
Ign:1 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial InRelease
Ign:2 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial-updates InRelease
Ign:3 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial-backports InRelease
Err:4 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial Release
404 Not Found [IP: 54.168.13.207 80]
Err:5 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial-updates Release
404 Not Found [IP: 54.168.13.207 80]
Err:6 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial-backports Release
404 Not Found [IP: 54.168.13.207 80]
Get:7 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Get:8 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [638 kB]
Get:9 http://security.ubuntu.com/ubuntu xenial-security/main Translation-en [261 kB]
Get:10 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [7,204 B]
Get:11 http://security.ubuntu.com/ubuntu xenial-security/restricted Translation-en [2,152 B]
Get:12 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [434 kB]
Get:13 http://security.ubuntu.com/ubuntu xenial-security/universe Translation-en [176 kB]
Get:14 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [5,604 B]
Get:15 http://security.ubuntu.com/ubuntu xenial-security/multiverse Translation-en [2,676 B]
Reading package lists... Done
E: The repository 'http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial-updates Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial-backports Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
とりあえずAWS側のトラブルかなー、ということで一旦、/etc/apt/sources.list
のレポジトリのURLを変更することにしました。
-http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu
+http://archive.ubuntu.com/ubuntu
この状態でapt update
を実行したところ、とりあえずは正常にアップデートを確認することは出来ました。
$ sudo apt update
Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Get:2 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
<snip>
Get:23 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [7,804 B]
Get:24 http://archive.ubuntu.com/ubuntu xenial-backports/universe Translation-en [4,184 B]
Fetched 16.8 MB in 10s (1,582 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
ただ、sources.listのヘッダー部分には以下のようなノートがあるので、永続的に変更する場合は、cloud-init側の変更が必要のようです。
## Note, this file is written by cloud-init on first boot of an instance
## modifications made here will not survive a re-bundle.
## if you wish to make changes you can:
## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg
## or do the same in user-data
## b.) add sources in /etc/apt/sources.list.d
## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl
ちなみにこういう時のトラブルの場合、まずはAWS側の状態を確認する場合は、どのあたりを参照するのが良いのでしょうか?
2019年5月12日:追記
今日確認したところ、普通にapt update
できますね・・・ なんかAWS側の問題だったのでしょうか?