わすれっぽいきみえ

みらいのじぶんにやさしくしてやる

apt.corretto.aws の公開鍵が古いと怒られたときは鍵を更新しましょう

$ sudo apt update
Get:1 https://apt.corretto.aws stable InRelease [10.7 kB]
Err:1 https://apt.corretto.aws stable InRelease
  The following signatures were invalid: EXPKEYSIG A122542AB04F24E3 Amazon Services LLC (Amazon Corretto release) <corretto-team@amazon.com>
Hit:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:3 http://packages.cloud.google.com/apt cloud-sdk InRelease
Hit:4 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:5 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:6 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Fetched 10.7 kB in 1s (8921 B/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
287 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://apt.corretto.aws stable InRelease: The following signatures were invalid: EXPKEYSIG A122542AB04F24E3 Amazon Services LLC (Amazon Corretto release) <corretto-team@amazon.com>
W: Failed to fetch https://apt.corretto.aws/dists/stable/InRelease  The following signatures were invalid: EXPKEYSIG A122542AB04F24E3 Amazon Services LLC (Amazon Corretto release) <corretto-team@amazon.com>
W: Some index files failed to download. They have been ignored, or old ones used instead.

すごーーーく久しぶりに私用PCのUbuntuをアップデートしてたらこのようなエラーに遭遇した。

corretto って何に使ってるんだ?のレベルで覚えてないのでリポジトリを削除してもいいが、まぁエラーの方を修正するかーと調べた。

docs.aws.amazon.com

これによると

wget -O - https://apt.corretto.aws/corretto.key | sudo gpg --dearmor -o /usr/share/keyrings/corretto-keyring.gpg && \
echo "deb [signed-by=/usr/share/keyrings/corretto-keyring.gpg] https://apt.corretto.aws stable main" | sudo tee /etc/apt/sources.list.d/corretto.list

これでいけそうだが、すでにある鍵が古そうなので、まずそれを消すところからはじめる。

$ ls -l /usr/share/keyrings/corretto-keyring.gpg
-rw-r--r-- 1 root root 1166 Apr  2  2024 /usr/share/keyrings/corretto-keyring.gpg

まぁ古い気がする。消すか。

$ sudo rm /usr/share/keyrings/corretto-keyring.gpg
kimikimi714@kimikimi-win10:~$ wget -O - https://apt.corretto.aws/corretto.key | sudo gpg --dearmor -o /usr/share/keyrings/corretto-keyring.gpg && \
echo "deb [signed-by=/usr/share/keyrings/corretto-keyring.gpg] https://apt.corretto.aws stable main" | sudo tee /etc/apt/sources.list.d/corretto.list
--2025-10-12 23:12:26--  https://apt.corretto.aws/corretto.key
Resolving apt.corretto.aws (apt.corretto.aws)... 99.86.195.77, 99.86.195.83, 99.86.195.39, ...
Connecting to apt.corretto.aws (apt.corretto.aws)|99.86.195.77|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2448 (2.4K) [binary/octet-stream]
Saving to: ‘STDOUT’

-                                  100%[================================================================>]   2.39K  --.-KB/s    in 0s

2025-10-12 23:12:26 (506 MB/s) - written to stdout [2448/2448]

deb [signed-by=/usr/share/keyrings/corretto-keyring.gpg] https://apt.corretto.aws stable main
$ sudo apt update
Get:1 https://apt.corretto.aws stable InRelease [10.7 kB]
Get:2 https://apt.corretto.aws stable/main amd64 Packages [22.7 kB]
Hit:3 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:4 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:5 http://packages.cloud.google.com/apt cloud-sdk InRelease
Hit:6 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:7 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Fetched 33.4 kB in 1s (26.8 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
288 packages can be upgraded. Run 'apt list --upgradable' to see them.

いけた。


Google ので困ったら以下を参照するといい。

kimikimi714.com