サポート切れのUbuntu (17.x) のapt updateが失敗する場合の対処

環境
– Google Cloud / Compute Engine / Ubuntu 17.10

サポート切れの古いUbuntuのアップデートをした際に以下のようなエラーで更新ができないことがあります

Ign:1 http://us-east1.gce.archive.ubuntu.com/ubuntu artful InRelease
Ign:2 http://us-east1.gce.archive.ubuntu.com/ubuntu artful-updates InRelease
Ign:3 http://us-east1.gce.archive.ubuntu.com/ubuntu artful-backports InRelease
Err:4 http://us-east1.gce.archive.ubuntu.com/ubuntu artful Release
404 Not Found [IP: 35.196.128.168 80]
Err:5 http://us-east1.gce.archive.ubuntu.com/ubuntu artful-updates Release
404 Not Found [IP: 35.196.128.168 80]
Err:6 http://us-east1.gce.archive.ubuntu.com/ubuntu artful-backports Release
404 Not Found [IP: 35.196.128.168 80]
Ign:7 http://security.ubuntu.com/ubuntu artful-security InRelease
Err:8 http://security.ubuntu.com/ubuntu artful-security Release
404 Not Found [IP: 91.189.91.39 80]
Get:9 http://packages.cloud.google.com/apt google-cloud-logging-wheezy InRelease [5483 B]
Ign:10 http://packages.cloud.google.com/apt google-cloud-monitoring-artful InRelease
Err:11 http://packages.cloud.google.com/apt google-cloud-monitoring-artful Release
404 Not Found [IP: 142.250.98.113 80]
Hit:12 http://archive.canonical.com/ubuntu artful InRelease
Err:9 http://packages.cloud.google.com/apt google-cloud-logging-wheezy InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B53DC80D13EDEF05 NO_PUBKEY FEEA9169307EA071
Reading package lists… Done
E: The repository 'http://us-east1.gce.archive.ubuntu.com/ubuntu artful Release' no longer has 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://us-east1.gce.archive.ubuntu.com/ubuntu artful-updates Release' no longer has 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://us-east1.gce.archive.ubuntu.com/ubuntu artful-backports Release' no longer has 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://security.ubuntu.com/ubuntu artful-security Release' no longer has 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://packages.cloud.google.com/apt google-cloud-monitoring-artful 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.
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://packages.cloud.google.com/apt google-cloud-logging-wheezy InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B53DC80D13EDEF05 NO_PUBKEY FEEA9169307EA071

1)キーを更新します。
これでKeyのエラーは解消されます

curl -f https://packages.cloud.google.com/apt/doc/apt-key.gpg \
| sudo apt-key add -

2)リポジトリの接続先が古いので修正します

参照先を http://old-releases.ubuntu.com/ に修正します。archiveもsecurityも同様です。Compute EngineのリストはGoogleのミラーを示しているので一旦Ubuntuの方に変更しておくのもよいかと思います。ググるとリストから取り除くみたいな記述もあるのですがそれをするとUpdateできなくなりますので修正しておきます。

deb http://old-releases.ubuntu.com/ubuntu/ artful main restricted
deb http://old-releases.ubuntu.com/ubuntu/ artful-updates main restricted
deb http://old-releases.ubuntu.com/ubuntu/ artful universe
deb http://old-releases.ubuntu.com/ubuntu/ artful-updates universe
deb http://old-releases.ubuntu.com/ubuntu/ artful multiverse
deb http://old-releases.ubuntu.com/ubuntu/ artful-updates multiverse
deb http://old-releases.ubuntu.com/ubuntu/ artful-backports main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ artful-security main restricted
deb http://old-releases.ubuntu.com/ubuntu/ artful-security universe
deb http://old-releases.ubuntu.com/ubuntu/ artful-security multiverse

これで無事に apt upgrade 出来るようになったかと思います。


Created by roguer.info 2016