[Ubuntu][AWS] lightsailなイメージのapt updateに失敗する。

2019-05-11 19:13:22Ubuntu16.04, apt, aws, repository, ubuntu, xenial, レポジトリ

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サイト。

Ubuntuのメタリリースファイルを確認する限りは、レポジトリURLが変わったようには見えません。

POINT

メタリリースファイル、他にも「http://changelogs.ubuntu.com/meta-release」などもあります。

apt cleansudo 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側の問題だったのでしょうか?

2019-05-11 19:13:22Ubuntu16.04, apt, aws, repository, ubuntu, xenial, レポジトリ