apt update すると GPG error: The following signatures were invalid になったときにやったことのメモ。
apt update すると GPG error: The following signatures were invalid に
MySQL の Docker コンテナで apt update
したら GPG error: The following signatures were invalid
みたいなメッセージが出て update に失敗した。
# apt update Get:1 http://repo.mysql.com/apt/debian stretch InRelease [21.6 kB] Ign:2 http://deb.debian.org/debian stretch InRelease Get:3 http://deb.debian.org/debian stretch-updates InRelease [91.0 kB] Get:5 http://deb.debian.org/debian stretch Release [118 kB] Get:6 http://deb.debian.org/debian stretch Release.gpg [2365 B] Err:1 http://repo.mysql.com/apt/debian stretch InRelease The following signatures were invalid: EXPKEYSIG 8C718D3B5072E1F5 MySQL Release Engineering <mysql-build@oss.oracle.com> Get:4 http://security-cdn.debian.org/debian-security stretch/updates InRelease [94.3 kB] Get:7 http://deb.debian.org/debian stretch-updates/main amd64 Packages [27.9 kB] Get:8 http://deb.debian.org/debian stretch/main amd64 Packages [7086 kB] Get:9 http://security-cdn.debian.org/debian-security stretch/updates/main amd64 Packages [514 kB] Reading package lists... Done W: GPG error: http://repo.mysql.com/apt/debian stretch InRelease: The following signatures were invalid: EXPKEYSIG 8C718D3B5072E1F5 MySQL Release Engineering <mysql-build@oss.oracle.com> E: The repository 'http://repo.mysql.com/apt/debian stretch InRelease' is not signed. 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.
やったこと
MySQL パッケージの鍵が期限切れになってるみたいなので apt-key
コマンドで W: GPG error: http://repo.mysql.com/apt/debian stretch InRelease: The following signatures were invalid: EXPKEYSIG 8C718D3B5072E1F5
のところの 8C718D3B5072E1F5
の新しい鍵をキーサーバーから取得する。
# apt-key adv --keyserver keys.gnupg.net --recv-keys 8C718D3B5072E1F5 Executing: /tmp/apt-key-gpghome.9ZCHkwdRZj/gpg.1.sh --keyserver keys.gnupg.net --recv-keys 8C718D3B5072E1F5 gpg: key 8C718D3B5072E1F5: "MySQL Release Engineering <mysql-build@oss.oracle.com>" 16 new signatures gpg: Total number processed: 1 gpg: new signatures: 16
新しい鍵を取得してから apt update
するとエラーが出なくなっている。
# apt update Ign:1 http://deb.debian.org/debian stretch InRelease Get:2 http://repo.mysql.com/apt/debian stretch InRelease [21.6 kB] Hit:3 http://deb.debian.org/debian stretch-updates InRelease Hit:4 http://deb.debian.org/debian stretch Release Hit:5 http://security-cdn.debian.org/debian-security stretch/updates InRelease Get:6 http://repo.mysql.com/apt/debian stretch/mysql-5.6 amd64 Packages [4798 B] Fetched 26.4 kB in 0s (41.9 kB/s) Reading package lists... Done Building dependency tree Reading state information... Done 31 packages can be upgraded. Run 'apt list --upgradable' to see them.