サポート切れの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 出来るようになったかと思います。

Azureのプランを無料期間からアップグレードする

Read More

マイクロソフトの提供するクラウドサービスであるAzureを最近利用させていただいていました。 1ヶ月間様々なサービスが利用でき、その後もクレジットカードを登録することで無料枠を利用することが出来ます。(このあたりは、AWSやGCPなどと同様ですね)。

無料期間中の実績

費用のプランニングをする画面があります。今回はVMを利用して、Diabloのゲームサーバとして利用をさせていもらいました。 サービス自体のON/OFFは結構時間がかかる印象ですがそういった構成が終わったあとは特に問題なく安定して利用することが出来た印象です。そして日々のバックアップは良いですね。 何度かバックアップから新規のイメージを復元しそこでソフトウェアの設定を試したりしてました。

12ヶ月無料のサービスの範囲でとして適応されるのか評価をしている項目がありました。データのダウンストリーム(AzureからClientに送信されるデータ)がかなり超過しています。果たしてこれは、Remote Desktopの画面のためなのか本当にゲームサーバから送信されたデータであるのか

リソースグループをサーバもクライアントも同じにしてしまったのでこれ以上はわからないですが日々の差がだいぶあることからRemoteDesktopなんじゃないかなと思います。

プランのアップグレード

左上に、 アップグレード のボタンが出ていますのでクリックをします。

プランを テクニカルサポートなし を選択してアップグレードを実施します。

通信料金を、計算ツールで調べてみます。

https://azure.microsoft.com/ja-jp/pricing/calculator/?service=bandwidth を調べてみるとなかなかの費用になりそうです。 利用の超過を見逃さないように予算アラートを設定しておきました。 利用状況についてはまた来月見ていきたいと思います。

サイトのサーバをGCEのE2-Microインスタンスタイプに変更

サイトの費用が気になっていたもの手を付けてなかったのでサーバ(Google Compute Engine)の構成を変えた。

  • これまで Cloudfare ---> Global Load Balancer ---> Instance Group ---> GCE(f1-micro) という構成。
  • 以前、 jpリージョンで動作させていたGCEを無料枠のUSリージョンに移動したりしたときにGLB経由にして移動したときの名残。
  • f1-microでは何ヶ月か前から処理が間に合わなくなり良く停止していたため今回 e2-micro に変更
  • GLBを破棄して直接 Cloudfareから接続をするように変更
  • 最近E2マシンタイプという新しいモデルがでてきたので使ってみたいと思います。 https://googlecloud.4watcher365.dev/google-cloud/e2-vm-machinetypes/
  • 2020/01より外部IPアドレスが利用していても有料化されるので少しでもコストを下げたい

ということで以下のことを実施しました

  • GLBに関するリソースを削除
  • GCEのCPUモデルを e2-micro に変更
  • GCEのネットワーク設定にて外部IPアドレスを固定で新規に追加(既存はエフェメラル)
  • 作成したIPアドレスを、CloudFare側の設定に追加(既存は削除)

費用的にはGCEの無料枠から外れる、外部IPが新規にかかる。代わりにGLBの費用が削減ということでトータルで1000Yen/Month程度は下がる予定です。